Skip to content

Commit 6e0eb37

Browse files
committed
Move all the docs to readthedocs
1 parent 6c313b1 commit 6e0eb37

File tree

3 files changed

+3
-83
lines changed

3 files changed

+3
-83
lines changed

README.md

Lines changed: 1 addition & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -2,90 +2,10 @@
22
Prometheus summary with quantiles over configurable sliding time window
33

44
## Installation
5-
65
```
7-
pip install prometheus-summary==0.1.5
6+
pip install prometheus-summary==0.1.6
87
```
98
This package can be found on [PyPI](https://pypi.org/project/prometheus-summary/).
109

1110
## Documentation
1211
Documentation is available on https://prometheus-summary.readthedocs.io/en/latest/.
13-
14-
## Collecting
15-
16-
### Basic usage
17-
18-
```python
19-
from prometheus_summary import Summary
20-
21-
s = Summary("request_latency_seconds", "Description of summary")
22-
s.observe(4.7)
23-
```
24-
25-
### Usage with labels
26-
27-
```python
28-
from prometheus_summary import Summary
29-
30-
s = Summary("request_latency_seconds", "Description of summary", ["method", "endpoint"])
31-
s.labels(method="GET", endpoint="/profile").observe(1.2)
32-
s.labels(method="POST", endpoint="/login").observe(3.4)
33-
```
34-
35-
### Usage with custom quantiles and precisions
36-
37-
By default, metrics are observed for the following (quantile, precision (inaccuracy)) pairs:
38-
39-
`((0.50, 0.05), (0.90, 0.01), (0.99, 0.001))`
40-
41-
You can also provide your own values when creating the metric.
42-
43-
```python
44-
from prometheus_summary import Summary
45-
46-
s = Summary(
47-
"request_latency_seconds", "Description of summary",
48-
invariants=((0.50, 0.05), (0.75, 0.02), (0.90, 0.01), (0.95, 0.005), (0.99, 0.001)),
49-
)
50-
s.observe(4.7)
51-
```
52-
53-
### Usage with custom time window settings
54-
55-
Typically, you don't want to have a Summary representing the entire runtime of the application,
56-
but you want to look at a reasonable time interval. This Summary metric implement a configurable sliding time window.
57-
58-
The default is a time window of 10 minutes and 5 age buckets, i.e. the time window is 10 minutes wide, and
59-
we slide it forward every 10 / 5 = 2 minutes, but you can configure this values for your own purposes.
60-
61-
```python
62-
from prometheus_summary import Summary
63-
64-
s = Summary(
65-
"request_latency_seconds", "Description of summary",
66-
# time window 5 minutes wide with 10 age buckets (sliding every 30 seconds)
67-
max_age_seconds=5 * 60,
68-
age_buckets=10,
69-
)
70-
s.observe(4.7)
71-
```
72-
73-
## Querying
74-
75-
Suppose we have a metric:
76-
77-
```python
78-
from prometheus_summary import Summary
79-
80-
s = Summary("request_latency_seconds", "Description of summary", ["method", "endpoint"])
81-
```
82-
83-
To show request latency by `method`, `endpoint` and `quantile` use the following PromQL query:
84-
```
85-
max by (method, endpoint, quantile) (request_latency_seconds)
86-
```
87-
88-
To show only 99-th quantile:
89-
```
90-
max by (method, endpoint) (request_latency_seconds{quantile="0.99"})
91-
```

docs/source/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Installation
99

1010
.. code-block:: console
1111
12-
pip install prometheus-summary==0.1.5
12+
pip install prometheus-summary==0.1.6
1313
1414
This package can be found on `PyPI <https://pypi.org/project/prometheus-summary/>`_.
1515

prometheus_summary/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.1.5"
1+
__version__ = "0.1.6"

0 commit comments

Comments
 (0)