public void SpanContext_ToString() { Assert.Contains(TraceId.FromBytes(firstTraceIdBytes).ToString(), first.ToString()); Assert.Contains(SpanId.FromBytes(firstSpanIdBytes).ToString(), first.ToString()); Assert.Contains(TraceOptions.Default.ToString(), first.ToString()); Assert.Contains(TraceId.FromBytes(secondTraceIdBytes).ToString(), second.ToString()); Assert.Contains(SpanId.FromBytes(secondSpanIdBytes).ToString(), second.ToString()); Assert.Contains(TraceOptions.Builder().SetIsSampled(true).Build().ToString(), second.ToString()); }
public void SpanContext_AsString_Builds_A_Valid_String() { var context = new SpanContext(90, 8, 14, 98); Assert.Equal("90:8:14:98", context.ContextAsString); Assert.Equal("90:8:14:98", context.ToString()); }
public void SpanData_ToString() { var spanDataString = SpanData.Create( spanContext, parentSpanId, resource, SPAN_NAME, startTimestamp, attributes, events, links, CHILD_SPAN_COUNT, status, SPAN_KIND, endTimestamp) .ToString(); Assert.Contains(spanContext.ToString(), spanDataString); Assert.Contains(parentSpanId.ToString(), spanDataString); Assert.Contains(resource.ToString(), spanDataString); Assert.Contains(SPAN_NAME, spanDataString); Assert.Contains(startTimestamp.ToString(), spanDataString); Assert.Contains(attributes.ToString(), spanDataString); Assert.Contains(events.ToString(), spanDataString); Assert.Contains(links.ToString(), spanDataString); Assert.Contains(status.ToString(), spanDataString); Assert.Contains(endTimestamp.ToString(), spanDataString); }
public void Serialize_NotSampledContext() { var carrier = new Dictionary <string, string>(); var context = new SpanContext(TraceId, SpanId, ActivityTraceFlags.None); output.WriteLine(context.ToString()); b3Format.Inject(context, carrier, Setter); ContainsExactly(carrier, new Dictionary <string, string> { { B3Format.XB3TraceId, TraceIdBase16 }, { B3Format.XB3SpanId, SpanIdBase16 } }); }
public void Serialize_NotSampledContext_SingleHeader() { var carrier = new Dictionary <string, string>(); var context = new SpanContext(TraceId, SpanId, ActivityTraceFlags.None); this.output.WriteLine(context.ToString()); this.b3FormatSingleHeader.Inject(context, carrier, Setter); this.ContainsExactly(carrier, new Dictionary <string, string> { { B3Format.XB3Combined, $"{TraceIdBase16}-{SpanIdBase16}" } }); }
public void SpanContext_ToString() { var traceId = new TraceId(1, 2); var spanId = new SpanId(3); var parentId = new SpanId(4); ContextFlags flags = (ContextFlags)3; var sc = new SpanContext(traceId, spanId, parentId, null, flags); Assert.Equal("10000000000000002:3:4:3", sc.ToString()); }