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

Infrastructure for telemetry #1066

Closed
martintmk opened this issue Mar 20, 2023 · 1 comment
Closed

Infrastructure for telemetry #1066

martintmk opened this issue Mar 20, 2023 · 1 comment
Assignees
Labels
v8 Issues related to the new version 8 of the Polly library.
Milestone

Comments

@martintmk
Copy link
Contributor

martintmk commented Mar 20, 2023

We want to expose an infrastructure for telemetry. This way, individual resilience strategies can report important events in a unified way. The Polly consumers can hook to these events and build monitoring and dashboard on top.

We can consider something like:

public abstract class ResilienceTelemetry
{
    void Report(string eventName, ResilienceContext context);

    void Report<T>(string eventName, T result, ResilienceContext context);

    void Report(string eventName, Exception exception, ResilienceContext context);
}

public abstract class ResilienceTelemetryFactory
{
    ResilienceTelemetry Create(ResilienceTelemetryContext context);
}

public class ResilienceStrategyBuilderContext
{
    // new property
    public ResilienceTelemetry Telemetry { get; }
}

public class ResilienceStrategyBuilderOptions
{
    // new property
    public ResilienceTelemetryFactory TelemetryFactory { get; set; } = NullResilienceTelemetryFactory.Instance;
}

Customer can provide their own implementation of ResilienceTelemetryFactory. We can consider having built-in ResilienceTelemetryFactory based on .NET Meter and ILoggerFactory.

The ResilienceTelemetryFactory.Create is called for each resilience strategy individually and with different context.

@martintmk martintmk converted this from a draft issue Mar 20, 2023
@martintmk martintmk added this to the v8.0.0 milestone Mar 20, 2023
@martintmk martintmk added the v8 Issues related to the new version 8 of the Polly library. label Mar 20, 2023
@martintmk martintmk moved this from Todo to In Progress in Polly v8 Mar 21, 2023
@martintmk martintmk moved this from In Progress to Done in Polly v8 Mar 21, 2023
@martintmk
Copy link
Contributor Author

The API was simplified in #1112 and it is now using DiagnosticSource internally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v8 Issues related to the new version 8 of the Polly library.
Projects
No open projects
Status: Done
Development

No branches or pull requests

1 participant