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

Modify ASP.NET Core instrumentation to take advantage of sampling decision #1899

Conversation

utpilla
Copy link
Contributor

@utpilla utpilla commented Mar 11, 2021

Changes

@utpilla utpilla requested a review from a team March 11, 2021 07:46
@codecov
Copy link

codecov bot commented Mar 11, 2021

Codecov Report

Merging #1899 (b88ba57) into main (02ceb1a) will increase coverage by 0.00%.
The diff coverage is 93.33%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1899   +/-   ##
=======================================
  Coverage   84.41%   84.42%           
=======================================
  Files         188      188           
  Lines        6103     6105    +2     
=======================================
+ Hits         5152     5154    +2     
  Misses        951      951           
Impacted Files Coverage Δ
...tation.AspNetCore/Implementation/HttpInListener.cs 86.02% <93.33%> (+0.20%) ⬆️

request = new HttpRequestMessage(HttpMethod.Get, "/api/GetChildActivityBaggageContext");
request.Headers.Add("Baggage", "key1=value1,key2=value2");
response = await client.SendAsync(request);
var childActivityBaggageContext = JsonConvert.DeserializeObject<IReadOnlyDictionary<string, string>>(response.Content.ReadAsStringAsync().Result);
Copy link
Member

Choose a reason for hiding this comment

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

you can avoid the additional json parsing, by making the test app return 2 strings contaning traceparent and tracestate (activity.Id, activity.TraceState) respectively.

// Test TraceContext Propagation
var expectedTraceState = "rojo=1,congo=2";
var request = new HttpRequestMessage(HttpMethod.Get, "/api/GetChildActivityTraceContext");
request.Headers.Add("traceparent", $"00-{expectedTraceId}-{expectedParentSpanId}-01");
Copy link
Member

Choose a reason for hiding this comment

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

portions of this test would pass by default, as asp.net creates activity from traceparent always, irrespective of sampling in Otel.
To ensure thorough test, use a custom propagator (with some header like Foo), and validate the scenarios. Also add cases where sending traceparent with "00" and "01" as sampling flags

@utpilla utpilla closed this Mar 12, 2021
@utpilla utpilla reopened this Mar 12, 2021
Copy link
Member

@cijothomas cijothomas left a comment

Choose a reason for hiding this comment

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

Lets add to changelog that FIlter/Enrich is only called if AllDataRequested is true.

utpilla added 4 commits March 18, 2021 13:05
…etCoreInstrumentation-For-SuppressInstrumentation
…entation-For-SuppressInstrumentation' into utpilla/Optimize-AspNetCoreInstrumentation-For-SuppressInstrumentation
@cijothomas cijothomas merged commit 0c8b5e1 into open-telemetry:main Mar 18, 2021
@utpilla utpilla deleted the utpilla/Optimize-AspNetCoreInstrumentation-For-SuppressInstrumentation branch July 30, 2021 00:18
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.

2 participants