Comments (10)
If the EventSeverityOverrides is exposed as an IDictionary then you can not enforce the usage of the TryGetValue inside the user provided delegate. People could still use the indexer.
It's either delegate or dictionary. I am gravitating towards using the delegate to override the severity (defaults to null) due to greater flexibility. In our code we would just invoke the delegate (if provided) just before logging/metering and it would change the severity for that event.
With either solution, it'd be great if it could be applied to specific pipelines (as opposed to globally).
You can explicitly call ConfigureTelemetry
and it will override the telemetry just for that pipeline. Note about cloning the default options.
services.AddResiliencePipeline("my-key", (builder, context) =>
{
builder.AddConcurrencyLimiter(10);
// Resolve pre-configured options
var global = context.GetOptions<TelemetryOptions>();
var copy = new TelemetryOptions(global);
// Modify the copy
...
// Apply telemetry just for this pipeline
builder.ConfigureTelemetry(copy);
});
Alternatively, we can allow ConfigureTelemetry
to accept multiple options and it would merge them together transparently (without doing the cloning stuff).
from polly.
As far as I'm aware, as you've indicated, there's no way to change the severities at this time. It seems a reasonable suggestion to be able to allow this to be customised though.
from polly.
Thinking we could introduce something like this:
public class TelemetryOptions
{
// ... existing properties
public IDictionary<string, ResilienceEventSeverity> EventSeverityOverrides { get; set; }
}
BY default, it would be empty. If specified one could override the built-in severity for events. Also, I think we can downgrade the OnRejected
to Warning
. Error seems too high indeed.
Usage:
services.Configure<TelemetryOptions>(options =>
{
options.EventSeverityOverrides["OnRateLimiterRejected"] = ResilienceEventSeverity.Information;
});
from polly.
Constants or not, we wouldn't get exceptions because we'd use TryGetValue()
not the indexer.
from polly.
☝🏻 seems a bit error-prone. Non-existing key overrides would result in KeyNotFoundException
.
Introducing hierarchical constants might be a better option IMHO.
options.EventSeverityOverrides[TelemetryNames.RateLimiter.OnRejected] = ResilienceEventSeverity.Information;
from polly.
Since this is for advanced scenarios, the user can put whatever strings they want into the dictionary. If the name does not match up with existing telemetry events, we won't do any overrides.
Alternatively, we can allow delegate to be used (faster API and more flexible):
public class TelemetryOptions
{
// ... existing properties
public Func<ResilienceEvent, ResilienceEventSeverity>? ResilienceEventSeverityProvider { get; set; }
}
from polly.
The delegate would be more flexible because it could conditionally change the severity based on other properties of the event. The static dictionary would be okay, too, though. With either solution, it'd be great if it could be applied to specific pipelines (as opposed to globally).
from polly.
Constants or not, we wouldn't get exceptions because we'd use
TryGetValue()
not the indexer.
If the EventSeverityOverrides
is exposed as an IDictionary
then you can not enforce the usage of the TryGetValue
inside the user provided delegate. People could still use the indexer.
from polly.
This issue is stale because it has been open for 60 days with no activity. It will be automatically closed in 14 days if no further updates are made.
from polly.
not stale
from polly.
Related Issues (20)
- how to use it for retry but not fault situation? HOT 10
- [Question]: Circuit Breaker: Using BreakDurationGenerator to implement exponential backoff of open to half-open state HOT 1
- [Question]: Polly v8.2.0 how to use AddRetry and AddFallback methods HOT 16
- Simmy API Review and Feedback HOT 32
- [Feature request]: Adding Polly.Telemetry event for being out of retries HOT 4
- [Question]: Is Polly compatible with Unity ? HOT 2
- [Question]: HOT 1
- [Question]: Complex Pipeline Keys documentation example not working as expected HOT 2
- [Question]: Migration from HOT 4
- [Bug]: Retry doesn't happen with FakeTimerProvider.Advance HOT 5
- [Feature request]: Integrate / add support for Lunar Proxy (backend resilience strategy) HOT 3
- [Question]: How can I suppress Execution Attempt log when using Polly V8 ResiliencePipelineBuilder? HOT 2
- [Bug]: ResiliencePipeline CircuitBreaker doesn't handle Half Open State Correctly when probing call throws unhandeled exception - half open state can never be left again HOT 8
- [Question]: Combine WaitAndRetry with WaitAndRetryForever HOT 6
- [Feature request]: Add TimeProvider argument to resilience extension methods HOT 5
- [Feature request]: Add AddStrategy API with no options HOT 3
- [Feature request]: No explicit timeout in new regex functionality HOT 1
- [Question]: DelegateResult.Result with Policy.HandleResult. HOT 6
- [Question]: Request services from `AddTransientHttpErrorPolicy` HOT 2
- Refresh Authorization Code on When.All (causing multiple refresh authentications) HOT 14
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from polly.