From 832abf11b62e2bf6c3e3f8b22a67ebacd4761142 Mon Sep 17 00:00:00 2001 From: Jenny Date: Tue, 8 Oct 2024 10:18:28 +0200 Subject: [PATCH] Fix types --- .../kbn-apm-synthtrace/src/cli/scenario.ts | 2 +- .../src/cli/utils/bootstrap.ts | 1 + .../src/cli/utils/start_live_data_upload.ts | 20 ++++++++++++++++--- .../src/cli/utils/synthtrace_worker.ts | 6 +++--- .../src/scenarios/otel_simple_trace.ts | 4 ++-- 5 files changed, 24 insertions(+), 9 deletions(-) diff --git a/packages/kbn-apm-synthtrace/src/cli/scenario.ts b/packages/kbn-apm-synthtrace/src/cli/scenario.ts index 4c7678507a338..4f1550b8bdbc8 100644 --- a/packages/kbn-apm-synthtrace/src/cli/scenario.ts +++ b/packages/kbn-apm-synthtrace/src/cli/scenario.ts @@ -26,7 +26,7 @@ interface EsClients { infraEsClient: InfraSynthtraceEsClient; assetsEsClient: AssetsSynthtraceEsClient; syntheticsEsClient: SyntheticsSynthtraceEsClient; - otelSynthtraceEsClient: OtelSynthtraceEsClient; + otelEsClient: OtelSynthtraceEsClient; } type Generate = (options: { diff --git a/packages/kbn-apm-synthtrace/src/cli/utils/bootstrap.ts b/packages/kbn-apm-synthtrace/src/cli/utils/bootstrap.ts index ebdfaf7c8d62a..22d07f73c56cb 100644 --- a/packages/kbn-apm-synthtrace/src/cli/utils/bootstrap.ts +++ b/packages/kbn-apm-synthtrace/src/cli/utils/bootstrap.ts @@ -91,6 +91,7 @@ export async function bootstrap(runOptions: RunOptions) { infraEsClient, assetsEsClient, syntheticsEsClient, + otelEsClient, version, kibanaUrl, esUrl, diff --git a/packages/kbn-apm-synthtrace/src/cli/utils/start_live_data_upload.ts b/packages/kbn-apm-synthtrace/src/cli/utils/start_live_data_upload.ts index 90fa0189469ad..79c9907dc13d1 100644 --- a/packages/kbn-apm-synthtrace/src/cli/utils/start_live_data_upload.ts +++ b/packages/kbn-apm-synthtrace/src/cli/utils/start_live_data_upload.ts @@ -26,8 +26,15 @@ export async function startLiveDataUpload({ }) { const file = runOptions.file; - const { logger, apmEsClient, logsEsClient, infraEsClient, assetsEsClient, syntheticsEsClient } = - await bootstrap(runOptions); + const { + logger, + apmEsClient, + logsEsClient, + infraEsClient, + assetsEsClient, + syntheticsEsClient, + otelEsClient, + } = await bootstrap(runOptions); const scenario = await getScenario({ file, logger }); const { generate } = await scenario({ ...runOptions, logger }); @@ -65,7 +72,14 @@ export async function startLiveDataUpload({ const generatorsAndClients = generate({ range: timerange(bucketFrom.getTime(), bucketTo.getTime()), - clients: { logsEsClient, apmEsClient, infraEsClient, assetsEsClient, syntheticsEsClient }, + clients: { + logsEsClient, + apmEsClient, + infraEsClient, + assetsEsClient, + syntheticsEsClient, + otelEsClient, + }, }); const generatorsAndClientsArray = castArray(generatorsAndClients); diff --git a/packages/kbn-apm-synthtrace/src/cli/utils/synthtrace_worker.ts b/packages/kbn-apm-synthtrace/src/cli/utils/synthtrace_worker.ts index 5e9301027a27e..78c89d110c892 100644 --- a/packages/kbn-apm-synthtrace/src/cli/utils/synthtrace_worker.ts +++ b/packages/kbn-apm-synthtrace/src/cli/utils/synthtrace_worker.ts @@ -66,7 +66,7 @@ async function start() { logger, }); - const otelSynthtraceEsClient = getOtelSynthtraceEsClient({ + const otelEsClient = getOtelSynthtraceEsClient({ concurrency: runOptions.concurrency, target: esUrl, logger, @@ -87,7 +87,7 @@ async function start() { infraEsClient, assetsEsClient, syntheticsEsClient, - otelSynthtraceEsClient, + otelEsClient, }); } @@ -102,7 +102,7 @@ async function start() { infraEsClient, assetsEsClient, syntheticsEsClient, - otelSynthtraceEsClient, + otelEsClient, }, }) ); diff --git a/packages/kbn-apm-synthtrace/src/scenarios/otel_simple_trace.ts b/packages/kbn-apm-synthtrace/src/scenarios/otel_simple_trace.ts index ab1755d2e7b78..51fe8a5a72384 100644 --- a/packages/kbn-apm-synthtrace/src/scenarios/otel_simple_trace.ts +++ b/packages/kbn-apm-synthtrace/src/scenarios/otel_simple_trace.ts @@ -14,7 +14,7 @@ import { withClient } from '../lib/utils/with_client'; const scenario: Scenario = async (runOptions) => { return { - generate: ({ range, clients: { otelSynthtraceEsClient } }) => { + generate: ({ range, clients: { otelEsClient } }) => { const { numOtelTraces = 5 } = runOptions.scenarioOpts || {}; const { logger } = runOptions; const traceId = generateShortId(); @@ -37,7 +37,7 @@ const scenario: Scenario = async (runOptions) => { return [ withClient( - otelSynthtraceEsClient, + otelEsClient, logger.perf('generating_otel_otelTrace', () => otelWithMetricsAndErrors) ), ];