Skip to content

Conversation

@aaaTurbo
Copy link

Problem

Fixes #978

The nginx_up metric currently indicates whether the last scrape was successful, not whether NGINX is actually up. This creates confusion for users who expect nginx_up=0 to 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 seconds
  • nginx_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 reason

Error 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

⚠️ This fix applies only to NGINX Open Source collector. NGINX Plus collector remains unchanged. A separate issue can address NGINX Plus if needed.

Testing

  • Added comprehensive unit tests for error classification logic
  • Tested with various scenarios:
    • Normal operation (nginx_up=1, scrape_success=1)
    • HTTP errors (nginx_up=1, scrape_success=0)
    • Network errors (nginx_up=0, scrape_success=0)

Backward Compatibility

The existing nginx_up metric is preserved but now correctly represents NGINX availability rather than scrape success.

@aaaTurbo aaaTurbo requested a review from a team as a code owner November 18, 2025 19:45
@nginx-bot
Copy link

nginx-bot bot commented Nov 18, 2025

Hi @aaaTurbo! Welcome to the project! 🎉

Thanks for opening this pull request!
Be sure to check out our Contributing Guidelines while you wait for someone on the team to review this.

@nginx-bot nginx-bot bot added the community Issues or PRs opened by an external contributor label Nov 18, 2025
@github-actions
Copy link

github-actions bot commented Nov 18, 2025

✅ All required contributors have signed the F5 CLA for this PR. Thank you!
Posted by the CLA Assistant Lite bot.

@aaaTurbo
Copy link
Author

I have hereby read the F5 CLA and agree to its terms

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community Issues or PRs opened by an external contributor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

nginx_up metric name is misleading

1 participant