Skip to content

📈 Update resolver metrics and tracking for all endopints - #42

Merged
bilalebi merged 1 commit into
mainfrom
improve-metrics-reliability-p2
Aug 11, 2026
Merged

bilalebi merged 1 commit into
mainfrom
improve-metrics-reliability-p2

Conversation

@bilalebi

Copy link
Copy Markdown
Contributor

Extend resolver outcome metrics across all resolver endpoints

This PR is the continuation of #41

Summary

Extends product-level Prometheus outcome metrics beyond the legacy URL resolver so monitoring consistently reflects resolver behaviour across the service.
The resolver now exposes:

resolver_requests_total{endpoint, outcome, response_mode}

This complements existing HTTP metrics. HTTP status continues to describe the protocol response, while outcome describes whether the resolver achieved an expected product result.

Endpoint coverage

Endpoint family endpoint label
/legacy legacy_url
/id/{stable_id} stable_id
/rapid/... rapid
/rapid/id/{stable_id} rapid_stable_id

Outcomes

Outcome Meaning
resolved A current Ensembl destination or resolver result was found
archive_fallback A legacy request was redirected to an Ensembl archive
interstitial A browser received the expected legacy URL interstitial (404)
not_found The request was valid but no destination or result exists
invalid_request The input could not be processed, for example an invalid Rapid accession
internal_error An unexpected application, configuration, or dependency error occurred

response_mode distinguishes browser/HTML and JSON/API responses.

Why

Raw HTTP 4xx metrics do not accurately represent resolver health:

HTTP 404 on a legacy browser interstitial
≠
Resolver failure

This metric lets Grafana distinguish expected product outcomes—such as archive fallbacks and interstitials—from genuine internal failures.

Dashboard guidance

Use outcome metrics for resolver-health panels and alerts:

sum(
  increase(resolver_requests_total{
    namespace="ensembl-prod",
    service="resolver-api-svc",
    outcome="internal_error"
  }[$__range])
)

Example overall successful-outcome rate:

(
  sum(
    increase(resolver_requests_total{
      namespace="ensembl-prod",
      service="resolver-api-svc",
      outcome=~"resolved|archive_fallback|interstitial"
    }[$__range])
  )
  /
  sum(
    increase(resolver_requests_total{
      namespace="ensembl-prod",
      service="resolver-api-svc"
    }[$__range])
  )
) * 100

Raw HTTP metrics should remain available for traffic and protocol diagnostics, including framework-level responses such as 405 Method Not Allowed, which do not enter resolver route handlers.

Additional change

Simplified the Rapid invalid-accession error path so each request records exactly one invalid_request outcome, without changing its HTTP behaviour.

@bilalebi bilalebi self-assigned this Aug 11, 2026
@bilalebi
bilalebi merged commit 5ecc6ca into main Aug 11, 2026
5 checks passed
@bilalebi
bilalebi deleted the improve-metrics-reliability-p2 branch October 26, 2026 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants