Modified B3Format propogator to use ActivityContext (#822)
This commit is contained in:
parent
efaa6f61fc
commit
59f0a9d06a
|
|
@ -26,7 +26,7 @@ namespace OpenTelemetry.Instrumentation.AspNet
|
|||
public class AspNetInstrumentationOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets <see cref="ITextFormat"/> for context propagation.
|
||||
/// Gets or sets <see cref="ITextFormatActivity"/> for context propagation.
|
||||
/// </summary>
|
||||
public ITextFormatActivity TextFormat { get; set; } = new TraceContextFormatActivity();
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ namespace OpenTelemetry.Instrumentation.Dependencies
|
|||
public bool SetHttpFlavor { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets <see cref="ITextFormat"/> for context propagation.
|
||||
/// Gets or sets <see cref="ITextFormatActivity"/> for context propagation.
|
||||
/// </summary>
|
||||
public ITextFormatActivity TextFormat { get; set; } = new TraceContextFormatActivity();
|
||||
|
||||
|
|
|
|||
|
|
@ -19,14 +19,13 @@ using System.Diagnostics;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
using OpenTelemetry.Internal;
|
||||
using OpenTelemetry.Trace;
|
||||
|
||||
namespace OpenTelemetry.Context.Propagation
|
||||
{
|
||||
/// <summary>
|
||||
/// B3 text propagator. See https://github.com/openzipkin/b3-propagation for the specification.
|
||||
/// </summary>
|
||||
public sealed class B3Format : ITextFormat
|
||||
public sealed class B3Format : ITextFormatActivity
|
||||
{
|
||||
internal static readonly string XB3TraceId = "X-B3-TraceId";
|
||||
internal static readonly string XB3SpanId = "X-B3-SpanId";
|
||||
|
|
@ -47,7 +46,6 @@ namespace OpenTelemetry.Context.Propagation
|
|||
internal static readonly string FlagsValue = "1";
|
||||
|
||||
private static readonly HashSet<string> AllFields = new HashSet<string>() { XB3TraceId, XB3SpanId, XB3ParentSpanId, XB3Sampled, XB3Flags };
|
||||
private static readonly SpanContext RemoteInvalidContext = new SpanContext(default, default, ActivityTraceFlags.None, true);
|
||||
|
||||
private readonly bool singleHeader;
|
||||
|
||||
|
|
@ -72,18 +70,18 @@ namespace OpenTelemetry.Context.Propagation
|
|||
public ISet<string> Fields => AllFields;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public SpanContext Extract<T>(T carrier, Func<T, string, IEnumerable<string>> getter)
|
||||
public ActivityContext Extract<T>(T carrier, Func<T, string, IEnumerable<string>> getter)
|
||||
{
|
||||
if (carrier == null)
|
||||
{
|
||||
OpenTelemetrySdkEventSource.Log.FailedToExtractContext("null carrier");
|
||||
return RemoteInvalidContext;
|
||||
return default;
|
||||
}
|
||||
|
||||
if (getter == null)
|
||||
{
|
||||
OpenTelemetrySdkEventSource.Log.FailedToExtractContext("null getter");
|
||||
return RemoteInvalidContext;
|
||||
return default;
|
||||
}
|
||||
|
||||
if (this.singleHeader)
|
||||
|
|
@ -97,9 +95,9 @@ namespace OpenTelemetry.Context.Propagation
|
|||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Inject<T>(SpanContext spanContext, T carrier, Action<T, string, string> setter)
|
||||
public void Inject<T>(ActivityContext spanContext, T carrier, Action<T, string, string> setter)
|
||||
{
|
||||
if (!spanContext.IsValid)
|
||||
if (!spanContext.IsValid())
|
||||
{
|
||||
OpenTelemetrySdkEventSource.Log.FailedToInjectContext("invalid context");
|
||||
return;
|
||||
|
|
@ -142,7 +140,7 @@ namespace OpenTelemetry.Context.Propagation
|
|||
}
|
||||
}
|
||||
|
||||
private static SpanContext ExtractFromMultipleHeaders<T>(T carrier, Func<T, string, IEnumerable<string>> getter)
|
||||
private static ActivityContext ExtractFromMultipleHeaders<T>(T carrier, Func<T, string, IEnumerable<string>> getter)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -160,7 +158,7 @@ namespace OpenTelemetry.Context.Propagation
|
|||
}
|
||||
else
|
||||
{
|
||||
return RemoteInvalidContext;
|
||||
return default;
|
||||
}
|
||||
|
||||
ActivitySpanId spanId;
|
||||
|
|
@ -171,7 +169,7 @@ namespace OpenTelemetry.Context.Propagation
|
|||
}
|
||||
else
|
||||
{
|
||||
return RemoteInvalidContext;
|
||||
return default;
|
||||
}
|
||||
|
||||
var traceOptions = ActivityTraceFlags.None;
|
||||
|
|
@ -181,35 +179,35 @@ namespace OpenTelemetry.Context.Propagation
|
|||
traceOptions |= ActivityTraceFlags.Recorded;
|
||||
}
|
||||
|
||||
return new SpanContext(traceId, spanId, traceOptions);
|
||||
return new ActivityContext(traceId, spanId, traceOptions);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
OpenTelemetrySdkEventSource.Log.ContextExtractException(e);
|
||||
return RemoteInvalidContext;
|
||||
return default;
|
||||
}
|
||||
}
|
||||
|
||||
private static SpanContext ExtractFromSingleHeader<T>(T carrier, Func<T, string, IEnumerable<string>> getter)
|
||||
private static ActivityContext ExtractFromSingleHeader<T>(T carrier, Func<T, string, IEnumerable<string>> getter)
|
||||
{
|
||||
try
|
||||
{
|
||||
var header = getter(carrier, XB3Combined)?.FirstOrDefault();
|
||||
if (string.IsNullOrWhiteSpace(header))
|
||||
{
|
||||
return RemoteInvalidContext;
|
||||
return default;
|
||||
}
|
||||
|
||||
var parts = header.Split(XB3CombinedDelimiter);
|
||||
if (parts.Length < 2 || parts.Length > 4)
|
||||
{
|
||||
return RemoteInvalidContext;
|
||||
return default;
|
||||
}
|
||||
|
||||
var traceIdStr = parts[0];
|
||||
if (string.IsNullOrWhiteSpace(traceIdStr))
|
||||
{
|
||||
return RemoteInvalidContext;
|
||||
return default;
|
||||
}
|
||||
|
||||
if (traceIdStr.Length == 16)
|
||||
|
|
@ -223,7 +221,7 @@ namespace OpenTelemetry.Context.Propagation
|
|||
var spanIdStr = parts[1];
|
||||
if (string.IsNullOrWhiteSpace(spanIdStr))
|
||||
{
|
||||
return RemoteInvalidContext;
|
||||
return default;
|
||||
}
|
||||
|
||||
var spanId = ActivitySpanId.CreateFromString(spanIdStr.AsSpan());
|
||||
|
|
@ -239,12 +237,12 @@ namespace OpenTelemetry.Context.Propagation
|
|||
}
|
||||
}
|
||||
|
||||
return new SpanContext(traceId, spanId, traceOptions);
|
||||
return new ActivityContext(traceId, spanId, traceOptions);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
OpenTelemetrySdkEventSource.Log.ContextExtractException(e);
|
||||
return RemoteInvalidContext;
|
||||
return default;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ namespace OpenTelemetry.Context.Propagation.Test
|
|||
public void Serialize_SampledContext()
|
||||
{
|
||||
var carrier = new Dictionary<string, string>();
|
||||
this.b3Format.Inject(new SpanContext(TraceId, SpanId, TraceOptions), carrier, Setter);
|
||||
this.b3Format.Inject(new ActivityContext(TraceId, SpanId, TraceOptions), carrier, Setter);
|
||||
this.ContainsExactly(carrier, new Dictionary<string, string> { { B3Format.XB3TraceId, TraceIdBase16 }, { B3Format.XB3SpanId, SpanIdBase16 }, { B3Format.XB3Sampled, "1" } });
|
||||
}
|
||||
|
||||
|
|
@ -65,7 +65,7 @@ namespace OpenTelemetry.Context.Propagation.Test
|
|||
public void Serialize_NotSampledContext()
|
||||
{
|
||||
var carrier = new Dictionary<string, string>();
|
||||
var context = new SpanContext(TraceId, SpanId, ActivityTraceFlags.None);
|
||||
var context = new ActivityContext(TraceId, SpanId, ActivityTraceFlags.None);
|
||||
this.output.WriteLine(context.ToString());
|
||||
this.b3Format.Inject(context, carrier, Setter);
|
||||
this.ContainsExactly(carrier, new Dictionary<string, string> { { B3Format.XB3TraceId, TraceIdBase16 }, { B3Format.XB3SpanId, SpanIdBase16 } });
|
||||
|
|
@ -78,7 +78,7 @@ namespace OpenTelemetry.Context.Propagation.Test
|
|||
{
|
||||
{ B3Format.XB3TraceId, TraceIdBase16 }, { B3Format.XB3SpanId, SpanIdBase16 },
|
||||
};
|
||||
var spanContext = new SpanContext(TraceId, SpanId, ActivityTraceFlags.None);
|
||||
var spanContext = new ActivityContext(TraceId, SpanId, ActivityTraceFlags.None);
|
||||
Assert.Equal(spanContext, this.b3Format.Extract(headersNotSampled, Getter));
|
||||
}
|
||||
|
||||
|
|
@ -89,7 +89,7 @@ namespace OpenTelemetry.Context.Propagation.Test
|
|||
{
|
||||
{ B3Format.XB3TraceId, TraceIdBase16 }, { B3Format.XB3SpanId, SpanIdBase16 }, { B3Format.XB3Sampled, "1" },
|
||||
};
|
||||
Assert.Equal(new SpanContext(TraceId, SpanId, TraceOptions), this.b3Format.Extract(headersSampled, Getter));
|
||||
Assert.Equal(new ActivityContext(TraceId, SpanId, TraceOptions), this.b3Format.Extract(headersSampled, Getter));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -99,7 +99,7 @@ namespace OpenTelemetry.Context.Propagation.Test
|
|||
{
|
||||
{ B3Format.XB3TraceId, TraceIdBase16 }, { B3Format.XB3SpanId, SpanIdBase16 }, { B3Format.XB3Sampled, "0" },
|
||||
};
|
||||
Assert.Equal(new SpanContext(TraceId, SpanId, ActivityTraceFlags.None), this.b3Format.Extract(headersNotSampled, Getter));
|
||||
Assert.Equal(new ActivityContext(TraceId, SpanId, ActivityTraceFlags.None), this.b3Format.Extract(headersNotSampled, Getter));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -109,7 +109,7 @@ namespace OpenTelemetry.Context.Propagation.Test
|
|||
{
|
||||
{ B3Format.XB3TraceId, TraceIdBase16 }, { B3Format.XB3SpanId, SpanIdBase16 }, { B3Format.XB3Flags, "1" },
|
||||
};
|
||||
Assert.Equal(new SpanContext(TraceId, SpanId, TraceOptions), this.b3Format.Extract(headersFlagSampled, Getter));
|
||||
Assert.Equal(new ActivityContext(TraceId, SpanId, TraceOptions), this.b3Format.Extract(headersFlagSampled, Getter));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -119,7 +119,7 @@ namespace OpenTelemetry.Context.Propagation.Test
|
|||
{
|
||||
{ B3Format.XB3TraceId, TraceIdBase16 }, { B3Format.XB3SpanId, SpanIdBase16 }, { B3Format.XB3Flags, "0" },
|
||||
};
|
||||
Assert.Equal(new SpanContext(TraceId, SpanId, ActivityTraceFlags.None), this.b3Format.Extract(headersFlagNotSampled, Getter));
|
||||
Assert.Equal(new ActivityContext(TraceId, SpanId, ActivityTraceFlags.None), this.b3Format.Extract(headersFlagNotSampled, Getter));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -131,7 +131,7 @@ namespace OpenTelemetry.Context.Propagation.Test
|
|||
{ B3Format.XB3SpanId, SpanIdBase16 },
|
||||
{ B3Format.XB3Sampled, "1" },
|
||||
};
|
||||
Assert.Equal(new SpanContext(TraceIdEightBytes, SpanId, TraceOptions), this.b3Format.Extract(headersEightBytes, Getter));
|
||||
Assert.Equal(new ActivityContext(TraceIdEightBytes, SpanId, TraceOptions), this.b3Format.Extract(headersEightBytes, Getter));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -141,7 +141,7 @@ namespace OpenTelemetry.Context.Propagation.Test
|
|||
{
|
||||
{ B3Format.XB3TraceId, TraceIdBase16EightBytes }, { B3Format.XB3SpanId, SpanIdBase16 },
|
||||
};
|
||||
Assert.Equal(new SpanContext(TraceIdEightBytes, SpanId, ActivityTraceFlags.None), this.b3Format.Extract(headersEightBytes, Getter));
|
||||
Assert.Equal(new ActivityContext(TraceIdEightBytes, SpanId, ActivityTraceFlags.None), this.b3Format.Extract(headersEightBytes, Getter));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -151,7 +151,7 @@ namespace OpenTelemetry.Context.Propagation.Test
|
|||
{
|
||||
{ B3Format.XB3TraceId, InvalidId }, { B3Format.XB3SpanId, SpanIdBase16 },
|
||||
};
|
||||
Assert.Equal(SpanContext.BlankRemote, this.b3Format.Extract(invalidHeaders, Getter));
|
||||
Assert.Equal(default, this.b3Format.Extract(invalidHeaders, Getter));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -162,14 +162,14 @@ namespace OpenTelemetry.Context.Propagation.Test
|
|||
{ B3Format.XB3TraceId, InvalidSizeId }, { B3Format.XB3SpanId, SpanIdBase16 },
|
||||
};
|
||||
|
||||
Assert.Equal(SpanContext.BlankRemote, this.b3Format.Extract(invalidHeaders, Getter));
|
||||
Assert.Equal(default, this.b3Format.Extract(invalidHeaders, Getter));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseMissingTraceId()
|
||||
{
|
||||
var invalidHeaders = new Dictionary<string, string> { { B3Format.XB3SpanId, SpanIdBase16 }, };
|
||||
Assert.Equal(SpanContext.BlankRemote, this.b3Format.Extract(invalidHeaders, Getter));
|
||||
Assert.Equal(default, this.b3Format.Extract(invalidHeaders, Getter));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -179,7 +179,7 @@ namespace OpenTelemetry.Context.Propagation.Test
|
|||
{
|
||||
{ B3Format.XB3TraceId, TraceIdBase16 }, { B3Format.XB3SpanId, InvalidId },
|
||||
};
|
||||
Assert.Equal(SpanContext.BlankRemote, this.b3Format.Extract(invalidHeaders, Getter));
|
||||
Assert.Equal(default, this.b3Format.Extract(invalidHeaders, Getter));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -189,21 +189,21 @@ namespace OpenTelemetry.Context.Propagation.Test
|
|||
{
|
||||
{ B3Format.XB3TraceId, TraceIdBase16 }, { B3Format.XB3SpanId, InvalidSizeId },
|
||||
};
|
||||
Assert.Equal(SpanContext.BlankRemote, this.b3Format.Extract(invalidHeaders, Getter));
|
||||
Assert.Equal(default, this.b3Format.Extract(invalidHeaders, Getter));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseMissingSpanId()
|
||||
{
|
||||
var invalidHeaders = new Dictionary<string, string> { { B3Format.XB3TraceId, TraceIdBase16 } };
|
||||
Assert.Equal(SpanContext.BlankRemote, this.b3Format.Extract(invalidHeaders, Getter));
|
||||
Assert.Equal(default, this.b3Format.Extract(invalidHeaders, Getter));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Serialize_SampledContext_SingleHeader()
|
||||
{
|
||||
var carrier = new Dictionary<string, string>();
|
||||
this.b3FormatSingleHeader.Inject(new SpanContext(TraceId, SpanId, TraceOptions), carrier, Setter);
|
||||
this.b3FormatSingleHeader.Inject(new ActivityContext(TraceId, SpanId, TraceOptions), carrier, Setter);
|
||||
this.ContainsExactly(carrier, new Dictionary<string, string> { { B3Format.XB3Combined, $"{TraceIdBase16}-{SpanIdBase16}-1" } });
|
||||
}
|
||||
|
||||
|
|
@ -211,7 +211,7 @@ namespace OpenTelemetry.Context.Propagation.Test
|
|||
public void Serialize_NotSampledContext_SingleHeader()
|
||||
{
|
||||
var carrier = new Dictionary<string, string>();
|
||||
var context = new SpanContext(TraceId, SpanId, ActivityTraceFlags.None);
|
||||
var context = new ActivityContext(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}" } });
|
||||
|
|
@ -224,7 +224,7 @@ namespace OpenTelemetry.Context.Propagation.Test
|
|||
{
|
||||
{ B3Format.XB3Combined, $"{TraceIdBase16}-{SpanIdBase16}" },
|
||||
};
|
||||
var spanContext = new SpanContext(TraceId, SpanId, ActivityTraceFlags.None);
|
||||
var spanContext = new ActivityContext(TraceId, SpanId, ActivityTraceFlags.None);
|
||||
Assert.Equal(spanContext, this.b3FormatSingleHeader.Extract(headersNotSampled, Getter));
|
||||
}
|
||||
|
||||
|
|
@ -235,7 +235,7 @@ namespace OpenTelemetry.Context.Propagation.Test
|
|||
{
|
||||
{ B3Format.XB3Combined, $"{TraceIdBase16}-{SpanIdBase16}-1" },
|
||||
};
|
||||
Assert.Equal(new SpanContext(TraceId, SpanId, TraceOptions), this.b3FormatSingleHeader.Extract(headersSampled, Getter));
|
||||
Assert.Equal(new ActivityContext(TraceId, SpanId, TraceOptions), this.b3FormatSingleHeader.Extract(headersSampled, Getter));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -245,7 +245,7 @@ namespace OpenTelemetry.Context.Propagation.Test
|
|||
{
|
||||
{ B3Format.XB3Combined, $"{TraceIdBase16}-{SpanIdBase16}-0" },
|
||||
};
|
||||
Assert.Equal(new SpanContext(TraceId, SpanId, ActivityTraceFlags.None), this.b3FormatSingleHeader.Extract(headersNotSampled, Getter));
|
||||
Assert.Equal(new ActivityContext(TraceId, SpanId, ActivityTraceFlags.None), this.b3FormatSingleHeader.Extract(headersNotSampled, Getter));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -255,7 +255,7 @@ namespace OpenTelemetry.Context.Propagation.Test
|
|||
{
|
||||
{ B3Format.XB3Combined, $"{TraceIdBase16}-{SpanIdBase16}-1" },
|
||||
};
|
||||
Assert.Equal(new SpanContext(TraceId, SpanId, TraceOptions), this.b3FormatSingleHeader.Extract(headersFlagSampled, Getter));
|
||||
Assert.Equal(new ActivityContext(TraceId, SpanId, TraceOptions), this.b3FormatSingleHeader.Extract(headersFlagSampled, Getter));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -265,7 +265,7 @@ namespace OpenTelemetry.Context.Propagation.Test
|
|||
{
|
||||
{ B3Format.XB3Combined, $"{TraceIdBase16}-{SpanIdBase16}-0" },
|
||||
};
|
||||
Assert.Equal(new SpanContext(TraceId, SpanId, ActivityTraceFlags.None), this.b3FormatSingleHeader.Extract(headersFlagNotSampled, Getter));
|
||||
Assert.Equal(new ActivityContext(TraceId, SpanId, ActivityTraceFlags.None), this.b3FormatSingleHeader.Extract(headersFlagNotSampled, Getter));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -275,7 +275,7 @@ namespace OpenTelemetry.Context.Propagation.Test
|
|||
{
|
||||
{ B3Format.XB3Combined, $"{TraceIdBase16EightBytes}-{SpanIdBase16}-1" },
|
||||
};
|
||||
Assert.Equal(new SpanContext(TraceIdEightBytes, SpanId, TraceOptions), this.b3FormatSingleHeader.Extract(headersEightBytes, Getter));
|
||||
Assert.Equal(new ActivityContext(TraceIdEightBytes, SpanId, TraceOptions), this.b3FormatSingleHeader.Extract(headersEightBytes, Getter));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -285,7 +285,7 @@ namespace OpenTelemetry.Context.Propagation.Test
|
|||
{
|
||||
{ B3Format.XB3Combined, $"{TraceIdBase16EightBytes}-{SpanIdBase16}" },
|
||||
};
|
||||
Assert.Equal(new SpanContext(TraceIdEightBytes, SpanId, ActivityTraceFlags.None), this.b3FormatSingleHeader.Extract(headersEightBytes, Getter));
|
||||
Assert.Equal(new ActivityContext(TraceIdEightBytes, SpanId, ActivityTraceFlags.None), this.b3FormatSingleHeader.Extract(headersEightBytes, Getter));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -295,7 +295,7 @@ namespace OpenTelemetry.Context.Propagation.Test
|
|||
{
|
||||
{ B3Format.XB3Combined, $"{InvalidId}-{SpanIdBase16}" },
|
||||
};
|
||||
Assert.Equal(SpanContext.BlankRemote, this.b3FormatSingleHeader.Extract(invalidHeaders, Getter));
|
||||
Assert.Equal(default, this.b3FormatSingleHeader.Extract(invalidHeaders, Getter));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -306,14 +306,14 @@ namespace OpenTelemetry.Context.Propagation.Test
|
|||
{ B3Format.XB3Combined, $"{InvalidSizeId}-{SpanIdBase16}" },
|
||||
};
|
||||
|
||||
Assert.Equal(SpanContext.BlankRemote, this.b3FormatSingleHeader.Extract(invalidHeaders, Getter));
|
||||
Assert.Equal(default, this.b3FormatSingleHeader.Extract(invalidHeaders, Getter));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseMissingTraceId_SingleHeader()
|
||||
{
|
||||
var invalidHeaders = new Dictionary<string, string> { { B3Format.XB3Combined, $"-{SpanIdBase16}" } };
|
||||
Assert.Equal(SpanContext.BlankRemote, this.b3FormatSingleHeader.Extract(invalidHeaders, Getter));
|
||||
Assert.Equal(default, this.b3FormatSingleHeader.Extract(invalidHeaders, Getter));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -323,7 +323,7 @@ namespace OpenTelemetry.Context.Propagation.Test
|
|||
{
|
||||
{ B3Format.XB3Combined, $"{TraceIdBase16}-{InvalidId}" },
|
||||
};
|
||||
Assert.Equal(SpanContext.BlankRemote, this.b3FormatSingleHeader.Extract(invalidHeaders, Getter));
|
||||
Assert.Equal(default, this.b3FormatSingleHeader.Extract(invalidHeaders, Getter));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -333,14 +333,14 @@ namespace OpenTelemetry.Context.Propagation.Test
|
|||
{
|
||||
{ B3Format.XB3Combined, $"{TraceIdBase16}-{InvalidSizeId}" },
|
||||
};
|
||||
Assert.Equal(SpanContext.BlankRemote, this.b3FormatSingleHeader.Extract(invalidHeaders, Getter));
|
||||
Assert.Equal(default, this.b3FormatSingleHeader.Extract(invalidHeaders, Getter));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseMissingSpanId_SingleHeader()
|
||||
{
|
||||
var invalidHeaders = new Dictionary<string, string> { { B3Format.XB3Combined, $"{TraceIdBase16}-" } };
|
||||
Assert.Equal(SpanContext.BlankRemote, this.b3FormatSingleHeader.Extract(invalidHeaders, Getter));
|
||||
Assert.Equal(default, this.b3FormatSingleHeader.Extract(invalidHeaders, Getter));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
|
|||
Loading…
Reference in New Issue