Skip to content

Commit 1292a81

Browse files
authored
added example of provided metrics and sample
1 parent c9d8307 commit 1292a81

File tree

1 file changed

+33
-2
lines changed

1 file changed

+33
-2
lines changed

README.md

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,51 @@ A Docker image is available at: `quay.io/brancz/prometheus-example-app:v0.3.0`
1010

1111
First, deploy one instance of this example application, which listens and exposes metrics on port 8080 using the following [Deployment manifest](manifests/deployment.yaml).
1212

13-
Then, in order for Prometheus to be able to discover and scrape these metrics, in this repository we provide [Pod Monitor][prometheus-operator-crd] custom resource as an example. For that, Prometheus Operator needs to be running in the cluster. To install it, follow this guide: [quickstart][prometheus-operator-quickstart].
13+
Then, in order for Prometheus to be able to discover and scrape these metrics, in this repository we provide [Pod Monitor][prometheus-operator-crd] custom resource as an example. For that, [Prometheus Operator][prometheus-operator] needs to be running in the cluster. To install it, follow this guide: [quickstart][prometheus-operator-quickstart].
1414

1515
For this example application, [PodMonitor manifest](manifests/pod-monitor.yaml) describes how the metrics can be discovered and scrapped by Prometheus.
1616

1717
[prometheus]:https://prometheus.io/
1818
[client-golang]:https://github.com/prometheus/client_golang
19+
[prometheus-operator]:https://github.com/prometheus-operator/prometheus-operator
1920
[prometheus-operator-quickstart]:https://github.com/coreos/prometheus-operator#quickstart
2021
[prometheus-operator-crd]:https://github.com/coreos/prometheus-operator#customresourcedefinitions
2122

2223
## Exposed Prometheus metrics
2324

24-
This example app exposed the following data over the `/metrics` API, resulting with the `version` metric being collected and exposed in Prometheus.
25+
The following metrics are exposed:
26+
27+
- `version` - of type _gauge_ - containing the app version - as a constant metric value `1` and label `version`, representing this app version
28+
- `http_requests_total` - of type _counter_ - representing the total numbere of incoming HTTP requests
29+
- `http_request_duration_seconds` - of type _histogram_, representing duration of all HTTP requests
30+
- `http_request_duration_seconds_count`- total count of all incoming HTTP requeests
31+
- `http_request_duration_seconds_sum` - total duration in seconds of all incoming HTTP requests
32+
- `http_request_duration_seconds_bucket` - a histogram representation of the duration of the incoming HTTP requests
33+
34+
The sample output of the `/metric` endpoint after 5 incoming HTTP requests shown below.
35+
36+
Note: with no initial incoming request, only `version` metric is reported.
2537

2638
```
39+
# HELP http_request_duration_seconds Duration of all HTTP requests
40+
# TYPE http_request_duration_seconds histogram
41+
http_request_duration_seconds_bucket{code="200",handler="found",method="get",le="0.005"} 5
42+
http_request_duration_seconds_bucket{code="200",handler="found",method="get",le="0.01"} 5
43+
http_request_duration_seconds_bucket{code="200",handler="found",method="get",le="0.025"} 5
44+
http_request_duration_seconds_bucket{code="200",handler="found",method="get",le="0.05"} 5
45+
http_request_duration_seconds_bucket{code="200",handler="found",method="get",le="0.1"} 5
46+
http_request_duration_seconds_bucket{code="200",handler="found",method="get",le="0.25"} 5
47+
http_request_duration_seconds_bucket{code="200",handler="found",method="get",le="0.5"} 5
48+
http_request_duration_seconds_bucket{code="200",handler="found",method="get",le="1"} 5
49+
http_request_duration_seconds_bucket{code="200",handler="found",method="get",le="2.5"} 5
50+
http_request_duration_seconds_bucket{code="200",handler="found",method="get",le="5"} 5
51+
http_request_duration_seconds_bucket{code="200",handler="found",method="get",le="10"} 5
52+
http_request_duration_seconds_bucket{code="200",handler="found",method="get",le="+Inf"} 5
53+
http_request_duration_seconds_sum{code="200",handler="found",method="get"} 0.00047495999999999997
54+
http_request_duration_seconds_count{code="200",handler="found",method="get"} 5
55+
# HELP http_requests_total Count of all HTTP requests
56+
# TYPE http_requests_total counter
57+
http_requests_total{code="200",method="get"} 5
2758
# HELP version Version information about this binary
2859
# TYPE version gauge
2960
version{version="v0.3.0"} 1

0 commit comments

Comments
 (0)