-
Notifications
You must be signed in to change notification settings - Fork 312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update Otel Invalid Telemetry Calculation #4369
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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') | ||
|
@@ -107,7 +106,7 @@ describe('opentelemetry', () => { | |
}, true) | ||
}) | ||
|
||
it('should capture telemetry if both DD and OTEL env vars are set ', () => { | ||
it('should capture telemetry if both DD and OTEL env vars are set', () => { | ||
proc = fork(join(cwd, 'opentelemetry/basic.js'), { | ||
cwd, | ||
env: { | ||
|
@@ -121,15 +120,15 @@ describe('opentelemetry', () => { | |
OTEL_LOG_LEVEL: 'debug', | ||
DD_TRACE_SAMPLE_RATE: '0.5', | ||
OTEL_TRACES_SAMPLER: 'traceidratio', | ||
OTEL_TRACES_SAMPLER_ARG: '0.1', | ||
OTEL_TRACES_SAMPLER_ARG: '1.0', | ||
DD_TRACE_ENABLED: 'true', | ||
OTEL_TRACES_EXPORTER: 'none', | ||
DD_RUNTIME_METRICS_ENABLED: 'true', | ||
OTEL_METRICS_EXPORTER: 'none', | ||
DD_TAGS: 'foo:bar,baz:qux', | ||
OTEL_RESOURCE_ATTRIBUTES: 'foo=bar1,baz=qux1', | ||
DD_TRACE_PROPAGATION_STYLE: 'datadog', | ||
OTEL_PROPAGATORS: 'datadog,tracecontext', | ||
OTEL_RESOURCE_ATTRIBUTES: 'foo+bar13baz+qux1', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I'm understanding this correctly, we're no longer considering this as "invalid" because we don't have a set of recognized values, so that's why the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes precisely, I think that should also be the expected behavior cross tracers. |
||
DD_TRACE_PROPAGATION_STYLE: 'datadog, tracecontext', | ||
OTEL_PROPAGATORS: 'datadog, tracecontext', | ||
OTEL_LOGS_EXPORTER: 'none', | ||
OTEL_SDK_DISABLED: 'false' | ||
} | ||
|
@@ -144,58 +143,142 @@ describe('opentelemetry', () => { | |
|
||
const otelHiding = metrics.series.filter(({ metric }) => metric === 'otel.env.hiding') | ||
const otelInvalid = metrics.series.filter(({ metric }) => metric === 'otel.env.invalid') | ||
|
||
assert.strictEqual(otelHiding.length, 8) | ||
assert.strictEqual(otelInvalid.length, 1) | ||
assert.strictEqual(otelHiding.length, 9) | ||
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', | ||
'OTEL_TRACES_SAMPLER_ARG', `version:${process.version}` | ||
'config.datadog:DD_TRACE_SAMPLE_RATE', 'config.opentelemetry:OTEL_TRACES_SAMPLER', `version:${process.version}` | ||
]) | ||
|
||
assert.deepStrictEqual(otelHiding[4].tags, [ | ||
'DD_TRACE_ENABLED', 'OTEL_TRACES_EXPORTER', | ||
'config.datadog:DD_TRACE_SAMPLE_RATE', 'config.opentelemetry:OTEL_TRACES_SAMPLER_ARG', | ||
`version:${process.version}` | ||
]) | ||
|
||
assert.deepStrictEqual(otelHiding[5].tags, [ | ||
'DD_RUNTIME_METRICS_ENABLED', 'OTEL_METRICS_EXPORTER', | ||
'config.datadog:DD_TRACE_ENABLED', 'config.opentelemetry:OTEL_TRACES_EXPORTER', | ||
`version:${process.version}` | ||
]) | ||
|
||
assert.deepStrictEqual(otelHiding[6].tags, [ | ||
'DD_TAGS', 'OTEL_RESOURCE_ATTRIBUTES', | ||
'config.datadog:DD_RUNTIME_METRICS_ENABLED', 'config.opentelemetry:OTEL_METRICS_EXPORTER', | ||
`version:${process.version}` | ||
]) | ||
|
||
assert.deepStrictEqual(otelHiding[7].tags, [ | ||
'DD_TRACE_OTEL_ENABLED', 'OTEL_SDK_DISABLED', | ||
'config.datadog:DD_TAGS', 'config.opentelemetry:OTEL_RESOURCE_ATTRIBUTES', | ||
`version:${process.version}` | ||
]) | ||
|
||
assert.deepStrictEqual(otelHiding[8].tags, [ | ||
'config.datadog:DD_TRACE_OTEL_ENABLED', 'config.opentelemetry:OTEL_SDK_DISABLED', | ||
`version:${process.version}` | ||
]) | ||
|
||
for (const metric of otelHiding) { | ||
assert.strictEqual(metric.points[0][1], 1) | ||
} | ||
}, true) | ||
}) | ||
|
||
it('should capture telemetry when OTEL env vars are invalid', () => { | ||
proc = fork(join(cwd, 'opentelemetry/basic.js'), { | ||
cwd, | ||
env: { | ||
DD_TRACE_AGENT_PORT: agent.port, | ||
DD_TRACE_OTEL_ENABLED: 1, | ||
DD_TELEMETRY_HEARTBEAT_INTERVAL: 1, | ||
TIMEOUT: 1500, | ||
OTEL_SERVICE_NAME: 'otel_service', | ||
OTEL_LOG_LEVEL: 'foo', | ||
OTEL_TRACES_SAMPLER: 'foo', | ||
OTEL_TRACES_SAMPLER_ARG: 'foo', | ||
OTEL_TRACES_EXPORTER: 'foo', | ||
OTEL_METRICS_EXPORTER: 'foo', | ||
OTEL_RESOURCE_ATTRIBUTES: 'foo', | ||
OTEL_PROPAGATORS: 'foo', | ||
OTEL_LOGS_EXPORTER: 'foo', | ||
OTEL_SDK_DISABLED: 'foo' | ||
} | ||
}) | ||
|
||
return check(agent, proc, timeout, ({ payload }) => { | ||
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') | ||
const otelInvalid = metrics.series.filter(({ metric }) => metric === 'otel.env.invalid') | ||
|
||
assert.deepStrictEqual(otelInvalid[0].points[0][1], 1) | ||
assert.strictEqual(otelHiding.length, 1) | ||
assert.strictEqual(otelInvalid.length, 8) | ||
|
||
assert.deepStrictEqual(otelHiding[0].tags, [ | ||
'config.datadog:DD_TRACE_OTEL_ENABLED', 'config.opentelemetry:OTEL_SDK_DISABLED', | ||
`version:${process.version}` | ||
]) | ||
|
||
assert.deepStrictEqual(otelInvalid[0].tags, [ | ||
'OTEL_LOGS_EXPORTER', | ||
'config.datadog:DD_TRACE_LOG_LEVEL', 'config.opentelemetry:OTEL_LOG_LEVEL', | ||
`version:${process.version}` | ||
]) | ||
|
||
assert.deepStrictEqual(otelInvalid[1].tags, [ | ||
'config.datadog:DD_TRACE_SAMPLE_RATE', | ||
'config.opentelemetry:OTEL_TRACES_SAMPLER', | ||
`version:${process.version}` | ||
]) | ||
|
||
assert.deepStrictEqual(otelInvalid[2].tags, [ | ||
'config.datadog:DD_TRACE_SAMPLE_RATE', | ||
'config.opentelemetry:OTEL_TRACES_SAMPLER_ARG', | ||
`version:${process.version}` | ||
]) | ||
assert.deepStrictEqual(otelInvalid[3].tags, [ | ||
'config.datadog:DD_TRACE_ENABLED', 'config.opentelemetry:OTEL_TRACES_EXPORTER', | ||
`version:${process.version}` | ||
]) | ||
|
||
assert.deepStrictEqual(otelInvalid[4].tags, [ | ||
'config.datadog:DD_RUNTIME_METRICS_ENABLED', | ||
'config.opentelemetry:OTEL_METRICS_EXPORTER', | ||
`version:${process.version}` | ||
]) | ||
|
||
assert.deepStrictEqual(otelInvalid[5].tags, [ | ||
'config.datadog:DD_TRACE_OTEL_ENABLED', 'config.opentelemetry:OTEL_SDK_DISABLED', | ||
`version:${process.version}` | ||
]) | ||
|
||
assert.deepStrictEqual(otelInvalid[6].tags, [ | ||
'config.opentelemetry:OTEL_LOGS_EXPORTER', | ||
`version:${process.version}` | ||
]) | ||
|
||
assert.deepStrictEqual(otelInvalid[7].tags, [ | ||
'config.datadog:DD_TRACE_PROPAGATION_STYLE', | ||
'config.opentelemetry:OTEL_PROPAGATORS', | ||
`version:${process.version}` | ||
]) | ||
|
||
for (const metric of otelInvalid) { | ||
assert.strictEqual(metric.points[0][1], 1) | ||
} | ||
}, true) | ||
}) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I'm understanding this correctly, we're incrementing the
otelHiding.length
in the test because now we consider theOTEL_TRACES_SAMPLER_ARG
config as another config that's being overlooked by its corresponding Datadog config,DD_TRACE_SAMPLE_RATE
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, since they both map to DD_TRACE_SAMPLE_RATE it makes more sense to increment them as seperate pairs of tags. since a user could have inputted both an invalid OTEL_TRACES_SAMPLER value & and an invalid OTEL_TRACES_SAMPLER_ARG value or either or. This makes it more granular.