-
Notifications
You must be signed in to change notification settings - Fork 41.1k
Add auto-configuration for OTLP gRPC format when using tracing #41213
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
Add auto-configuration for OTLP gRPC format when using tracing #41213
Conversation
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.
Thanks for the PR. I've left a comment.
Just an idea I had, but I'm not sure if this is common: we could use the URL to determine the kind of transport to use. http://
or https://
would use OtlpHttpSpanExporter
, grpc://
or grpcs://
(?) would use OtlpGrpcSpanExporter
.
What do you think?
...rc/main/java/org/springframework/boot/actuate/autoconfigure/tracing/otlp/OtlpProperties.java
Outdated
Show resolved
Hide resolved
I was actually considering something along the same line. I thought about using the port number to deduct the transport to use: I haven't seen people use |
Indeed, |
If that's not a thing, i think we shouldn't invent it and go with the |
.../java/org/springframework/boot/actuate/autoconfigure/tracing/otlp/OtlpAutoConfiguration.java
Outdated
Show resolved
Hide resolved
A bit aside of these changes: why do you want to use gRPC? There are three transports in the OTLP specs (http/protobuf, http/json, grpc). It is also specified that every collector/backend must support all three transports so that clients (Spring Boot apps) don't need to (it does not matter what transport your client is using from the collector's perspective). Also, last time I had discussions about this with OTel folks, gRPC did not seem to be faster or more efficient than http/protobuf, gRPC is using HTTP2 under the hood and both support the same (compressed) protobuf format. There is one difference though: people run into issues with gRPC if they have another gRPC client in their apps. More connected to this PR: I think integration tests are missing (see: |
gRPC is already enabled for the ingestion of traces coming from the OpenTelemetry integration in ingress-nginx.
I'll look into the possibilities here. |
Regarding the URL scheme: grpc itself uses this scheme. I haven't tested what |
Okay, nevermind, Otel calls |
I fiddled around a bit but I'm not yet convinced I'm on the right track for an integration tests for the The following code:
Allows me to capture gRPC requests, at the cost of running an additional Server and an additional dependency: |
I think the transport property might be the safer bet but having multiple things in the scheme/protocol is valid, see JDBC urls:
Similarly, the url in the Spring property can be something like:
I don't know/think that the OTel client will work with it so it would be on Boot to remove the
I think running a server is the point of having integration tests, I consider it as a feature in this case. On the other hand, since gRPC is "just" HTTP2, |
I added a new commit with a first attempt for an integration test. Looking forward to some feedback. Initially I tried to use the existing
Using I'm fairly sure we can't leave a dependency like this (including the version) in the |
Versions are defined in |
If it's a dependency that's only used in tests, it should go in |
We talked about this yesterday and we don't fiddle with the url scheme. We use |
Thank you very much and congratulations on your first contribution 🎉! |
Big thanks to all of you for the excellent guidance. |
Unfortunately, we've decided to revert this, hopefully temporarily. Looking at #41324 and #41333 we're not 100% sure that things are heading in the right direction. With this change in place, we're in an inconsistent situation where you can use gRPC to export traces but not logs or metrics. We could add support for exporting logs using gRPC but support for metrics would require a change in Micrometer to its If we decide to proceed with gRPC support, we'd like to give ourselves a bit of breathing room to review things for consistency. For example, it would probably make sense to move the |
This pull request introduces opt-in auto-configuration for
OtlpGrpcSpanExporter
(fixes #35863).The implementation remains backwards compatible and still configures the existing OtlpHttpSpanExporter by default.
Using a new configuration property, it is possible to change the transport:
management.otlp.tracing.transport
.