-
Notifications
You must be signed in to change notification settings - Fork 854
Only create a sibling activity when trace id, span id or trace state differ #5136
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
Changes from 5 commits
6d2c7ee
e516460
3e1af43
cb50735
a3c6d65
a76e470
0ab1901
f0c8152
d582a92
0e26e0b
98c8feb
83ce8b3
ba7b218
f1df768
462287e
2aa9fd9
219ceed
b3cb1e2
61a3bcb
9837992
e0b013e
f842030
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,6 +19,9 @@ | |
| using Microsoft.AspNetCore.Builder; | ||
| using Microsoft.AspNetCore.Hosting; | ||
| using Microsoft.AspNetCore.Http; | ||
| #if NET7_0_OR_GREATER | ||
| using Microsoft.AspNetCore.Http.Features; | ||
| #endif | ||
| using Microsoft.AspNetCore.Mvc.Testing; | ||
| using Microsoft.AspNetCore.TestHost; | ||
| using Microsoft.Extensions.DependencyInjection; | ||
|
|
@@ -1035,6 +1038,43 @@ public async Task DiagnosticSourceExceptionCallBackIsNotReceivedForExceptionsHan | |
| Assert.Equal(2, numberOfSubscribedEvents); | ||
| } | ||
|
|
||
| #if NET7_0_OR_GREATER | ||
|
||
| [Fact] | ||
| public async Task NoSiblingActivityCreatedWhenIdFormatIsW3CWithTraceFlagsNone() | ||
| { | ||
| this.tracerProvider = Sdk.CreateTracerProviderBuilder() | ||
| .SetSampler(new AlwaysOnSampler()) | ||
| .AddAspNetCoreInstrumentation() | ||
| .Build(); | ||
|
|
||
| var builder = WebApplication.CreateBuilder(); | ||
cijothomas marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| builder.WebHost.UseUrls("http://*:0"); | ||
| var app = builder.Build(); | ||
|
|
||
| app.MapGet("/values", (HttpContext context) => | ||
| { | ||
| var activity = context.Features.GetRequiredFeature<IHttpActivityFeature>().Activity; | ||
| var equal = Activity.Current.Id == activity.Id; | ||
|
|
||
| return Results.Ok(equal); | ||
| }); | ||
|
|
||
| _ = app.RunAsync(); | ||
|
|
||
| var url = app.Urls.ToArray()[0]; | ||
| var portNumber = url.Substring(url.LastIndexOf(':') + 1); | ||
|
|
||
| using var client = new HttpClient(); | ||
| var req = new HttpRequestMessage(HttpMethod.Get, $"http://localhost:{portNumber}/values"); | ||
| req.Headers.Add("traceparent", "00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-00"); | ||
| var res = await client.SendAsync(req); | ||
| var result = bool.Parse(await res.Content.ReadAsStringAsync()); | ||
|
|
||
| Assert.True(res.IsSuccessStatusCode); | ||
| Assert.True(result); | ||
cijothomas marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| #endif | ||
|
|
||
| public void Dispose() | ||
| { | ||
| this.tracerProvider?.Dispose(); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.