-
Notifications
You must be signed in to change notification settings - Fork 873
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
Provide an SPI that an agent distribution or intiializer can use to c… #561
Conversation
…ustomize the tracer after it's initialized.
You need/want this second SPI because currently some methods are only available on |
A couple of issues are that
With normal otel-java, a user can just call the static methods like |
Again, how this problem can be solved for those users who don't use auto instrumentation? If I want to manually instrument my app, without javaagent, and I want to provide my own |
A user can call this manually in
Or |
So I will provide my own I am probably missing something obvious here, but there is no delay above between creating new |
The delay itself is artificial and just to account for timing races. The key point is just to make sure |
A! Now I get it :) Ok, I don't have any immediate objection to this new SPI, but :) The whole story is incomplete. What you are trying to achieve is a convenient way for a vendor to package his own distribution of instrumentation agent providing pre-configured Otel with potential custom components. This is huge topic. Even parts which are already kinda in place, like configuring exporters, propagators, resources etc, are totally undocumented. But even before documentation, can we at least give some thoughts to high level description: what are vendors options and what they have to do to make such distribution? What can be achieved by providing external jars? What has to go inside agent jar? What interfaces/SPI are there for what tasks? I am somewhat uncomfortable moving forward with this topic without having at least vague understanding of the big picture. I don't see even an issue with a stated goal! :) |
Yes it is. I suggest we merge (EDIT: after
Good point, created #566 |
Thanks! #568 will save my day |
…ustomize the tracer after it's initialized.
Currently, I use the normal OpenTelemetry SPI for configuring an SDK tracer, namely to set the
IdsGenerator
andResource
https://github.com/aws-samples/aws-xray-sdk-with-opentelemetry-sample/blob/both-otel-and-xray/awsagentprovider/src/main/java/com/softwareaws/xray/opentelemetry/exporters/AwsTraceProvider.java#L52
Unfortunately, nothing else can be customized here - in particular, methods like
OpenTelemetry.setPropagators
cannot be called here because the SDK is still being initialized. I have a hack to delay it to after the SDK is initializedhttps://github.com/aws-samples/aws-xray-sdk-with-opentelemetry-sample/blob/both-otel-and-xray/awsagentprovider/src/main/java/com/softwareaws/xray/opentelemetry/exporters/AwsTraceProvider.java#L62
But for agent distributions, it is important to provide a programmatic way of customizing all aspects of the tracer, which we can do by having an SPI that is executed after the SDK has been initialized.
Notes
agent-bootstrap
instead ofagent-tooling
since I need it to be available to compile against (not renamed to classdata)compileOnly
dep on the SDK inagent-bootstrap
. This seems generally harmless but if we want to avoid it, I can remove the parameter from the method, it's only slightly convenient compared to a user callingOpenTelemetrySdk.getTracerProvider()
themselvesI have built locally and replaced my hack with an SPI implementation and verifies it works well.
Fixes? #387