-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Consistent tagging and propagate sendAsync throwable #5553
Consistent tagging and propagate sendAsync throwable #5553
Conversation
When handling the sendAsync call in our instrumentation, we were not propagating the throwable observed to the CompletionFuture returned. This fixes that and adds a test. To keep tagging consistent in the case where response is null or not, this also updates tagging to always include `status` and `outcome`. In case the response is null, they will have value `UNKNOWN` for now. This is a change from before for this case, but the behavior before is problematic for the Prometheus registry that expects a consistent set of tags. The change is adding tags that weren't there before in the case response is null, so it should generally not break users.
assertThatThrownBy(response::join).isInstanceOf(CompletionException.class); | ||
assertThatNoException().isThrownBy(() -> meterRegistry.get("http.client.requests") | ||
.tag("method", "GET") | ||
// TODO fix status/uri in exceptional cases where response may be null |
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.
This is not a TODO we should tackle in this PR. This should probably be fixed on main
instead since it results in a change in behavior. Ideally, we should add more to our HttpClientTimingInstrumentationVerificationTests
to ensure consistent behavior across instrumentations. The issue, if I remember correctly, is that some HTTP clients cannot instrument the case where the response is null.
When handling the sendAsync call in our instrumentation, we were not propagating the throwable observed to the CompletionFuture returned. This fixes that and adds a test. To keep tagging consistent in the case where response is null or not, this also updates tagging to always include
status
andoutcome
. In case the response is null, they will have valueUNKNOWN
for now. This is a change from before for this case, but the behavior before is problematic for the Prometheus registry that expects a consistent set of tags. The change is adding tags that weren't there before in the case response is null, so it should generally not break users.Resolves gh-5136