Implement observability and circuit breaker for identity service#1653
Implement observability and circuit breaker for identity service#1653SurbhiAgarwal1 wants to merge 2 commits into
Conversation
|
@SurbhiAgarwal1 thanks a lot for openning this PR. |
|
Hi @SurbhiAgarwal1 , I think you introduced in this PR changes concerning auditable identities that are not relevant here. Please, revert those changes. Thanks 🙏 |
ef90c5e to
238e95f
Compare
|
Hey @adecaro @AkramBitar, I’ve cleaned up the history as you suggested. Would appreciate a look when you have a moment! 🙏 |
|
First I would like to thank you a lot for working on that PR. Regards, |
Signed-off-by: SurbhiAgarwal1 <agarwalsurbhi1807@gmail.com>
12fb523 to
addf3eb
Compare
Signed-off-by: SurbhiAgarwal1 <agarwalsurbhi1807@gmail.com>
|
Hello @SurbhiAgarwal1, I would like to thank you for your efforts on this PR. I really appreciate your contribution. Hello @adecaro, I would like to ask your help with this PR. Could you please review it once you will be back from your vacation? Thanks a million, |
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: