-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add metrics for inbound HTTP requests (#97)
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: ``` inbound_request_count{code="200",method="GET",path=".../deploymentManagers/-"} 56 ``` For example, these are some metrics generated by the deployment manager server: ``` inbound_request_count{code="500",method="GET",path="/o2ims-infrastructureInventory/-/deploymentManagers"} 4 inbound_request_duration_bucket{code="500",method="GET",path="/o2ims-infrastructureInventory/-/deploymentManagers",le="0.1"} 0 inbound_request_duration_bucket{code="500",method="GET",path="/o2ims-infrastructureInventory/-/deploymentManagers",le="1"} 0 inbound_request_duration_bucket{code="500",method="GET",path="/o2ims-infrastructureInventory/-/deploymentManagers",le="10"} 0 inbound_request_duration_bucket{code="500",method="GET",path="/o2ims-infrastructureInventory/-/deploymentManagers",le="30"} 0 inbound_request_duration_bucket{code="500",method="GET",path="/o2ims-infrastructureInventory/-/deploymentManagers",le="+Inf"} 4 inbound_request_duration_sum{code="500",method="GET",path="/o2ims-infrastructureInventory/-/deploymentManagers"} 602.541828752 inbound_request_duration_count{code="500",method="GET",path="/o2ims-infrastructureInventory/-/deploymentManagers"} 4 ``` Signed-off-by: Juan Hernandez <[email protected]>
- Loading branch information
Showing
17 changed files
with
2,575 additions
and
31 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.