Add structured retry observability and metrics hooks #3782
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.
Describe your changes
RetryEventlogs for client and throttled retries, with optional metrics callback gated byretry_metrics_enabled.Checklists
Compatibility checklist
Release checklist
modal_version/__init__.py) has been updated with the next logical versionChangelog
retry_metrics_enabled.Note
Introduce structured
RetryEventlogging and optional metrics callback for gRPC retries, gated by newretry_metrics_enabledconfig; add tests and a Windows protoc plugin runner.RetryEventdataclass and_emit_retry_eventfor structured INFO logs with extras (attempt, delay, status, throttled, idempotency key)._grpc_status_labelhelper andregister_retry_metrics_callbackto capture retry events whenconfig.get("retry_metrics_enabled")is true._retry_transient_errorsto emit events for both server-throttled and client retries.retry_metrics_enabledsetting/env (MODAL_RETRY_METRICS_ENABLED) and document it inmodal/config.py.test/grpc_utils_test.py.protoc_plugin/plugin_runner.bat.Written by Cursor Bugbot for commit 0a61279. This will update automatically on new commits. Configure here.