feat(proxy): add the service to the proxy metrics - #3521
Open
pbleser-oc wants to merge 1 commit into
Open
Conversation
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
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 5 |
🟢 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 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.
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 redundantImportant
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
/metricsendpoint of the debug address, as well as with a Prometheus scraping container.Types of changes
Only a breaking change for consumers of the proxy metrics, such as Grafana panels.
Checklist: