[Microsoft.Extensions.Http.Resilience] Circuit-breakers and SelectPipelineByAuthority confusion
- Dominant language
- C#
- Stars
- 3.2k
- Forks
- 894
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 23
Description
Hey there,
I recently [raised an issue](https://github.com/dotnet/extensions/issues/5463#issuecomment-2391919828) relating to the mechanism of being able to monitor circuit-breaker state and manual control, as I felt (and still feel) that the API doesn't really lend itself to being able to do this for a number of discrete dependencies that you want to monitor separately.
I worked around this by following the guidance and defining separate pipelines for each dependency, which allowed me to configure distinct instances of `CircuitBreakerStateProvider` and `CircuitBreakerManualControl`. That all works fine.
However, I've just hit another edge case, in that one of our dependencies has a dynamic base URL that we only resolve at runtime. It looks something like this:
`https://some.downstreamservice.{cell}.com/`
We query another service on behalf of the client, which tells us which `cell` value to use for a subsequent request.
This all works fine from an `HttpClient` point of view, but I wanted to be sure that the circuit breaker isn't shared across all instances, i.e. if the circuit is opened for `https://some.downstreamservice.A.com/` then it should not also open for `https://some.downstreamservice.B.com/`.
I gather from the documentation that the answer to this is using `SelectPipelineByAuthority`.
Where I'm confused is: how can I query circuit-breaker state for each "instance"? I feel like there's a missing API to be able to inspect pipeline state, rather than supplying these instances as part of configuration?
Once again though, there's also a high chance that I'm missing the real answer - but I've struggled to find anything relevant in the docs.
Thanks, again, in advance!
Contributor guide
Assessment
This issue has not been assessed yet.