Repository navigation
fix(telemetry): retry idle connection failures - #99
Merged
Merged
Conversation
Generated-by: LLM effort=high;harness=codex:0.166.0;model=openai:gpt-6.2-sol;session=sha-256-64:01b1b8c921aa92f9;surface=exec
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.
Why
A collector or proxy can close an idle connection at about the same time as the next scheduled metric export. A reset or end-of-file then loses that interval's data point (D-R4).
Behavior change
The exporter closes idle HTTP connections after 45 seconds. If an export fails with a connection reset or end-of-file, it retries that export once within the original deadline and returns any error from the retry.
Decisions
The exporter uses a clone of Go's default HTTP transport. A small exporter wrapper handles the retry because OpenTelemetry's retry option treats end-of-file as terminal and sets a time budget rather than an attempt limit.
Deviations from the task
The requested custom client takes precedence over OpenTelemetry's HTTP timeout and certificate environment settings. The client uses Go's system trust store and the SDK's export deadline.
Needs human judgment
Check whether any collector deployment depends on an OpenTelemetry certificate or timeout setting.
Risk
If the collector accepts an export and the connection closes before the client receives its response, the retry can deliver the same cumulative data point twice.
Verification
bazelisk run //:gazelleandbazelisk run //:formatcompleted.bazelisk test //:golangci_lint_test --test_output=errorspassed.bazelisk test --test_output=errors -- //... -//:gitleaks_test -//:zizmor_testpassed. The deploy test passed on macOS, and Bazel skipped the Windows workspace status test. The run instructions excluded the two security scans.bazelisk run @tbhb_rules//lint:pr_size -- origin/main HEADreportedpr_size: code=135/400 raw=176/1500.Human steering
The brief specified the 45-second idle timeout and capped connection-error recovery at one retry.
Assisted-by: LLM effort=medium;harness=claude-code:2.1.330;model=anthropic:claude-sonnet-5-5;session=sha-256-64:6507fa80a17e0653;surface=cli