-
Notifications
You must be signed in to change notification settings - Fork 855
set TraceState field in OTLP Exporter
#4331
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 all commits
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 |
|---|---|---|
|
|
@@ -551,6 +551,32 @@ public void ToOtlpSpanActivityStatusTakesPrecedenceOverStatusTagsWhenActivitySta | |
| Assert.Equal(StatusDescriptionOnError, otlpSpan.Status.Message); | ||
| } | ||
|
|
||
| [Theory] | ||
| [InlineData(true)] | ||
| [InlineData(false)] | ||
| public void ToOtlpSpanTraceStateTest(bool traceStateWasSet) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we have existing tests for checking other things from activity context? like spanid,traceid etc? we could just modify it instead of adding dedicated tests.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can add traceState assertions to |
||
| { | ||
| using var activitySource = new ActivitySource(nameof(this.ToOtlpSpanTest)); | ||
| using var activity = activitySource.StartActivity("Name"); | ||
| string tracestate = "a=b;c=d"; | ||
| if (traceStateWasSet) | ||
| { | ||
| activity.TraceStateString = tracestate; | ||
| } | ||
|
|
||
| var otlpSpan = activity.ToOtlpSpan(DefaultSdkLimitOptions); | ||
|
|
||
| if (traceStateWasSet) | ||
| { | ||
| Assert.NotNull(otlpSpan.TraceState); | ||
| Assert.Equal(tracestate, otlpSpan.TraceState); | ||
| } | ||
| else | ||
| { | ||
| Assert.Equal(string.Empty, otlpSpan.TraceState); | ||
| } | ||
| } | ||
|
|
||
| [Fact] | ||
| public void ToOtlpSpanPeerServiceTest() | ||
| { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.