Skip to content
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] Fix activity displayName #5078

Merged

Conversation

vishweshbankwar
Copy link
Member

@vishweshbankwar vishweshbankwar commented Nov 22, 2023

Fixes #
Design discussion issue #

Changes

updates http client activity display name as per specification https://github.com/open-telemetry/semantic-conventions/blob/main/docs/http/http-spans.md#name + some minor refactor

Merge requirement checklist

  • CONTRIBUTING guidelines followed (nullable enabled, static analysis, etc.)
  • Unit tests added/updated
  • Appropriate CHANGELOG.md files updated for non-trivial changes
  • Changes in public API reviewed (if applicable)

@vishweshbankwar vishweshbankwar marked this pull request as ready for review November 22, 2023 22:42
@vishweshbankwar vishweshbankwar requested a review from a team as a code owner November 22, 2023 22:42
Copy link

codecov bot commented Nov 22, 2023

Codecov Report

Merging #5078 (3d339fa) into main (617ac6c) will decrease coverage by 0.33%.
Report is 1 commits behind head on main.
The diff coverage is 100.00%.

❗ Current head 3d339fa differs from pull request most recent head bef12ad. Consider uploading reports for the commit bef12ad to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #5078      +/-   ##
==========================================
- Coverage   83.36%   83.04%   -0.33%     
==========================================
  Files         296      296              
  Lines       12339    12335       -4     
==========================================
- Hits        10287    10244      -43     
- Misses       2052     2091      +39     
Flag Coverage Δ
unittests 83.04% <100.00%> (-0.33%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...tp/Implementation/HttpHandlerDiagnosticListener.cs 72.18% <100.00%> (-0.62%) ⬇️
...plementation/HttpWebRequestActivitySource.netfx.cs 82.15% <100.00%> (-0.12%) ⬇️
src/Shared/RequestMethodHelper.cs 100.00% <100.00%> (ø)

... and 7 files with indirect coverage changes

@TimothyMothra
Copy link
Contributor

LGTM. Just a nit for discussion:
Currently all the callers have to be knowledgeable of the spec to set the "HTTP" default value.

example:

activity.DisplayName = RequestMethodHelper.KnownMethods.TryGetValue(request.Method.Method, out var httpMethod) ? httpMethod : "HTTP";

Would it make sense to have a helper method that fully encapsulates this default value with a reference to the applicable spec?

activity.DisplayName = RequestMethodHelper.GetDisplayName(request.Method.Method);

@vishweshbankwar
Copy link
Member Author

LGTM. Just a nit for discussion: Currently all the callers have to be knowledgeable of the spec to set the "HTTP" default value.

example:

activity.DisplayName = RequestMethodHelper.KnownMethods.TryGetValue(request.Method.Method, out var httpMethod) ? httpMethod : "HTTP";

Would it make sense to have a helper method that fully encapsulates this default value with a reference to the applicable spec?

activity.DisplayName = RequestMethodHelper.GetDisplayName(request.Method.Method);

Done!

@utpilla utpilla merged commit e6f97bc into open-telemetry:main Nov 29, 2023
78 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants