public void Extract_MissingParentIdHeader_Exception() { _headers.Set(HttpHeaderTraceId, "10"); var context = HeaderCollectionPropagator.Extract(_headers); Assert.Null(context); }
public void Extract_NonIntegerParentId_Exception() { _headers.Set(HttpHeaderTraceId, "hello"); _headers.Set(HttpHeaderParentId, "10"); var context = HeaderCollectionPropagator.Extract(_headers); Assert.Null(context); }
public void Inject_SpanContext_HeadersWithCorrectInfo() { const ulong spanId = 10; const ulong traceId = 7; var spanContext = new SpanContext(traceId, spanId); HeaderCollectionPropagator.Inject(_headers, spanContext); Assert.Equal(spanId.ToString(), _headers.Get(HttpHeaderParentId)); Assert.Equal(traceId.ToString(), _headers.Get(HttpHeaderTraceId)); }
public void Extract_WrongHeaderCase_ExtractionStillWorks() { const ulong traceId = 10; const ulong parentId = 120; _headers.Set(HttpHeaderTraceId.ToUpper(), traceId.ToString()); _headers.Set(HttpHeaderParentId.ToUpper(), parentId.ToString()); var spanContext = HeaderCollectionPropagator.Extract(_headers); Assert.NotNull(spanContext); Assert.Equal(traceId, spanContext.TraceId); Assert.Equal(parentId, spanContext.SpanId); }
public void Extract_ValidParentAndTraceId_ProperSpanContext() { const ulong traceId = 10; const ulong parentId = 120; _headers.Set(HttpHeaderTraceId, traceId.ToString()); _headers.Set(HttpHeaderParentId, parentId.ToString()); var spanContext = HeaderCollectionPropagator.Extract(_headers); Assert.NotNull(spanContext); Assert.Equal(traceId, spanContext.TraceId); Assert.Equal(parentId, spanContext.SpanId); }
public void Extract_NoHeaders_Exception() { var context = HeaderCollectionPropagator.Extract(_headers); Assert.Null(context); }