-
Notifications
You must be signed in to change notification settings - Fork 867
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
Update HTTP metrics 'view' code to match the specification #4556
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.
The algorithm as it stands pays a runtime cost building the
Set
for the view every time it runs. Looking for ideas on how to optimise.
We could create separate Sets for each "identity attribute" combination and then pass two Set<AttributeKey>
params to applyView
, e.g.
applyView(filtered, startAttributes, durationAlwaysInclude, identityInclude);
- The semantic conventions strongly encourage using "abstract URL" paths, e.g. routing rules to annotate URL vs. a specific URL. We could do things like "find /[\d]+/" and erase it to "id" automagically, perhaps. But I suspect this cardinality isn't quite so bad as the peer-ip address cardinality is right now.
I'm not sure how to make this work as a default configuration for the Java agent. So many application have very high-cardinality paths (and even more have very high-cardinality query strings).
I would opt for not including http.url
or http.target
by default, but also ok if you want to use this to get feedback from users since metrics is still alpha.
http.route
would be a good alternative. We have lots of instrumentation to capture the low-cardinality route. We use it to populate the http server span name, though we don't (yet) populate the actual http.route
attribute. We'd need to do some additional work to capture http.route
in a way that will get that attribute passed to endAttributes
(instead of simply calling Span.setAttribute
mid-span), but that's something we can probably figure out.
We need something like it to identify the real metric-stream that has latency issues.
This sounds like what
I wonder how much of the issue was actually around |
yes, I think so
Java web routing frameworks make it so easy to encode parameters into paths that it's really common. Since metrics is alpha, we can merge as-is and open an issue to migrate to |
Sounds good. Agreed that
if we consistently have them available in client + server. |
ah, that's a good point, there's very few Java http client libraries that have a "route" concept, so while |
...c/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/TemporaryMetricsView.java
Outdated
Show resolved
Hide resolved
...c/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/TemporaryMetricsView.java
Outdated
Show resolved
Hide resolved
Unfortunately, none of our HTTP client instrumentations set these attributes; they're only set by the server isntrumentations (
I've been thinking of refactoring the |
👍
this is going to be a problem for metrics for any attributes that get set mid-span. I wish we could call span.getAttributes() on end and use that as the baseline for metrics attributes. @jsuereth @jkwatson any ideas? |
No ideas here. Unfortunately, since we can't expose this data on the API's I've also been pondering that some of this could probably be accomplished if there were a way for an API user to register a "Span callback" that got updates to the span also fed to it, but I don't know what that callback interface would have to look like (probably almost exactly like the span interface?) |
Would it make sense to have a span-processor that generates metrics? Really wish we had that level of integration. However, this is all kind of beside the point. What's the next steps on this PR? I think we need to clean up what we have now, as we know it causes issues. I've kind of lost track in this discussion what changes I should try to make. |
I'm not sure what's worse for the immediate
I'm open to either. Let's chat and decide in tomorrow's SIG meeting(s). |
Updated based on Java SiG discussions:
|
...c/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/TemporaryMetricsView.java
Outdated
Show resolved
Hide resolved
...c/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/TemporaryMetricsView.java
Outdated
Show resolved
Hide resolved
...c/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/TemporaryMetricsView.java
Outdated
Show resolved
Hide resolved
...st/java/io/opentelemetry/instrumentation/api/instrumenter/http/TemporaryMetricsViewTest.java
Outdated
Show resolved
Hide resolved
...st/java/io/opentelemetry/instrumentation/api/instrumenter/http/TemporaryMetricsViewTest.java
Outdated
Show resolved
Hide resolved
...c/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/TemporaryMetricsView.java
Outdated
Show resolved
Hide resolved
...c/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/TemporaryMetricsView.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Trask Stalnaker <[email protected]>
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.
thx!
…metry#4556) * Update HTTP metrics 'view' code to match the specification, including optional attribute rules. * Update server metrics test for new logic. * Fix client metrics test. * Spotless fix. * Updates from Java SiG discussion. * Fixes from review. * Apply suggestions from code review Co-authored-by: Trask Stalnaker <[email protected]> * Update spotless from code reivew merge. Co-authored-by: Trask Stalnaker <[email protected]>
Sending this for preliminary review/thoughts. Important callouts:
Set
for the view every time it runs. Looking for ideas on how to optimise.cc @trask
Things not done: