-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Allow changing the severity of resilience events #2072
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
Changes from 1 commit
b0c45fb
9f2e775
d628953
58f404f
8f03c19
ec9e2b9
e3e9748
8178123
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -134,4 +134,36 @@ public override void Enrich<TResult, TArgs>(in EnrichmentContext<TResult, TArgs> | |
| } | ||
|
|
||
| #endregion | ||
|
|
||
| public static void SeverityOverrides() | ||
| { | ||
| var services = new ServiceCollection(); | ||
|
|
||
| #region telemetry-severity-override | ||
|
|
||
| services.AddResiliencePipeline("my-strategy", (builder, context) => | ||
| { | ||
| // Create a new instance of telemetry options by using copy-constructor of the global ones. | ||
| // This ensures that common configuration is preserved. | ||
| var telemetryOptions = new TelemetryOptions(context.GetOptions<TelemetryOptions>()); | ||
|
|
||
| telemetryOptions.SeverityProvider = ev => | ||
martintmk marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| { | ||
| if (ev.EventName == "OnRetry") | ||
|
||
| { | ||
| // Decrease the severity of particular event. | ||
| return ResilienceEventSeverity.Debug; | ||
| } | ||
|
|
||
| return ev.Severity; | ||
martincostello marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| }; | ||
|
|
||
| builder.AddTimeout(TimeSpan.FromSeconds(1)); | ||
|
|
||
| // Override the telemetry configuration for this pipeline. | ||
| builder.ConfigureTelemetry(telemetryOptions); | ||
| }); | ||
|
|
||
| #endregion | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.