-
Notifications
You must be signed in to change notification settings - Fork 821
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
feat(sdk-trace-base)!: remove addSpanProcessor
API
#5134
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## next #5134 +/- ##
==========================================
- Coverage 93.24% 93.18% -0.06%
==========================================
Files 318 317 -1
Lines 8231 8205 -26
Branches 1651 1650 -1
==========================================
- Hits 7675 7646 -29
- Misses 556 559 +3
|
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.
Looks good already, thanks for working on this 🙌
One question: do you think it would be a lot of work to backport this as a feature to the main
branch? 🤔 We did a similar change recently with MeterProvider#addMetricReader()
- see #4427, #4419
Doing so could
- be helpful for users to start to transition to the "new" way of doing things
- be helpful for us to merge changes from
main
tonext
while we still have to do it
experimental/packages/opentelemetry-sdk-node/src/TracerProviderWithEnvExporter.ts
Show resolved
Hide resolved
// TODO: the former class `TracerProviderWithEnvExporters` was doing registration only if | ||
// spanProcessors were configured. Should we have this logic here? | ||
// if we register anyway the context manager changes and break some tests |
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.
I think we should not register if there's no SpanProcessor
- having it there and working through spans instead of it being a no-op introduces additional overhead for the user - so your current implementation is fine.
What we should consider, though is registering a ContextManager
and Propagator
(not in this PR, but later) if no SpanProcessor
is registered but either a logs SDK or metrics SDK is. Having a ContextManager
and Propagator
can be useful in these cases (having a TraceID
for logs when there's an active trace from another service but no trace SDK in this service can be very helpful and is something that users have asked for previously)
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.
Okay, I'll create an issue for that
import { JaegerExporter } from '@opentelemetry/exporter-jaeger'; | ||
import { TracerProviderWithEnvExporters } from '../src/TracerProviderWithEnvExporter'; | ||
|
||
describe('set up trace exporter with env exporters', () => { |
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.
would it be possible to re-purpose some of the tests from this file?
I see that the new utils have some lines that are not covered by tests. 🤔
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.
I'll do another review and put the selected tests into the sdk tests
I guess what you want would be to have the deprecation of the API plus the constructor option. It's not too much work and also I think you 1st point is a very good one :) |
Exactly. Ideally we'd also have the changes to the test files across the packages and Another benefit of moving the other changes over is that SDK 2.0 will be less of a big bang release and if there are any problems we can get aware them earlier. |
@pichlermarc I've created #5138 targeting main. I think it's better to:
Thanks for your time :) |
Let's do that - thanks for taking the time to backport the feature-part of this to 1.x 🙂 |
Will open a new PR once |
Which problem is this PR solving?
After making the
activeSpanProcessor
private there was a discussion in #4792 about also droppingaddSpanProcessor
from theBasicTraceProvider
class. Allowing users to add more processors at runtime is (IMHO):Ref #4792
Short description of the changes
addSpanProcessor
method fromBasicTraceProvider
TracerConfig
option to add Span processors in the constructorNodeTracerProvider
class from@opentelemetry/sdk-node
TracerProviderWithEnvExporters
class from@opentelemetry/sdk-node
Type of change
How Has This Been Tested?
npm run compile
at root levelnpm run test
at root levelNOTE; The tests for the node SDK already covered the scenarios where exporters have been configured through environment vars. So there is no need to add extra tests from the removed
TracerProviderWithEnvExporters
classChecklist: