Skip to content

Commit fde914c

Browse files
authored
Merge pull request #10 from pgodowski/master
Add sample of metrics exposed by the app and description of each of them
2 parents b46927f + 1292a81 commit fde914c

File tree

1 file changed

+42
-1
lines changed

1 file changed

+42
-1
lines changed

README.md

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,52 @@ 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
22+
23+
## Exposed Prometheus metrics
24+
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.
37+
38+
```
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
58+
# HELP version Version information about this binary
59+
# TYPE version gauge
60+
version{version="v0.3.0"} 1
61+
```

0 commit comments

Comments
 (0)