open-telemetry / open-telemetry/opentelemetry-java-instrumentation
Add Resilience4j circuit breaker support to Java auto-instrumentation
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 2.6k
- Forks
- 1.2k
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 228
Description
Is your feature request related to a problem? Please describe.
Resilience4j circuit breakers currently aren't surfaced by the Java agent's auto-instrumentation.
When debugging a request that goes through a circuit breaker, it would be useful to have visibility into whether a circuit breaker was involved and its state directly in the trace. This is especially useful when trying to distinguish an actual downstream failure from a request that was short-circuited by Resilience4j.
Describe the solution you'd like
I'd like to see auto-instrumentation support for Resilience4j circuit breakers.
At a minimum, it would be useful to expose information such as:
- circuit breaker name
- circuit breaker state (
CLOSED,OPEN,HALF_OPEN, etc.)
I'm not sure whether these are best represented as span attributes, events, or something else based on existing OpenTelemetry semantic conventions, so I'd be happy to follow whatever approach makes the most sense here. In my opinion, span attributes make the most sense.
I'm also happy to contribute the implementation if there is interest in adding this.
Describe alternatives you've considered
This can be implemented today with custom/manual instrumentation or application-specific hooks into Resilience4j, but it would be nice to have this available out of the box when using the Java agent rather than requiring every application to instrument it independently.
Possible telemetry model
I'm not strongly opinionated on the exact modeling here, but as a starting
point I could see the instrumentation enriching the relevant span with
Resilience4j circuit breaker information, for example:
resilience4j.circuit_breaker.nameresilience4j.circuit_breaker.state- an indication that execution was rejected/short-circuited by the circuit breaker
Summary
Being able to see something like the circuit breaker name and current state alongside the trace is surprisingly useful when debugging resilience/failure behavior.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the Java agent's existing auto-instrumentation patterns for library integrations and any Resilience4j entry points. Review current OpenTelemetry conventions for representing circuit-breaker name, state, and rejected execution before choosing the telemetry model. Done means Resilience4j circuit breakers are automatically surfaced in traces with tested name, state, and short-circuit information.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- observability
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100