-
-
Notifications
You must be signed in to change notification settings - Fork 1k
feat: custom span processors in telementry options #3042
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
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 |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| import { | ||
| Context, | ||
| DiagConsoleLogger, | ||
| DiagLogLevel, | ||
| TraceFlags, | ||
|
|
@@ -66,6 +67,7 @@ export type TracingSDKConfig = { | |
| url: string; | ||
| forceFlushTimeoutMillis?: number; | ||
| instrumentations?: Instrumentation[]; | ||
| spanProcessors?: SpanProcessor[]; | ||
| exporters?: SpanExporter[]; | ||
| logExporters?: LogRecordExporter[]; | ||
| diagLogLevel?: TracingDiagnosticLogLevel; | ||
|
|
@@ -120,6 +122,11 @@ export class TracingSDK { | |
|
|
||
| const spanProcessors: Array<SpanProcessor> = []; | ||
|
|
||
| //add span processor passed via config before adding exporters | ||
| for (const spanProcessor of config.spanProcessors ?? []) { | ||
| spanProcessors.push(spanProcessor); | ||
| } | ||
|
Comment on lines
+125
to
+128
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. 🚩 Custom span processors' onStart won't see task context attributes Custom span processors are pushed into the array before However, since attributes are mutated on the shared span object, custom processors' Was this helpful? React with 👍 or 👎 to provide feedback. |
||
|
|
||
| spanProcessors.push( | ||
| new TaskContextSpanProcessor( | ||
| VERSION, | ||
|
|
||
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.
🚩 managed-run-worker doesn't check telemetry.instrumentations (pre-existing inconsistency)
In
dev-run-worker.ts:207, instrumentations are resolved withconfig.telemetry?.instrumentations ?? config.instrumentations ?? [], properly supporting both the newtelemetry.instrumentationspath and the deprecated top-levelinstrumentationsfield.However,
managed-run-worker.ts:186only usesconfig.instrumentations ?? [], ignoringconfig.telemetry?.instrumentationsentirely. This means users who configure instrumentations under thetelemetrykey (as the deprecation notice onconfig.ts:86-87suggests) will have them silently ignored in managed/production runs while working fine in dev. This is a pre-existing issue not introduced by this PR, but the PR author may want to fix it alongside this change for consistency.(Refers to line 186)
Was this helpful? React with 👍 or 👎 to provide feedback.