-
Notifications
You must be signed in to change notification settings - Fork 304
fix otlp metric export when using http protocol #7595
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
Conversation
We use the rust opentelemetry crate to export metrics and traces. In 1.x we use v 0.13 of that crate. In 2.x we use v 0.17 of that crate. It seems as though in the earlier version, exporting otlp metrics over http would work without the correct path (/v1/metrics). This does not work in v0.17. This means that exporting metrics over http has never worked in router 2.x I've added code to explicitly force the path to be correct (as we already do for traces).
I just went through the test configuration and converted localhost/metrics to localhost/v1/metrics wherever I saw it. All the tests are passing.
This comment has been minimized.
This comment has been minimized.
✅ Docs preview readyThe preview is ready to be viewed. View the preview File Changes 0 new, 19 changed, 0 removed
Build ID: 1346ae499f293fd97dc8e99a URL: https://www.apollographql.com/docs/deploy-preview/1346ae499f293fd97dc8e99a |
I'm not sure if updating the configuration is correct or if the code still needs more tweaking. This is a good first step to help me figure that out.
We need to do some work to process endpoints to accomodate decisions we made in the past. Let's see what this looks like.
So that existing tests don't need to change. I think this is simpler than before and it now works for gRPC/HTTP and metrics/traces, which it didn't do before.
Forget about checking query of url (you can't have an endpoint that contains a query...), but check the various realistic transforms that we might make.
Otherwise we get "empty string" errors...
Add the commit hash for the test changes.
We can't parse our endpoint as a URI unless we have a scheme. If none is specified, prepend "http://". Extend our test to include this very common configuration use case.
@garypen Can we do a quick manual test against honeycomb and new relic? |
We'd like the standard OTLP environment variables for endpoint to work (I think), or at least our customers would, so let's try to help them out.
After more research into how New Relix processes OTLP traffic, which verified they do expect `/v1/metrics` and `/v1/traces` when using the `http` protocol, add a test.
dd5fde5
to
b37a6b3
Compare
✅ Docs preview has no changesThe preview was not built because there were no changes. Build ID: 3bbf65816a42074898251b72 |
🛠️ Docs preview building...The preview is currently being built. Build ID: 604162c29c8252e9523f3cd4 |
1 similar comment
🛠️ Docs preview building...The preview is currently being built. Build ID: 604162c29c8252e9523f3cd4 |
When I merged #7595, I squashed it and so my .gitleaks.toml updates were no longer correct. This fixes things.
When I merged #7595, I squashed it and so my .gitleaks.toml updates were no longer correct. This fixes things.
Ensure that the path handling for an OTLP over HTTP metrics endpoint is correct.
In 1.x we didn't need to perform additional processing. I think, although it's difficult to confirm, that this was auto-magically handled by the
opentelemetry-otlp
crate we use which is at version 0.13. I note that we were explicitly modifying endpoints fortraces
, so not sure why we had to do it fortraces
, but notmetrics
.In 2.x we updated our version of the
opentelemetry-otlp
crate to 0.17 and it looks as though the "magic" no longer happens.In addition to these problems it looks like we had a number of issues using the
opentelemetry_otlp
crate which:opentelemetry_otlp
crateI've tried to fix as many issues as I can in a broadly compatible way.
Note: I've only fixed the OTEL ENDPOINT environment variables. Others continue to work/not work as they do currently.
Checklist
Complete the checklist (and note appropriate exceptions) before the PR is marked ready-for-review.
Exceptions
I've added a new manual test to more rigorously test the various endpoint manipulations that we make.
I manually tested the PR against the major APM providers to ensure that it was still possible to submit O11Y data to them.
Notes
Footnotes
It may be appropriate to bring upcoming changes to the attention of other (impacted) groups. Please endeavour to do this before seeking PR approval. The mechanism for doing this will vary considerably, so use your judgement as to how and when to do this. ↩
Configuration is an important part of many changes. Where applicable please try to document configuration examples. ↩
A lot of (if not most) features benefit from built-in observability and
debug
-level logs. Please read this guidance on metrics best-practices. ↩Tick whichever testing boxes are applicable. If you are adding Manual Tests, please document the manual testing (extensively) in the Exceptions. ↩