Explain why prometheus-exporter marks an endpoint unavailable - #916
Open
maoueh wants to merge 2 commits into
Open
Explain why prometheus-exporter marks an endpoint unavailable#916maoueh wants to merge 2 commits into
maoueh wants to merge 2 commits into
Conversation
Classify every failed poll into a reason (connect, connect_timeout,
invalid_request, request_timeout, stream_error, stale_block, no_data),
exposed on a new substreams_healthcheck_failure_count{reason,grpc_code}
counter and carried in the logs.
Give connection establishment its own --connect-timeout budget, separate
from --timeout: gRPC dials lazily, so DNS, TLS and load-balancer
resolution used to be charged to the request timeout and a slow
connection was reported as an endpoint failure. Report the two phases
separately as connect_duration_ms and stream_duration_ms.
Log every failed poll, not only the transition into unavailable, and log
a block age above half of --max-freshness so an alert on block_age_ms is
no longer silent. Add a consecutive_failures gauge and reset block_age_ms
to NaN when a poll returns no block.
Speak sf.substreams.rpc.v4.Stream/Blocks only, dropping the v3-to-v2
fallback that closed the connection and then kept reading from it.
--force-protocol-version now accepts only v4 and is validated at startup.
Fix a panic on inconsistent label cardinality when endpoints carry
different sets of query-parameter labels.
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.
An alert firing on
substreams_healthcheck_statusgave no way to tell an unreachable endpoint from an unauthenticated, overloaded or merely late one, and a flapping endpoint could produce no logs at all. This adds a failure taxonomy, separates connection setup from the request, and logs every failed poll.Every failure is classified into a
reason(connect,connect_timeout,invalid_request,request_timeout,stream_error,stale_block,no_data), exposed on a newsubstreams_healthcheck_failure_count{reason,grpc_code}counter and carried in the logs. Metrics are declared throughdmetrics.Connection establishment gets its own
--connect-timeout(default 10s), separate from--timeout, which now covers theBlocksrequest alone. gRPC dials lazily, so DNS/TLS/LB resolution was previously charged to the request budget and a slow connection was reported as an endpoint failure — the source of thewaiting for new LB policy update: context deadline exceedederrors. The exporter now waits for the channel to beREADYfirst, and reportssubstreams_healthcheck_connect_duration_msandsubstreams_healthcheck_stream_duration_msseparately;substreams_healthcheck_duration_mskeeps its old meaning of the two combined. Both deadlines carry a cause, so the error names which budget was exceeded instead of sayingcontext deadline exceeded.Every failed poll is logged, not just the transition into
unavailable, with reason, gRPC code, both durations and the consecutive failure count; recovery logs the downtime and how many polls failed. A block age above half of--max-freshnessis logged too, so an alert onsubstreams_healthcheck_block_age_msis no longer silent.New
substreams_healthcheck_consecutive_failuresgauge to alert on instead ofstatuswhen single-poll hiccups should be ignored, andblock_age_msnow resets toNaNwhen a poll returns no block instead of reporting the age of the last block ever seen.The exporter speaks
sf.substreams.rpc.v4.Stream/Blocksonly. The v3-to-v2 fallback is removed — it closed the connection and then kept reading from it — and--force-protocol-versionaccepts only4(or0), kept for the protocol versions to come; an invalid value is now rejected at startup instead of being silently ignored.Fixes a panic on inconsistent label cardinality when endpoints are given different sets of query-parameter labels.
Verified end-to-end against the live fleet with a real API key: the v4 success path works on
mainnet.ethandmainnet.sol, andconnect_timeout,stream_error/Unauthenticated,stale_block, the half-freshness notice, theNaNblock-age reset and the version-flag rejection were each exercised.