-
Notifications
You must be signed in to change notification settings - Fork 785
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
[HttpClient & HttpWebRequest] Set network protocol version from response object #5043
[HttpClient & HttpWebRequest] Set network protocol version from response object #5043
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #5043 +/- ##
==========================================
+ Coverage 83.32% 83.48% +0.16%
==========================================
Files 296 296
Lines 12473 12481 +8
==========================================
+ Hits 10393 10420 +27
+ Misses 2080 2061 -19
Flags with carried forward coverage won't be shown. Click here to find out more.
|
…b.com/vishweshbankwar/opentelemetry-dotnet into vibankwa/fix-network-protocol-version
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.
Conceptually LGTM, I'm not familiar with implementation details.
The above wording from https://github.com/open-telemetry/semantic-conventions/blob/main/docs/http/http-metrics.md#metric-httpclientrequestduration, does not mention that this attribute will not be set if no response received. Should we clarify it ? What if the otel convention is expecting to populate the client's version in such case, instead of not populating at all? |
The spec says it's Recommended (vs Required), which in my understanding means that an implementation is allowed to omit it with an explanation. |
I suggest we need to clarify it from semantic conventions. It does not say "Recommended. Populate if a response is obtained, else omit"... Given it clarifies those for certain other attributes, its best to clarify instead of assuming. Optional attributes can cause issues like this open-telemetry/semantic-conventions#492, so want to make this sure this is not falling into that category from sem. convention standpoint, but only from .NET implementation only. |
I have opened open-telemetry/semantic-conventions#520 to get the clarification. |
While we wait for the spec clarity, I think it is ok to consider getting this change merged. Because, in our current state we are not setting the version correctly and this PR is addressing that part. |
Please put a TODO in the metrics instrumentation code linking to the spec issue, and proceed with this PR. |
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.
Looks good. We may need adjustment based on clarifications, if any, arising from semantic conventions.
@@ -267,6 +269,7 @@ private static void AddExceptionTags(Exception exception, Activity activity, out | |||
|
|||
if (tracingEmitNewAttributes) | |||
{ | |||
activity.SetTag(SemanticConventions.AttributeNetworkProtocolVersion, HttpTagHelper.GetProtocolVersionString(protocolVersion)); |
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.
Is this meant to be set twice?
It's set here (line 272) in the AddExceptionTags
and also the out parameter is used to set it again at Line 543.
It's also odd to me that it's being set in the AddExceptionTags helper method. This may be a candidate for refactor in the future.
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.
line 543 sets it on metric.
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.
HttpWebRequestActivitySource.netfx.cs
needs to be refactored to make the code simpler to follow. Not blocking this PR.
Fixes #4928
Changes
We are currently setting
network.protocol.version
using the version that was specified in request object. However, the final version depends on the version negotiated with the server. The PR updates to use version from response object. In case of no response,network.protocol.version
will not be set.Please provide a brief description of the changes here.
Merge requirement checklist
CHANGELOG.md
files updated for non-trivial changes