Skip to content

feat(proxy): add the service to the proxy metrics - #3521

Open
pbleser-oc wants to merge 1 commit into
opencloud-eu:mainfrom
pbleser-oc:feat/add-service-to-proxy-metrics
Open

feat(proxy): add the service to the proxy metrics#3521
pbleser-oc wants to merge 1 commit into
opencloud-eu:mainfrom
pbleser-oc:feat/add-service-to-proxy-metrics

Conversation

@pbleser-oc

Copy link
Copy Markdown
Member

Description

Improve the metrics for the proxy service.

  • extend the instrumenter middleware to add a label with the name of the service the request is being dispatched to
  • add a native Prometheus histogram that tracks the durations and also includes a label for the name of the service the request is being dispatched to, as well as a result label (success, client-error, server-error) based on the HTTP status code of the response
  • add per-service gauge functions to count the number of in-flight requests
  • add a counter for routing failures, for when an inbound request cannot be mapped to a route
  • extend the route.RoutingInfo struct with a service attribute, and a Service() getter
  • remove the routing_failure_count metric, as it is redundant

Important

Changes labels of metrics, removes a metric, adds new metrics.
Existing Grafana panels that use the opencloud_proxy_* metrics will need to be adapted accordingly.

Motivation and Context

More detailed metrics will allow for better introspection of a running production installment, in order to determine if something is slow, and what, by being able to drill down by service and not just with global metrics that do not differentiate.

How Has This Been Tested?

Manually by checking the resulting metrics when querying the /metrics endpoint of the debug address, as well as with a Prometheus scraping container.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests only (no source changes)

Only a breaking change for consumers of the proxy metrics, such as Grafana panels.

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation added

Improve the metrics for the proxy service.

 * extend the instrumenter middleware to add a label with the name of
   the service the request is being dispatched to

 * add a native Prometheus histogram that tracks the durations and also
   includes a label for the name of the service the request is being
   dispatched to, as well as a 'result' label ('success',
   'client-error', 'server-error') based on the HTTP status code of the
   response

 * add per-service gauge functions to count the number of in-flight
   requests

 * add a counter for routing failures, for when an inbound request
   cannot be mapped to a route

 * extend the route.RoutingInfo struct with a service attribute, and a
   Service() getter

 * remove the 'routing_failure_count' metric, as it is redundant
@codacy-production

codacy-production Bot commented Sep 11, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 5 complexity

Metric Results
Complexity 5

View in Codacy

🟢 Coverage 7.51% diff coverage · -0.03% coverage variation

Metric Results
Coverage variation -0.03% coverage variation (-1.00%)
Diff coverage 7.51% diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (994086c) 88539 20995 23.71%
Head commit (025063d) 88660 (+121) 20998 (+3) 23.68% (-0.03%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#3521) 173 13 7.51%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

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

Projects

Status: Qualification

Development

Successfully merging this pull request may close these issues.

1 participant