diff --git a/x-pack/plugins/synthetics/server/routes/telemetry/monitor_upgrade_sender.ts b/x-pack/plugins/synthetics/server/routes/telemetry/monitor_upgrade_sender.ts index 5d0d29a4c8ac5..1cb4659359f5e 100644 --- a/x-pack/plugins/synthetics/server/routes/telemetry/monitor_upgrade_sender.ts +++ b/x-pack/plugins/synthetics/server/routes/telemetry/monitor_upgrade_sender.ts @@ -22,11 +22,8 @@ import { MONITOR_UPDATE_CHANNEL, MONITOR_CURRENT_CHANNEL, MONITOR_ERROR_EVENTS_CHANNEL, - MONITOR_SYNC_STATE_CHANNEL, - MONITOR_SYNC_EVENTS_CHANNEL, } from '../../legacy_uptime/lib/telemetry/constants'; import { MonitorErrorEvent } from '../../legacy_uptime/lib/telemetry/types'; -import { MonitorSyncEvent } from '../../legacy_uptime/lib/telemetry/types'; export interface UpgradeError { key?: string; @@ -50,23 +47,6 @@ export function sendTelemetryEvents( } } -export function sendSyncTelemetryEvents( - logger: Logger, - eventsTelemetry: TelemetryEventsSender | undefined, - updateEvent: MonitorSyncEvent -) { - if (eventsTelemetry === undefined) { - return; - } - - try { - eventsTelemetry.queueTelemetryEvents(MONITOR_SYNC_STATE_CHANNEL, [updateEvent]); - eventsTelemetry.queueTelemetryEvents(MONITOR_SYNC_EVENTS_CHANNEL, [updateEvent]); - } catch (exc) { - logger.error(`queuing telemetry events failed ${exc}`); - } -} - export function sendErrorTelemetryEvents( logger: Logger, eventsTelemetry: TelemetryEventsSender | undefined, @@ -180,8 +160,6 @@ export function formatTelemetryDeleteEvent( }); } -export function formatTelemetrySyncEvent() {} - function getScriptType( attributes: Partial, isInlineScript: boolean diff --git a/x-pack/plugins/synthetics/server/synthetics_service/synthetics_service.ts b/x-pack/plugins/synthetics/server/synthetics_service/synthetics_service.ts index d0211800dc6c0..c0f977758f6da 100644 --- a/x-pack/plugins/synthetics/server/synthetics_service/synthetics_service.ts +++ b/x-pack/plugins/synthetics/server/synthetics_service/synthetics_service.ts @@ -16,8 +16,6 @@ import { TaskInstance, } from '@kbn/task-manager-plugin/server'; import { sendErrorTelemetryEvents } from '../routes/telemetry/monitor_upgrade_sender'; -import { MonitorSyncEvent } from '../legacy_uptime/lib/telemetry/types'; -import { sendSyncTelemetryEvents } from '../routes/telemetry/monitor_upgrade_sender'; import { UptimeServerSetup } from '../legacy_uptime/lib/adapters'; import { installSyntheticsIndexTemplates } from '../routes/synthetics_service/install_index_templates'; import { SyntheticsServiceApiKey } from '../../common/runtime_types/synthetics_service_api_key'; @@ -317,11 +315,6 @@ export class SyntheticsService { return null; } - if (!configs && monitorConfigs.length > 0) { - const telemetry = this.getSyncTelemetry(monitorConfigs); - sendSyncTelemetryEvents(this.logger, this.server.telemetry, telemetry); - } - this.apiKey = await this.getApiKey(); if (!this.apiKey) { @@ -490,70 +483,6 @@ export class SyntheticsService { formatMonitorConfig(Object.keys(config) as ConfigKey[], config as Partial) ); } - - getSyncTelemetry(monitors: SyntheticsMonitorWithId[]): MonitorSyncEvent { - let totalRuns = 0; - let browserTestRuns = 0; - let httpTestRuns = 0; - let icmpTestRuns = 0; - let tcpTestRuns = 0; - - const locationRuns: Record = {}; - const locationMonitors: Record = {}; - - const testRunsInDay = (schedule: string) => { - return (24 * 60) / Number(schedule); - }; - - const monitorsByType: Record = { - browser: 0, - http: 0, - tcp: 0, - icmp: 0, - }; - - monitors.forEach((monitor) => { - if (monitor.schedule.number) { - totalRuns += testRunsInDay(monitor.schedule.number); - } - switch (monitor.type) { - case 'browser': - browserTestRuns += testRunsInDay(monitor.schedule.number); - break; - case 'http': - httpTestRuns += testRunsInDay(monitor.schedule.number); - break; - case 'icmp': - icmpTestRuns += testRunsInDay(monitor.schedule.number); - break; - case 'tcp': - tcpTestRuns += testRunsInDay(monitor.schedule.number); - break; - default: - break; - } - - monitorsByType[monitor.type] = (monitorsByType[monitor.type] ?? 0) + 1; - - monitor.locations.forEach(({ id }) => { - locationRuns[id + 'Tests'] = - (locationRuns[id + 'Tests'] ?? 0) + testRunsInDay(monitor.schedule.number); - locationMonitors[id + 'Monitors'] = (locationMonitors[id + 'Monitors'] ?? 0) + 1; - }); - }); - - return { - total: monitors.length, - totalTests: totalRuns, - browserTests24h: browserTestRuns, - httpTests24h: httpTestRuns, - icmpTests24h: icmpTestRuns, - tcpTests24h: tcpTestRuns, - ...locationRuns, - ...locationMonitors, - ...monitorsByType, - }; - } } class IndexTemplateInstallationError extends Error {