Skip to content

Commit

Permalink
Add a binary propagator format option (#116)
Browse files Browse the repository at this point in the history
* add binary format option

* add notice that binary propagation is experimental
  • Loading branch information
austinlparker authored Jan 23, 2019
1 parent 03c457c commit 4b1c14c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ private Task SubmitTasks()
{
using (IScope childScope1 = _tracer.BuildSpan("task1").StartActive(finishSpanOnDispose:true))
{
await Task.Delay(55);
await Task.Delay(100);
}
});

var task2 = Task.Run(async () =>
{
using (IScope childScope2 = _tracer.BuildSpan("task2").StartActive(finishSpanOnDispose:true))
{
await Task.Delay(85);
await Task.Delay(500);
}
});

Expand Down
15 changes: 14 additions & 1 deletion src/OpenTracing/Propagation/BuiltinFormats.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace OpenTracing.Propagation
using System.IO;

namespace OpenTracing.Propagation
{
public static class BuiltinFormats
{
Expand All @@ -25,6 +27,17 @@ public static class BuiltinFormats
/// <seealso cref="TextMap"/>
public static readonly IFormat<ITextMap> HttpHeaders = new Builtin<ITextMap>("HTTP_HEADERS");

/// <summary>
/// The 'Binary' format allows for unconstrained byte encoding of <see cref="ISpanContext"/> state
/// for <see cref="ITracer.Inject{TCarrier}"/> and <see cref="ITracer.Extract{TCarrier}"/> using a <see cref="MemoryStream"/>.
/// Note that this should be considered experimental, and subject to change.
/// </summary>
/// <seealso cref="ITracer.Inject{TCarrier}"/>
/// <seealso cref="ITracer.Extract{TCarrier}"/>
/// <seealso cref="IFormat{TCarrier}"/>
/// <seealso cref="byte"/>
public static readonly IFormat<Stream> Binary = new Builtin<Stream>("BINARY");

private struct Builtin<TCarrier> : IFormat<TCarrier>
{
private readonly string _name;
Expand Down

0 comments on commit 4b1c14c

Please sign in to comment.