Skip to content

Commit

Permalink
update tag names
Browse files Browse the repository at this point in the history
  • Loading branch information
khanayan123 committed Jun 24, 2024
1 parent eee08f2 commit 2d6993f
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 26 deletions.
46 changes: 23 additions & 23 deletions integration-tests/opentelemetry.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ describe('opentelemetry', () => {
assert.strictEqual(payload.request_type, 'generate-metrics')

const metrics = payload.payload

assert.strictEqual(metrics.namespace, 'tracers')

const otelHiding = metrics.series.filter(({ metric }) => metric === 'otel.env.hiding')
Expand Down Expand Up @@ -148,43 +147,44 @@ describe('opentelemetry', () => {
assert.strictEqual(otelInvalid.length, 0)

assert.deepStrictEqual(otelHiding[0].tags, [
'DD_TRACE_LOG_LEVEL', 'OTEL_LOG_LEVEL',
'config.datadog:DD_TRACE_LOG_LEVEL', 'config.opentelemetry:OTEL_LOG_LEVEL',
`version:${process.version}`
])
assert.deepStrictEqual(otelHiding[1].tags, [
'DD_TRACE_PROPAGATION_STYLE', 'OTEL_PROPAGATORS',
'config.datadog:DD_TRACE_PROPAGATION_STYLE', 'config.opentelemetry:OTEL_PROPAGATORS',
`version:${process.version}`
])
assert.deepStrictEqual(otelHiding[2].tags, [
'DD_SERVICE', 'OTEL_SERVICE_NAME',
'config.datadog:DD_SERVICE', 'config.opentelemetry:OTEL_SERVICE_NAME',
`version:${process.version}`
])

assert.deepStrictEqual(otelHiding[3].tags, [
'DD_TRACE_SAMPLE_RATE', 'OTEL_TRACES_SAMPLER', `version:${process.version}`
'config.datadog:DD_TRACE_SAMPLE_RATE', 'config.opentelemetry:OTEL_TRACES_SAMPLER', `version:${process.version}`
])

assert.deepStrictEqual(otelHiding[4].tags, [
'DD_TRACE_SAMPLE_RATE', 'OTEL_TRACES_SAMPLER_ARG', `version:${process.version}`
'config.datadog:DD_TRACE_SAMPLE_RATE', 'config.opentelemetry:OTEL_TRACES_SAMPLER_ARG',
`version:${process.version}`
])

assert.deepStrictEqual(otelHiding[5].tags, [
'DD_TRACE_ENABLED', 'OTEL_TRACES_EXPORTER',
'config.datadog:DD_TRACE_ENABLED', 'config.opentelemetry:OTEL_TRACES_EXPORTER',
`version:${process.version}`
])

assert.deepStrictEqual(otelHiding[6].tags, [
'DD_RUNTIME_METRICS_ENABLED', 'OTEL_METRICS_EXPORTER',
'config.datadog:DD_RUNTIME_METRICS_ENABLED', 'config.opentelemetry:OTEL_METRICS_EXPORTER',
`version:${process.version}`
])

assert.deepStrictEqual(otelHiding[7].tags, [
'DD_TAGS', 'OTEL_RESOURCE_ATTRIBUTES',
'config.datadog:DD_TAGS', 'config.opentelemetry:OTEL_RESOURCE_ATTRIBUTES',
`version:${process.version}`
])

assert.deepStrictEqual(otelHiding[8].tags, [
'DD_TRACE_OTEL_ENABLED', 'OTEL_SDK_DISABLED',
'config.datadog:DD_TRACE_OTEL_ENABLED', 'config.opentelemetry:OTEL_SDK_DISABLED',
`version:${process.version}`
])

Expand Down Expand Up @@ -229,50 +229,50 @@ describe('opentelemetry', () => {
assert.strictEqual(otelInvalid.length, 8)

assert.deepStrictEqual(otelHiding[0].tags, [
'DD_TRACE_OTEL_ENABLED', 'OTEL_SDK_DISABLED',
'config.datadog:DD_TRACE_OTEL_ENABLED', 'config.opentelemetry:OTEL_SDK_DISABLED',
`version:${process.version}`
])

assert.deepStrictEqual(otelInvalid[0].tags, [
'DD_TRACE_LOG_LEVEL', 'OTEL_LOG_LEVEL',
'config.datadog:DD_TRACE_LOG_LEVEL', 'config.opentelemetry:OTEL_LOG_LEVEL',
`version:${process.version}`
])

assert.deepStrictEqual(otelInvalid[1].tags, [
'DD_TRACE_SAMPLE_RATE',
'OTEL_TRACES_SAMPLER',
'config.datadog:DD_TRACE_SAMPLE_RATE',
'config.opentelemetry:OTEL_TRACES_SAMPLER',
`version:${process.version}`
])

assert.deepStrictEqual(otelInvalid[2].tags, [
'DD_TRACE_SAMPLE_RATE',
'OTEL_TRACES_SAMPLER_ARG',
'config.datadog:DD_TRACE_SAMPLE_RATE',
'config.opentelemetry:OTEL_TRACES_SAMPLER_ARG',
`version:${process.version}`
])
assert.deepStrictEqual(otelInvalid[3].tags, [
'DD_TRACE_ENABLED', 'OTEL_TRACES_EXPORTER',
'config.datadog:DD_TRACE_ENABLED', 'config.opentelemetry:OTEL_TRACES_EXPORTER',
`version:${process.version}`
])

assert.deepStrictEqual(otelInvalid[4].tags, [
'DD_RUNTIME_METRICS_ENABLED',
'OTEL_METRICS_EXPORTER',
'config.datadog:DD_RUNTIME_METRICS_ENABLED',
'config.opentelemetry:OTEL_METRICS_EXPORTER',
`version:${process.version}`
])

assert.deepStrictEqual(otelInvalid[5].tags, [
'DD_TRACE_OTEL_ENABLED', 'OTEL_SDK_DISABLED',
'config.datadog:DD_TRACE_OTEL_ENABLED', 'config.opentelemetry:OTEL_SDK_DISABLED',
`version:${process.version}`
])

assert.deepStrictEqual(otelInvalid[6].tags, [
'OTEL_LOGS_EXPORTER',
'config.opentelemetry:OTEL_LOGS_EXPORTER',
`version:${process.version}`
])

assert.deepStrictEqual(otelInvalid[7].tags, [
'DD_TRACE_PROPAGATION_STYLE',
'OTEL_PROPAGATORS',
'config.datadog:DD_TRACE_PROPAGATION_STYLE',
'config.opentelemetry:OTEL_PROPAGATORS',
`version:${process.version}`
])

Expand Down
13 changes: 10 additions & 3 deletions packages/dd-trace/src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,16 @@ const telemetryCounters = {
function getCounter (event, ddVar, otelVar) {
const counters = telemetryCounters[event]
const tags = []

if (ddVar) tags.push(ddVar)
if (otelVar) tags.push(otelVar)
const ddVarPrefix = 'config.datadog:'
const otelVarPrefix = 'config.opentelemetry:'
if (ddVar) {
ddVar = ddVarPrefix + ddVar
tags.push(ddVar)
}
if (otelVar) {
otelVar = otelVarPrefix + otelVar
tags.push(otelVar)
}

if (!(otelVar in counters)) counters[otelVar] = {}

Expand Down

0 comments on commit 2d6993f

Please sign in to comment.