From e2addb50575f0ac014cd2b87bd37e86dbccb3553 Mon Sep 17 00:00:00 2001 From: Attila Szegedi Date: Tue, 12 Nov 2024 11:25:37 +0100 Subject: [PATCH] Have one version tag in metrics (#4857) --- packages/dd-trace/src/telemetry/metrics.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/dd-trace/src/telemetry/metrics.js b/packages/dd-trace/src/telemetry/metrics.js index 34740aa7f2d..2c42bc23825 100644 --- a/packages/dd-trace/src/telemetry/metrics.js +++ b/packages/dd-trace/src/telemetry/metrics.js @@ -27,13 +27,18 @@ function hasPoints (metric) { return metric.points.length > 0 } +let versionTag + class Metric { constructor (namespace, metric, common, tags) { this.namespace = namespace.toString() this.metric = common ? metric : `nodejs.${metric}` this.tags = tagArray(tags) if (common) { - this.tags.push(`version:${process.version}`) + if (versionTag === undefined) { + versionTag = `version:${process.version}` + } + this.tags.push(versionTag) } this.common = common