Skip to content

Commit

Permalink
Merge branch 'main' into 136039-rules-status-deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Nov 14, 2022
2 parents a4e15c3 + 24df1db commit 789384e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
1 change: 1 addition & 0 deletions .buildkite/disabled_jest_configs.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[
"x-pack/plugins/triggers_actions_ui/jest.config.js",
"x-pack/plugins/watcher/jest.config.js"
]
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
*/

import type { Logger } from '@kbn/core/server';
import { TASK_METRICS_CHANNEL } from '../constants';
import type { ITelemetryEventsSender } from '../sender';
import type { TelemetryConfiguration } from '../types';
import type { ITelemetryReceiver } from '../receiver';
import type { TaskExecutionPeriod } from '../task';
import { artifactService } from '../artifact';
import { telemetryConfiguration } from '../configuration';
import { tlog } from '../helpers';
import { createTaskMetric, tlog } from '../helpers';

export function createTelemetryConfigurationTaskConfig() {
return {
Expand All @@ -28,6 +29,8 @@ export function createTelemetryConfigurationTaskConfig() {
sender: ITelemetryEventsSender,
taskExecutionPeriod: TaskExecutionPeriod
) => {
const startTime = Date.now();
const taskName = 'Security Solution Telemetry Configuration Task';
try {
const artifactName = 'telemetry-buffer-and-batch-sizes-v1';
const configArtifact = (await artifactService.getArtifact(
Expand All @@ -42,10 +45,16 @@ export function createTelemetryConfigurationTaskConfig() {
configArtifact.max_endpoint_telemetry_batch;
telemetryConfiguration.max_security_list_telemetry_batch =
configArtifact.max_security_list_telemetry_batch;
await sender.sendOnDemand(TASK_METRICS_CHANNEL, [
createTaskMetric(taskName, true, startTime),
]);
return 0;
} catch (err) {
tlog(logger, `Failed to set telemetry configuration due to ${err.message}`);
telemetryConfiguration.resetAllToDefault();
await sender.sendOnDemand(TASK_METRICS_CHANNEL, [
createTaskMetric(taskName, false, startTime, err.message),
]);
return 0;
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
*/

import type { Logger } from '@kbn/core/server';
import { TASK_METRICS_CHANNEL } from '../constants';
import type { ITelemetryEventsSender } from '../sender';
import type { TelemetryFilterListArtifact } from '../types';
import type { ITelemetryReceiver } from '../receiver';
import type { TaskExecutionPeriod } from '../task';
import { artifactService } from '../artifact';
import { filterList } from '../filterlists';
import { tlog } from '../helpers';
import { createTaskMetric, tlog } from '../helpers';

export function createTelemetryFilterListArtifactTaskConfig() {
return {
Expand All @@ -28,6 +29,8 @@ export function createTelemetryFilterListArtifactTaskConfig() {
sender: ITelemetryEventsSender,
taskExecutionPeriod: TaskExecutionPeriod
) => {
const startTime = Date.now();
const taskName = 'Security Solution Telemetry Filter List Artifact Task';
try {
const artifactName = 'telemetry-filterlists-v1';
const artifact = (await artifactService.getArtifact(
Expand All @@ -36,10 +39,16 @@ export function createTelemetryFilterListArtifactTaskConfig() {
filterList.endpointAlerts = artifact.endpoint_alerts;
filterList.exceptionLists = artifact.exception_lists;
filterList.prebuiltRulesAlerts = artifact.prebuilt_rules_alerts;
await sender.sendOnDemand(TASK_METRICS_CHANNEL, [
createTaskMetric(taskName, true, startTime),
]);
return 0;
} catch (err) {
tlog(logger, `Failed to set telemetry filterlist artifact due to ${err.message}`);
filterList.resetAllToDefault();
await sender.sendOnDemand(TASK_METRICS_CHANNEL, [
createTaskMetric(taskName, false, startTime, err.message),
]);
return 0;
}
},
Expand Down

0 comments on commit 789384e

Please sign in to comment.