-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Do not shade opentelemetry-extension-incubator #20074
Conversation
…rinodb#19958) Otherwise, OTEL's HttpMetricsAdvice class checks doesn't work and this result in many harmful labels to be exposed in OkHttp metrics like the http_response_content_length and http_url. Fixes: trinodb#19958
Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to cla@trino.io. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla |
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.
We include OTEL in JDBC to support propagating traces to the server. Registering client metrics is a side effect. I wonder if we should disable that.
I found this repo: https://github.com/open-telemetry/opentelemetry-java/tree/main/extensions/incubator and there are examples that this can be used with tracing too, so I think this is the right change.
If there's a way to keep traces and disable metrics, this could be interesting in the context of Trino but I'm not sure it's possible and also in a auto-instrumentation context I guess people would expect to have the OkHttp metrics. FYI I've sent the files for the CLA, not sure how long it will take to get approved. I believe this PR still makes sense. |
I'm not sure this change is correct. We have a compile time dependency on In At a minimum, we would need integration tests to verify that the JDBC driver still works correctly when the OpenTelemetry API is on the classpath but the extension JAR is not. |
I also don't understand the actual problem here. We're shading both Ideally, we'd like to have both trace propagation and HTTP client traces when the OpenTelemetry API is on the classpath. We've never considered OpenTelemetry metrics as we don't use these in Trino, so the fact that these are collected is accidental. Someone such as yourself who is more familiar with how metrics should work will need to help to make sure they are working appropriately. For now, it's probably best to disable them, since it sounds like they are more harmful than helpful. The nature of JDBC drivers introduces constraints that necessitates the shading and complex dependency handling:
If we can't easily disable metrics collection, we might be forced to remove the OkHttp instrumentation and instead do manual trace propagation (and HTTP client trace collection if that is useful). |
Thanks for the feedbacks @electrum
I'll check that.
I believe the manual integration tests I did are proving this works.
I can run the reproduction case and provide debugging details for this.
I can give it more time to see if we could entirely disable metrics for the OkHttp calls made by Trino. |
If you're not willing to accept this current PR (I don't have enough knowledge or expertise on the requirements for a JDBC driver, I'd need help from someone else to check further if the change doesn't bring unexpected issues), I don't see any easy way out of the situation excepted to remove OpenTelemetry instrumentation in favor of a "home made" manual trace propagation if that's the initial reason for the integration of OpenTelemetry. |
This pull request has gone a while without any activity. Tagging the Trino developer relations team: @bitsondatadev @colebow @mosabua |
yes, it is
yes, it can
You can view the classes in https://github.com/open-telemetry/opentelemetry-java/tree/main/extensions/incubator/src/main/java/io/opentelemetry/extension/incubator/metrics as incubating api. Eventually this functionality will be moved to
Currently metrics collection can not be disabled for the okhttp client instrumentation library. Http client metrics are part of the opentelemetry specification https://opentelemetry.io/docs/specs/semconv/http/http-metrics/#http-client. |
@electrum I'd really like this PR (or at least a fix to the initial problem) be solved. What more would be missing to move forward? Should I provide an integration test that can be automated? If so, are there already some in the project? |
This pull request has gone a while without any activity. Tagging the Trino developer relations team: @bitsondatadev @colebow @mosabua |
Closing this pull request, as it has been stale for six weeks. Feel free to re-open at any time. |
This pull request has gone a while without any activity. Tagging the Trino developer relations team: @bitsondatadev @colebow @mosabua |
Closing this pull request, as it has been stale for six weeks. Feel free to re-open at any time. |
For the record, OpenTelemetry now workaround the initial issue by detecting unexpected class hierarchy (see open-telemetry/opentelemetry-java-instrumentation#10671). |
A non-shaded JDBC driver would be nice indeed. It'll let "advanced" users manage the version conflicts themselves, likely using OTEL BOM. This would be a "regular" non-fat JAR right? Only to be used with a proper dependency management tool like Maven. If it's a fat JAR including all the dependencies with their original packages, this may solve this issue but I think it would bring even more issues/conflicts and harder or even impossible to fix by users. |
@gaeljw Regular jar to be used with a build tool like maven, gradle or sbt |
Closing as OpenTelemetry will not be shaded anymore with #23458 |
Thanks @gaeljw |
Description
Solves #19958
Otherwise, OTEL's HttpMetricsAdvice class checks don't work, resulting in many harmful labels being exposed in OkHttp metrics like the
http_response_content_length
andhttp_url
.I've tested the change against the reproduction repository at https://github.com/gaeljw/otel9972 and it does fix the issue.
Behavior before:
http_client_duration_milliseconds_bucket{otel_scope_name="io.opentelemetry.okhttp-3.0",http_method="GET",http_response_content_length="313",http_status_code="200",http_url="http://localhost:32769/v1/statement/queued/20231210_161430_00046_fhxz7/y1e8d019656c9d40982bc8bc8acd01931a65d7162/1",net_peer_name="localhost",net_peer_port="32769",net_protocol_name="http",net_protocol_version="1.1",user_agent_original="Trino JDBC Driver/434",le="0.0"} 0.0 1702224879638
Behavior with this change:
http_client_duration_milliseconds_bucket{otel_scope_name="io.opentelemetry.okhttp-3.0",http_method="GET",http_status_code="200",net_peer_name="localhost",net_peer_port="32771",net_protocol_name="http",net_protocol_version="1.1",le="0.0"} 0.0 1702225905514
http_response_content_length
,http_url
anduser_agent_original
labelsAdditional context and related issues
Release notes
( ) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
(x) Release notes are required, with the following suggested text: