Add metrics for inbound HTTP requests #97
Merged
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.
This patch adds to all the servers a metrics server that provides the default metrics generated by the Prometheus Go instrumentation library as well as metrics for the number of duration of inbound HTTP requests.
The metrics handler will listen by default in port 8001, but that can be changed with the following options:
--metrics-listener-address
- Metrics listen address. (default "localhost:8001")--metrics-listener-tls-crt
- Metrics TLS certificate in PEM format.--metrics-listener-tls-key
- Metrics TLS key in PEM format.The metrics generated are the following:
inbound_request_count
- Number of API requests sent.inbound_inbound_request_duration_sum
- Total time to send API requests, in seconds.inbound_inbound_request_duration_count
- Total number of API requests measured.inbound_inbound_request_duration_bucket
- Number of API requests organized in buckets.With the following labels:
method
- Name of the HTTP method, for example GET or POST.path
- Request path, for example /api/my/v1/resources.code
- HTTP response code, for example 200 or 500.In order to reduce the cardinality of the metrics the path label is modified to remove the identifiers of the objects. For example, if the original path is
.../deploymentManagers/123
then it will be replaced by.../deploymentManagers/-
, and the values will be accumulated. The line returned by the metrics server will be like this:For example, these are some metrics generated by the deployment manager server: