Skip to content

Commit d3e1e1c

Browse files
committed
Upgrade python3-prometheus-client to v0.22.0
1 parent 8753ddc commit d3e1e1c

222 files changed

Lines changed: 2257 additions & 839 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,11 @@ workflows:
7575
matrix:
7676
parameters:
7777
python:
78-
- "3.8.18"
7978
- "3.9.18"
8079
- "3.10"
8180
- "3.11"
8281
- "3.12"
82+
- "3.13"
8383
- test_nooptionals:
8484
matrix:
8585
parameters:
@@ -89,4 +89,4 @@ workflows:
8989
matrix:
9090
parameters:
9191
python:
92-
- "3.8"
92+
- "3.9"

MANIFEST.in

Lines changed: 0 additions & 4 deletions
This file was deleted.

docs/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
.hugo_build.lock
1+
.hugo_build.lock

docs/README.md

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,32 @@
1-
Docs
2-
----
1+
# Docs
32

43
This directory contains [hugo](https://gohugo.io) documentation to be published in Github pages.
54

6-
Run Locally
7-
-----------
5+
## Dependencies
86

9-
```
7+
- [Geekdocs v1.5.0](https://github.com/thegeeklab/hugo-geekdoc/releases/tag/v1.5.0)
8+
- [Hugo v0.145.0](https://github.com/gohugoio/hugo/releases/tag/v0.145.0)
9+
10+
## Run Locally
11+
12+
To serve the documentation locally, run the following command:
13+
14+
```shell
1015
hugo server -D
1116
```
1217

1318
This will serve the docs on [http://localhost:1313](http://localhost:1313).
1419

15-
Deploy to Github Pages
16-
----------------------
17-
18-
Changes to the `main` branch will be deployed automatically with Github actions.
19-
20-
Update Geekdocs
21-
---------------
20+
## Update Geekdocs
2221

2322
The docs use the [Geekdocs](https://geekdocs.de/) theme. The theme is checked in to Github in the `./docs/themes/hugo-geekdoc/` folder. To update [Geekdocs](https://geekdocs.de/), remove the current folder and create a new one with the latest [release](https://github.com/thegeeklab/hugo-geekdoc/releases). There are no local modifications in `./docs/themes/hugo-geekdoc/`.
2423

25-
Notes
26-
-----
27-
28-
Here's how the initial `docs/` folder was set up:
29-
30-
```
31-
hugo new site docs
32-
cd docs/
24+
```shell
25+
rm -rf ./docs/themes/hugo-geekdoc
3326
mkdir -p themes/hugo-geekdoc/
34-
curl -L https://github.com/thegeeklab/hugo-geekdoc/releases/download/v0.41.1/hugo-geekdoc.tar.gz | tar -xz -C themes/hugo-geekdoc/ --strip-components=1
27+
curl -L https://github.com/thegeeklab/hugo-geekdoc/releases/latest/download/hugo-geekdoc.tar.gz | tar -xz -C themes/hugo-geekdoc/ --strip-components=1
3528
```
3629

37-
Create the initial `hugo.toml` file as described in [https://geekdocs.de/usage/getting-started/](https://geekdocs.de/usage/getting-started/).
30+
## Deploy to Github Pages
31+
32+
Changes to the `master` branch will be deployed automatically with Github actions.

docs/content/_index.md

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,49 @@
11
---
2-
title: "client_python"
2+
title: client_python
3+
weight: 1
34
---
45

5-
This is the documentation for the [Prometheus Python client library](https://github.com/prometheus/client_python).
6+
This tutorial shows the quickest way to get started with the Prometheus Python library.
7+
8+
**One**: Install the client:
9+
10+
```shell
11+
pip install prometheus-client
12+
```
13+
14+
**Two**: Paste the following into a Python interpreter:
15+
16+
```python
17+
from prometheus_client import start_http_server, Summary
18+
import random
19+
import time
20+
21+
# Create a metric to track time spent and requests made.
22+
REQUEST_TIME = Summary('request_processing_seconds', 'Time spent processing request')
23+
24+
# Decorate function with metric.
25+
@REQUEST_TIME.time()
26+
def process_request(t):
27+
"""A dummy function that takes some time."""
28+
time.sleep(t)
29+
30+
if __name__ == '__main__':
31+
# Start up the server to expose the metrics.
32+
start_http_server(8000)
33+
# Generate some requests.
34+
while True:
35+
process_request(random.random())
36+
```
37+
38+
**Three**: Visit [http://localhost:8000/](http://localhost:8000/) to view the metrics.
39+
40+
From one easy to use decorator you get:
41+
42+
* `request_processing_seconds_count`: Number of times this function was called.
43+
* `request_processing_seconds_sum`: Total amount of time spent in this function.
44+
45+
Prometheus's `rate` function allows calculation of both requests per second,
46+
and latency over time from this data.
47+
48+
In addition if you're on Linux the `process` metrics expose CPU, memory and
49+
other information about the process for free!

docs/content/exporting/pushgateway.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ weight: 3
55

66
The [Pushgateway](https://github.com/prometheus/pushgateway)
77
allows ephemeral and batch jobs to expose their metrics to Prometheus.
8+
Since Prometheus may not be able to scrape such a target, the targets can
9+
push their metrics to a separate instance of the Pushgateway,
10+
which then exposes these metrics to Prometheus.
811

912
```python
1013
from prometheus_client import CollectorRegistry, Gauge, push_to_gateway
@@ -18,16 +21,20 @@ push_to_gateway('localhost:9091', job='batchA', registry=registry)
1821
A separate registry is used, as the default registry may contain other metrics
1922
such as those from the Process Collector.
2023

21-
Pushgateway functions take a grouping key. `push_to_gateway` replaces metrics
22-
with the same grouping key, `pushadd_to_gateway` only replaces metrics with the
23-
same name and grouping key and `delete_from_gateway` deletes metrics with the
24-
given job and grouping key. See the
24+
Pushgateway functions take a grouping key.
25+
1. `push_to_gateway` replaces metrics
26+
with the same grouping key.
27+
2. `pushadd_to_gateway` only replaces metrics with the
28+
same name and grouping key.
29+
3. `delete_from_gateway` deletes metrics with the
30+
given job and grouping key.
31+
4. `instance_ip_grouping_key` returns a grouping key with the instance label set
32+
to the host's IP address.
33+
34+
See the
2535
[Pushgateway documentation](https://github.com/prometheus/pushgateway/blob/master/README.md)
2636
for more information.
2737

28-
`instance_ip_grouping_key` returns a grouping key with the instance label set
29-
to the host's IP address.
30-
3138
# Handlers for authentication
3239

3340
If the push gateway you are connecting to is protected with HTTP Basic Auth,

docs/content/getting-started/_index.md

Lines changed: 0 additions & 4 deletions
This file was deleted.

docs/content/getting-started/three-step-demo.md

Lines changed: 0 additions & 48 deletions
This file was deleted.

docs/content/multiprocess/_index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ This comes with a number of limitations:
1414
- Registering metrics to a registry later used by a `MultiProcessCollector`
1515
may cause duplicate metrics to be exported
1616
- Custom collectors do not work (e.g. cpu and memory metrics)
17+
- Gauges cannot use `set_function`
1718
- Info and Enum metrics do not work
1819
- The pushgateway cannot be used
1920
- Gauges cannot use the `pid` label

docs/hugo.toml

Lines changed: 95 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,19 @@ theme = "hugo-geekdoc"
55

66
pluralizeListTitles = false
77

8-
# Geekdoc required configuration
9-
#pygmentsUseClasses = true
10-
pygmentsUseClasses = false
8+
# Required to get well formatted code blocks
9+
pygmentsUseClasses = true
1110
pygmentsCodeFences = true
1211
disablePathToLower = true
13-
# geekdocFileTreeSortBy = "linkTitle"
12+
enableGitInfo = true
1413

1514
# Required if you want to render robots.txt template
1615
enableRobotsTXT = true
1716

18-
# Needed for mermaid shortcodes
1917
[markup]
2018
[markup.goldmark.renderer]
21-
# Needed for mermaid shortcode
19+
# Needed for mermaid shortcode or when nesting shortcodes (e.g. img within
20+
# columns or tabs)
2221
unsafe = true
2322
[markup.tableOfContents]
2423
startLevel = 1
@@ -28,3 +27,93 @@ enableRobotsTXT = true
2827

2928
[taxonomies]
3029
tag = "tags"
30+
31+
[params]
32+
# (Optional, default 6) Set how many table of contents levels to be showed on page.
33+
# Use false to hide ToC, note that 0 will default to 6 (https://gohugo.io/functions/default/)
34+
# You can also specify this parameter per page in front matter.
35+
geekdocToC = 3
36+
37+
# (Optional, default static/brand.svg) Set the path to a logo for the Geekdoc
38+
# relative to your 'static/' folder.
39+
geekdocLogo = "brand.svg"
40+
41+
# (Optional, default false) Render menu from data file in 'data/menu/main.yaml'.
42+
# See also https://geekdocs.de/usage/menus/#bundle-menu.
43+
geekdocMenuBundle = false
44+
45+
# (Optional, default false) Collapse all menu entries, can not be overwritten
46+
# per page if enabled. Can be enabled per page via 'geekdocCollapseSection'.
47+
geekdocCollapseAllSections = false
48+
49+
# (Optional, default true) Show page navigation links at the bottom of each docs page.
50+
geekdocNextPrev = true
51+
52+
# (Optional, default true) Show a breadcrumb navigation bar at the top of each docs page.
53+
# You can also specify this parameter per page in front matter.
54+
geekdocBreadcrumb = true
55+
56+
# (Optional, default none) Set source repository location. Used for 'Edit page' links.
57+
# You can also specify this parameter per page in front matter.
58+
geekdocRepo = "https://github.com/prometheus/client_python"
59+
60+
# (Optional, default none) Enable 'Edit page' links. Requires 'geekdocRepo' param
61+
# and the path must point to the parent directory of the 'content' folder.
62+
# You can also specify this parameter per page in front matter.
63+
geekdocEditPath = "edit/master/docs"
64+
65+
# (Optional, default false) Show last modification date of the page in the header.
66+
# Keep in mind that last modification date works best if `enableGitInfo` is set to true.
67+
geekdocPageLastmod = true
68+
69+
# (Optional, default true) Enables search function with flexsearch.
70+
# Index is built on the fly and might slow down your website.
71+
geekdocSearch = true
72+
73+
# (Optional, default false) Display search results with the parent folder as prefix. This
74+
# option allows you to distinguish between files with the same name in different folders.
75+
# NOTE: This parameter only applies when 'geekdocSearch = true'.
76+
geekdocSearchShowParent = true
77+
78+
# (Optional, default true) Add an anchor link to headlines.
79+
geekdocAnchor = true
80+
81+
# (Optional, default true) Copy anchor url to clipboard on click.
82+
geekdocAnchorCopy = true
83+
84+
# (Optional, default true) Enable or disable image lazy loading for images rendered
85+
# by the 'img' shortcode.
86+
geekdocImageLazyLoading = true
87+
88+
# (Optional, default false) Set HTMl <base> to .Site.Home.Permalink if enabled. It might be required
89+
# if a subdirectory is used within Hugos BaseURL.
90+
# See https://developer.mozilla.org/de/docs/Web/HTML/Element/base.
91+
geekdocOverwriteHTMLBase = false
92+
93+
# (Optional, default true) Enable or disable the JavaScript based color theme toggle switch. The CSS based
94+
# user preference mode still works.
95+
geekdocDarkModeToggle = true
96+
97+
# (Optional, default false) Auto-decrease brightness of images and add a slightly grayscale to avoid
98+
# bright spots while using the dark mode.
99+
geekdocDarkModeDim = false
100+
101+
# (Optional, default false) Enforce code blocks to always use the dark color theme.
102+
geekdocDarkModeCode = false
103+
104+
# (Optional, default true) Display a "Back to top" link in the site footer.
105+
geekdocBackToTop = true
106+
107+
# (Optional, default false) Enable or disable adding tags for post pages automatically to the navigation sidebar.
108+
geekdocTagsToMenu = true
109+
110+
# (Optional, default 'title') Configure how to sort file-tree menu entries. Possible options are 'title', 'linktitle',
111+
# 'date', 'publishdate', 'expirydate' or 'lastmod'. Every option can be used with a reverse modifier as well
112+
# e.g. 'title_reverse'.
113+
geekdocFileTreeSortBy = "title"
114+
115+
# (Optional, default none) Adds a "Content licensed under <license>" line to the footer.
116+
# Could be used if you want to define a default license for your content.
117+
[params.geekdocContentLicense]
118+
name = "Apache License 2.0"
119+
link = "https://github.com/prometheus/client_python/blob/master/LICENSE"

0 commit comments

Comments
 (0)