Stop SSE reconnect resets from panicking; add staleness metrics#7
Open
ewokndor wants to merge 2 commits into
Open
Stop SSE reconnect resets from panicking; add staleness metrics#7ewokndor wants to merge 2 commits into
ewokndor wants to merge 2 commits into
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
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.
Symptom:
Recurring error logs {"StreamID":N,"Code":2} ~every 20 min, with the service panicking (and restarting) roughly hourly.
Root cause:
hermes.pyth.network sits behind Cloudflare, which periodically resets the HTTP/2 stream (INTERNAL_ERROR, connection left intact) every ~5–12 min by design — confirmed by reproducing it with plain curl (cf-ray header =
Cloudflare). Two client bugs turned that benign reset into noise + crashes:
So every log line was a real disconnect (~20 min apart); the num_retries 1/2/3 ladder was independent disconnects accumulating toward the panic, not retries of one event.
What we changed (hermes/):
Alerting:
gauges live in the caller. Export time.Since(LastFeedPublishTime(id)) per feed as NoPriceUpdateSince{feed=...}; one Prometheus rule (> 30s) fans out per feed automatically. Plus a global backstop from LastStreamUpdate().
Net effect:
error-log spam and hourly panics gone; reconnects are visible but quiet; stale prices now trip a metric alert regardless of why updates stopped.