-
Notifications
You must be signed in to change notification settings - Fork 185
Adding notifications support for various lifecycle conditions #595
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
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
razumau
reviewed
Nov 3, 2025
razumau
reviewed
Nov 3, 2025
Thomascountz
reviewed
Nov 3, 2025
feb3f26 to
d473fbd
Compare
razumau
reviewed
Nov 6, 2025
razumau
reviewed
Nov 6, 2025
Thomascountz
reviewed
Nov 6, 2025
10af0f4 to
5b7644a
Compare
Co-authored-by: Thomas Countz <thomascountz@gmail.com> Applications can configure any instrumentation backend that responds to #instrument(event_name, payload), e.g. ActiveSupport::Notifications Example: ZendeskAPI.configure do |config| config.instrumentation = ActiveSupport::Notifications end Events: zendesk.request: - When: All requests (emitted regardless of status code) - Payload: duration (ms), endpoint, method, status zendesk.rate_limit: - When: Status < 500 AND rate limit headers present - Not emitted for: 5xx errors, missing headers - Payload: endpoint, status, remaining, limit, reset - Note: Includes successful requests and 4xx errors when rate limit headers are present zendesk.cache_hit: - When: 304 Not Modified served from cache - Requires: Cache enabled, matching ETag - Payload: endpoint, status (304) zendesk.cache_miss: - When: 200 OK with ETag cached for future requests - Requires: Cache enabled, ETag header present - Payload: endpoint, status (200) zendesk.retry: - When: Before retry sleep (429, 503, or exception) - Requires: Retry enabled; exceptions need retry_on_exception: true - Payload: attempt (starts at 1), endpoint, method, delay (seconds), reason - Reasons: "rate_limited" (429), "server_error" (503), "exception" (network failures) Key assumptions/decisions: - Users must supply their own compatible config.instrumentation, this lib does not pull in activesupport - duration reports round-trip time including network call and response processing middleware - Rate limit events only for status < 500 (client/rate limit errors) - Request events emitted for all requests (not filtered by status) - Instrumentation failures logged at debug level or silently swallowed
5b7644a to
b4a5fd0
Compare
razumau
approved these changes
Nov 7, 2025
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.
Allows applications to configure any instrumentation backend that responds to
#instrument(event_name, payload), e.g.ActiveSupport::NotificationsUsage
Instrumentation Events
zendesk.requestduration(ms),endpoint,method,statuszendesk.rate_limitendpoint,status,remaining,limit,resetzendesk.cache_hit304 Not Modifiedserved from cacheendpoint,status(304)zendesk.cache_miss200 OKwith ETag cached for future requestsendpoint,status(200)zendesk.retry429,503, or exception)retry_on_exception: trueattempt(starts at 1),endpoint,method,delay(seconds),reason"rate_limited"(429),"server_error"(503),"exception"(network failures)Key assumptions/decisions
config.instrumentation, this lib does not pull inactivesupportdurationreports round-trip time including network call and response processing middleware500(client/rate limit errors)