-
Notifications
You must be signed in to change notification settings - Fork 510
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
fix(publish-metrics): route debug correctly for publish metrics reporters #2514
fix(publish-metrics): route debug correctly for publish metrics reporters #2514
Conversation
@@ -64,11 +64,14 @@ const vendorTranslators = { | |||
return otelTemplate(config, dynatraceTraceSettings); | |||
}, | |||
'open-telemetry': (config) => { | |||
let tracesConfig = config; | |||
let newConfig = config; |
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.
Adding the type
to metrics
block here to make the reporter name available for the metric pipeline.
Note: Changing name to newConfig
as makes more sense, especially now when adding the metrics
check as well.
@@ -24,7 +23,7 @@ context.setGlobalContextManager(contextManager); | |||
// DEBUGGING SETUP - setting the OpenTelemetry's internal diagnostic handler here to run when debug is enabled | |||
if ( | |||
process.env.DEBUG && | |||
process.env.DEBUG === 'plugin:publish-metrics:open-telemetry' | |||
process.env.DEBUG.includes('plugin:publish-metrics:') |
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.
Setting OTels internal logger to run when DEBUG
is set for any reporter, not just open-telemetry
} | ||
} | ||
|
||
class OTelTraceBase { | ||
constructor(config, script) { | ||
this.config = config; | ||
this.script = script; | ||
this.debug = require('debug')(`plugin:publish-metrics:${this.config.type}`); |
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.
Setting this.debug
here with reporter type will make it available to both HTTP and Playwright trace reporters.
@@ -45,6 +44,7 @@ class OTelMetricsReporter { | |||
} | |||
|
|||
configure(config) { | |||
this.debug = require('debug')(`plugin:publish-metrics:${this.config.type}`); |
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.
Currently OTel reporter metrics
doesn't support any vendor-specific reporters, but for future proofing we require dynamically.
Description
When
DEBUG
is set to a vendor-specific reporter (frompublish-metrics
) if that reporter is using OTel in the background we want to log OTel reporters debug logs as well.e.g. When user uses the Datadog reporter for tracing and sets
DEBUG=plugin:publish-metrics:datadog
, we want to log debug logs from OTel reporter as well as OTel is the one running the tracing.Implementation
DEBUG
is set to any reporter, not justopen-telemetry
debug
will be dynamically set for metrics and traces, using thetype
property from config set to the reporters name.In config translator functions
type
is set on bothtraces
andmetrics
part of config so that classes responsible for metrics and traces can set the debug accordingly.Testing
Tested manually, running multiple reporters and types of errors to trigger all debug logs and make sure the output is correct.
Pre-merge checklist