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

[Instrumentation.AspNet] pass http.request.method to sampler #2023

Open
wants to merge 26 commits into
base: main
Choose a base branch
from

Conversation

roycald245
Copy link

@roycald245 roycald245 commented Aug 26, 2024

Fixes #57287

Changes

Added http.request.method to tags given to sampler

Merge requirement checklist

  • CONTRIBUTING guidelines followed (license requirements, 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)

@github-actions github-actions bot added the comp:instrumentation.aspnet.telemetryhttpmodule Things related to OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule label Aug 26, 2024
@github-actions github-actions bot added comp:instrumentation.aspnet Things related to OpenTelemetry.Instrumentation.AspNet documentation Improvements or additions to documentation labels Aug 26, 2024
@roycald245 roycald245 marked this pull request as ready for review August 26, 2024 09:56
@roycald245 roycald245 requested a review from a team August 26, 2024 09:56
Co-authored-by: Cijo Thomas <cithomas@microsoft.com>
@Kielek Kielek changed the title Feat/add http method [Instrumentation.AspNet] pass http.request.method to sampler Aug 27, 2024
roycald245 and others added 3 commits August 27, 2024 10:23
{
tags = cachedTagsStorage ??= new KeyValuePair<string, object?>[1];
string? path = context.Request?.Unvalidated?.Path;
string? method = context.Request?.HttpMethod;
Copy link
Member

@vishweshbankwar vishweshbankwar Aug 29, 2024

Choose a reason for hiding this comment

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

I think we need to set the normalized value as we do here

If the method is normalized to _OTHER then should we also include http.request.method_original, that part is not very clear in spec

Copy link
Author

Choose a reason for hiding this comment

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

fixed 34e7fa3

Copy link
Author

Choose a reason for hiding this comment

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

I think setting "HTTP" like the example you sent is the way to go. Keeping the convention.

@birojnayak
Copy link
Contributor

@cijothomas @Kielek this would be really useful for us.... can we have it available sooner

@cijothomas cijothomas requested a review from a team as a code owner September 19, 2024 16:00
@@ -64,22 +65,38 @@ public static bool HasStarted(HttpContext context, out Activity? aspNetActivity)
PropagationContext propagationContext = textMapPropagator.Extract(default, context.Request, HttpRequestHeaderValuesGetter);

KeyValuePair<string, object?>[]? tags;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not replace KeyValuePair<string, object?>[]? with List<KeyValuePair<string, object?>>? for dynamic tag management, which eliminates the need for manual index handling in arrays, making the code more flexible and cleaner?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:instrumentation.aspnet.telemetryhttpmodule Things related to OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule comp:instrumentation.aspnet Things related to OpenTelemetry.Instrumentation.AspNet documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add http method tag for activity creation
6 participants