-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Open
Description
Specifically these -
- IGrainTimerInvoker/InvokeCallbackAsync
- IDeploymentLoadPublisher/UpdateRuntimeStatistics
- IMembershipService/Ping
these traces are part of the orleans core runtime and not something interesting.
I still want to collect the traces for custom grains I create. (I believe it's the same trace).
We could inject a configuration object with list of activity names to trace -
| var activity = source.StartActivity(context.Request.GetActivityName(), ActivityKind.Client); |
these are especially annoying when running locally, these traces make it hard to see other traces
basically make this conditional.
introduce
public class ActivityPropagationOptions
{
public string[] ActivityNamesToSkip { get; set; } = [];
} internal class ActivityPropagationOutgoingGrainCallFilter : ActivityPropagationGrainCallFilter, IOutgoingGrainCallFilter
{
private readonly DistributedContextPropagator _propagator;
+ private readonly IOptions<ActivityPropagationOptions> _options;
/// <summary>
/// Initializes a new instance of the <see cref="ActivityPropagationOutgoingGrainCallFilter"/> class.
/// </summary>
/// <param name="propagator">The context propagator.</param>
- public ActivityPropagationOutgoingGrainCallFilter(DistributedContextPropagator propagator)
+ public ActivityPropagationOutgoingGrainCallFilter(DistributedContextPropagator propagator, IOptions<ActivityPropagationOptions> options)
{
_propagator = propagator;
+ _options = options;
}
/// <inheritdoc />
public Task Invoke(IOutgoingGrainCallContext context)
{
var source = GetActivitySource(context);
+ if (options.ActivityNamesToSkip.Contains(context.Request.GetActivityName()))
+ {
+ return context.Invoke();
+ }
var activity = source.StartActivity(context.Request.GetActivityName(), ActivityKind.Client);
if (activity is null)
{
return context.Invoke();
}
_propagator.Inject(activity, null, static (carrier, key, value) => RequestContext.Set(key, value));
return Process(context, activity);
}
}Metadata
Metadata
Assignees
Labels
No labels