feat(proxy): add the service to the proxy metrics - #3521
Open
pbleser-oc wants to merge 2 commits into
Open
Conversation
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 5 |
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.
pbleser-oc
force-pushed
the
feat/add-service-to-proxy-metrics
branch
2 times, most recently
from
September 14, 2026 08:17
1ae07d0 to
689ef9e
Compare
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
pbleser-oc
force-pushed
the
feat/add-service-to-proxy-metrics
branch
from
September 14, 2026 08:18
689ef9e to
0deca84
Compare
…ics for compatibility * re-add the metrics that were existing prior to this PR, to keep them for compatibility reasons with existing Grafana panels: - opencloud_proxy_requests_total - opencloud_proxy_errors_total - opencloud_proxy_duration_seconds * renamed new metric opencloud_proxy_request_total (that contains the service label) to opencloud_proxy_service_request_total * renamed new metric opencloud_proxy_duration_seconds (that contains the service label) to opencloud_proxy_service_duration_seconds
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.
Description
Improve the metrics for the proxy service.
instrumentermiddleware to add a label with the name of the service the request is being dispatched toresultlabel (success,client-error,server-error) based on the HTTP status code of the responseRoutingInfostruct with aserviceattribute, and aService()getterrouting_failure_countmetric, as it is redundantAdded metrics:
opencloud_proxy_request_duration_seconds{service=..., method=..., result=...}(native histogram)opencloud_proxy_service_request_total{service=..., method=..., result=...}(counter)opencloud_proxy_service_duration_seconds{service=..., method=..., result=...}(legacy histogram)The labels:
method: is the HTTP method (GET, ...)result: maps the HTTP response status code to one of three values to reduce the cardinality, eithersuccess(0-399),client-error(400-499),server-error(500-)success: is the service identifier, e.g.eu.opencloud.web.webdav,eu.opencloud.web.graph, ...Note
Previously existing metrics have been kept as-is, backwards compatibility is retained.
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
/metricsendpoint of the debug address, as well as with a Prometheus scraping container.Types of changes
Checklist: