Skip to content
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

Propagators Support #54465

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,25 @@ public sealed class ActivityListener : IDisposable
public System.Diagnostics.SampleActivity<string>? SampleUsingParentId { get { throw null; } set { throw null; } }
public System.Diagnostics.SampleActivity<ActivityContext>? Sample { get { throw null; } set { throw null; } }
public void Dispose() { throw null; }
}
}


public abstract class TextMapPropagator
{
public delegate bool PropagatorGetterCallback(object carrier, string fieldName, out string? value);
public abstract System.Collections.Generic.IReadOnlyCollection<string> Fields { get; }
public abstract bool Inject(System.Diagnostics.Activity activity, object carrier, Action<object, string, string> setter);
public abstract bool Inject(System.Diagnostics.ActivityContext context, object carrier, Action<object, string, string> setter);
public abstract bool Inject(System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string, string?>> baggage, object carrier, Action<object, string, string> setter);
public abstract bool Extract(object carrier, PropagatorGetterCallback getter, out string? id, out string? state);
public abstract bool Extract(object carrier, PropagatorGetterCallback getter, out System.Diagnostics.ActivityContext context);
public abstract bool Extract(object carrier, PropagatorGetterCallback getter, out System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string, string?>>? baggage);
public static TextMapPropagator DefaultPropagator { get; set; }
public static TextMapPropagator CreateLegacyPropagator() { throw null; }
public static TextMapPropagator CreatePassThroughPropagator() { throw null; }
public static TextMapPropagator CreateOutputSuppressionPropagator() { throw null; }
public static TextMapPropagator CreateW3CPropagator() { throw null; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As an implementation detail, these should be caching a single instance IMO (each is allocating a HashSet internally so it's not just an empty object)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is implementation details. We can cache the instances we return if needed. I didn't bother in the protype to go to that level.

}
}

namespace System.Diagnostics.Metrics
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
<Compile Include="System\Diagnostics\Metrics\ObservableCounter.cs" />
<Compile Include="System\Diagnostics\Metrics\ObservableGauge.cs" />
<Compile Include="System\Diagnostics\Metrics\ObservableInstrument.cs" />
<Compile Include="System\Diagnostics\TextMapPropagator.cs" />
<None Include="ActivityUserGuide.md" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'">
Expand Down
Loading