fix: separate nginx_up availability from scrape success #978 #1202
+238
−9
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.
Problem
Fixes #978
The
nginx_upmetric currently indicates whether the last scrape was successful, not whether NGINX is actually up. This creates confusion for users who expectnginx_up=0to mean NGINX is down, when it could just mean the scrape failed for other reasons (HTTP errors, parsing issues, etc.).Solution
This PR introduces a clear separation between NGINX availability and scrape success for NGINX Open Source:
New Metrics Added:
nginx_scrape_success- Indicates whether the last scrape was successful (1) or not (0)nginx_scrape_duration_seconds- Duration of the last scrape in secondsnginx_scrape_errors_total{type="..."}- Counter of scrape errors by type (network/http/parse)Behavior Changes:
nginx_up=1- NGINX is reachable (even if scrape fails due to HTTP errors)nginx_up=0- Only when NGINX is truly unreachable (network errors)nginx_scrape_success=0- When scrape fails for any reasonError Type Classification:
network- Connection refused, timeouts, etc. (nginx_up=0)http- HTTP errors like 404, 500, etc. (nginx_up=1)parse- Response parsing errors (nginx_up=1)Scope
Testing
Backward Compatibility
The existing
nginx_upmetric is preserved but now correctly represents NGINX availability rather than scrape success.