From 087a1c3c1de2ed85bdf3ff7a2faba18d91e55d75 Mon Sep 17 00:00:00 2001 From: Nidhi Work Date: Wed, 28 Feb 2024 18:47:07 +0000 Subject: [PATCH] fix: fixing merge --- .../lib/open-telemetry/index.js | 19 +++++++++++++++++-- .../lib/open-telemetry/tracing/base.js | 2 -- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/packages/artillery-plugin-publish-metrics/lib/open-telemetry/index.js b/packages/artillery-plugin-publish-metrics/lib/open-telemetry/index.js index a7eae992a6..f2ed545b58 100644 --- a/packages/artillery-plugin-publish-metrics/lib/open-telemetry/index.js +++ b/packages/artillery-plugin-publish-metrics/lib/open-telemetry/index.js @@ -1,6 +1,5 @@ 'use strict'; -const debug = require('debug')('plugin:publish-metrics:open-telemetry'); const { vendorTranslators } = require('./translators/vendor-otel'); const { diag, @@ -119,6 +118,22 @@ class OTelReporter { } } } + debug(msg) { + if (this.traceDebug) { + this.traceDebug(msg); + } + if (this.metricDebug) { + this.metricDebug(msg); + } + } + warnIfDuplicateTracesConfigured(configList) { + const tracesConfigs = configList.filter((config) => config.traces); + if (tracesConfigs.length > 1) { + console.warn( + 'WARNING: Multiple reporters configured for traces. Currently, you can only use one reporter at a time for reporting traces. Only the first reporter will be used.' + ); + } + } translateToOtel(config) { return vendorTranslators[config.type](config); } @@ -138,7 +153,7 @@ class OTelReporter { } // Waiting for flush period to complete here rather than in trace/metric reporters - debug('Waiting for flush period to end'); + this.debug('Waiting for flush period to end'); await new Promise((resolve) => setTimeout(resolve, 10000)); if (this.metricReporter) { diff --git a/packages/artillery-plugin-publish-metrics/lib/open-telemetry/tracing/base.js b/packages/artillery-plugin-publish-metrics/lib/open-telemetry/tracing/base.js index 5b4e83a1ce..a61cc781ac 100644 --- a/packages/artillery-plugin-publish-metrics/lib/open-telemetry/tracing/base.js +++ b/packages/artillery-plugin-publish-metrics/lib/open-telemetry/tracing/base.js @@ -178,8 +178,6 @@ class OTelTraceBase { } this.debug('Pending traces done'); - this.debug('Waiting for flush period to complete'); - await sleep(5000); } }