Implement observability and circuit breaker for identity service#1653
Open
SurbhiAgarwal1 wants to merge 1 commit into
Open
Implement observability and circuit breaker for identity service#1653SurbhiAgarwal1 wants to merge 1 commit into
SurbhiAgarwal1 wants to merge 1 commit into
Conversation
Contributor
|
@SurbhiAgarwal1 thanks a lot for openning this PR. |
Contributor
|
Hi @SurbhiAgarwal1 , I think you introduced in this PR changes concerning auditable identities that are not relevant here. Please, revert those changes. Thanks 🙏 |
…erledger-labs#1644) Signed-off-by: SurbhiAgarwal1 <agarwalsurbhi1807@gmail.com>
Contributor
Author
|
Hey @adecaro @AkramBitar, I’ve cleaned up the history as you suggested. Would appreciate a look when you have a moment! 🙏 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR implements observability (metrics) and a lightweight, in-memory circuit breaker for the identity service in
token/services/identity. These enhancements improve the resilience and monitorability of the service under load and failure conditions.Fixes: #1644
Changes
1. Metrics Instrumentation
IdentityMetricsstruct intoken/services/identity/metrics.go.metrics.Provider:identity_requests_total(Counter): Total number of identity requests.identity_errors_total(Counter): Total number of identity errors.identity_request_latency_ms(Histogram): Request latency in milliseconds.identity_inflight_requests(Gauge): Number of concurrent requests.identity.Provider. Metrics are collected at the start of each call to ensure even rejected requests are tracked.2. Circuit Breaker
CircuitBreakerintoken/services/identity/cb.go.3. Provider Integration
identity.Providerto support optional metrics and circuit breaker initialization via functional options (WithMetrics,WithCircuitBreaker).Allow()check and failure/success recording.driver.IdentityProviderinterface.4. Testing
token/services/identity/observability_test.gowith unit tests covering:Verification Results
All tests in the identity service package passed successfully: