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

update HttpSemanticConventions for Instrumentation.Http #4538

Merged
merged 9 commits into from
Jun 22, 2023
Merged

update HttpSemanticConventions for Instrumentation.Http #4538

merged 9 commits into from
Jun 22, 2023

Conversation

TimothyMothra
Copy link
Contributor

@TimothyMothra TimothyMothra commented Jun 1, 2023

Design discussion issue #4484

Changes

  • add new attributes to SemanticConventions
  • update Instrumentation.Http classes HttpHandlerDiagnosticListener and HttpHandlerMetricsDiagnosticListener to emit new attributes
    • http.scheme -> url.scheme
    • http.method -> http.request.method
    • net.peer.name -> server.address
    • net.peer.port -> server.port
    • http.url -> url.full
    • http.flavor -> network.protocol.version
    • http.status_code -> http.response.status_code

Please provide a brief description of the changes here.

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 please review

@TimothyMothra TimothyMothra requested a review from a team June 1, 2023 22:52
@vishweshbankwar
Copy link
Member

@TimothyMothra
Copy link
Contributor Author

FYI - we will also need to update this https://github.com/open-telemetry/opentelemetry-dotnet/blob/main/src/OpenTelemetry.Instrumentation.Http/Implementation/HttpWebRequestActivitySource.netfx.cs (separate PR)

Sorry, I missed it because I was only looking at the "Listener" classes.
Any reason to not include it in this PR?

@codecov
Copy link

codecov bot commented Jun 7, 2023

Codecov Report

Merging #4538 (a3d4a9a) into main (938bc5c) will decrease coverage by 0.13%.
The diff coverage is 52.38%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4538      +/-   ##
==========================================
- Coverage   85.04%   84.91%   -0.13%     
==========================================
  Files         313      313              
  Lines       12575    12601      +26     
==========================================
+ Hits        10694    10700       +6     
- Misses       1881     1901      +20     
Impacted Files Coverage Δ
...tp/Implementation/HttpHandlerDiagnosticListener.cs 67.54% <50.00%> (-6.95%) ⬇️
...ementation/HttpHandlerMetricsDiagnosticListener.cs 71.87% <55.55%> (-23.58%) ⬇️

... and 4 files with indirect coverage changes

Copy link
Member

@vishweshbankwar vishweshbankwar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM: Need changelog entry


if (request.Headers.TryGetValues("User-Agent", out var userAgentValues))
{
var userAgent = userAgentValues.FirstOrDefault();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would cause an allocation. Refer to how AspNetCore instrumentation handles this: https://github.com/open-telemetry/opentelemetry-dotnet/blob/main/src/OpenTelemetry.Instrumentation.AspNetCore/Implementation/HttpInListener.cs#L217-L224

This should be done in a separate PR which updates the benchmarks as well.

Copy link
Contributor

@utpilla utpilla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a comment about updating the urls to point to a commit/tag instead of main branch.

Need a CHANGELOG entry.

@@ -110,5 +110,15 @@ internal static class SemanticConventions
public const string AttributeExceptionType = "exception.type";
public const string AttributeExceptionMessage = "exception.message";
public const string AttributeExceptionStacktrace = "exception.stacktrace";

// NEW v1.21.0 Http Semantic Conventions
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this mean?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was asked to separate the new attributes from the others and give it a descriptive comment.
The word "new" isn't needed here, sorry for the confusion.
I've updated this comment in the AspNetCore PR but forgot to update it here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was asked to separate the new attributes from the others and give it a descriptive comment.

What does v1.21.0 mean?

The word "new" isn't needed here

👍

@@ -110,5 +110,15 @@ internal static class SemanticConventions
public const string AttributeExceptionType = "exception.type";
public const string AttributeExceptionMessage = "exception.message";
public const string AttributeExceptionStacktrace = "exception.stacktrace";

// Http v1.21.0 https://github.com/open-telemetry/opentelemetry-specification/blob/v1.21.0/specification/trace/semantic_conventions/http.md
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The semantic-conventions repo doesn't have any tags yet so I can't link to a versioned copy of the Http document.

I discussed this with Utkarsh last week and he suggested using the v1.21.0 tag on the opentelemetry-specification repo.
The opentelemetry-specification repo does have tags and that version of the document does include all of the new attributes that we're adding in this PR.

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.

4 participants