Python Client for Yandex Cloud Monitoring
Supported Python versions
The 1.*.* release line officially supports Python 3.9–3.12 (see python_requires and classifiers in setup.py). Make sure your dependencies (especially cryptography) are installed with versions compatible with your interpreter.
PyPy - supported but starting from pypy:3.11
Installation
pip3 install python-yandex-cloud-monitoring
Getting started with Yandex Monitoring
Credentials
Service Account Keys only ...
Service Account Keys & Roles
For write metrics, add a folder role: monitoring.editor
import datetime
import random
from pyclm.monitoring import Monitoring
metrics = Monitoring(
credentials={
"service_account_key": {
"service_account_id": "....",
"id": "....",
"private_key": "<PEM>"
},
"cloudId": "<CLOUD_ID>",
"folderId": "<FOLDER_ID>"
},
group_id="default",
resource_type="....", resource_id="....",
elements=100, period=10, workers=1
)
for n in range(1000):
# Numeric value (decimal). It shows the metric value at a certain point in time.
# For example, the amount of used RAM
metrics.dgauge(
"temperature",
random.random(),
ts=datetime.datetime.now(datetime.timezone.utc),
labels={"building": "office", "room": "openspace"}
)
# Tag. It shows the metric value that increases over time.
# For example, the number of days of service continuous running.
metrics.counter("counter", n, labels={"building": "office", "room": "openspace"})
# Numeric value (integer). It shows the metric value at a certain point in time.
metrics.igauge("number", n, labels={"building": "office", "room": "openspace"})
# Derivative value. It shows the change in the metric value over time.
# For example, the number of requests per second.
metrics.rate("rate", random.random(), labels={"building": "office", "room": "openspace"})
credentials.cloudId - The ID of the cloud that the resource belongs to.
credentials.folderId - The ID of the folder that the resource belongs to.
resource_type - Resource type, serverless.function, hostname. Value must match the regular expression ([a-zA-Z][-a-zA-Z0-9_.]{0,63})?.
resource_id - Resource ID, i.e., ID of the function producing metrics. Value must match the regular expression ([a-zA-Z0-9][-a-zA-Z0-9_.]{0,63})?.
elements - The number of elements before writing, must be in the range 1-100.
period - Number of seconds to wait for new log entries before writing.
workers - Number of process ingestion.
timeout - Timeouts HTTP requests.
Timeouts can be configured via the timeout argument:
from pyclm.monitoring import Monitoring
metrics = Monitoring(
credentials={...},
group_id="default",
resource_type="...",
resource_id="...",
elements=100,
period=10,
workers=1,
timeout=(3, 5), # (connect_timeout, read_timeout) in seconds
)
By default, timeout=(3, 5) is used for all outgoing HTTP requests (connection timeout 3 seconds, read timeout 5 seconds).
Metadata
Release files for python-yandex-cloud-monitoring 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| python_yandex_cloud_monitoring-1.0.1.tar.gz | 20.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| python_yandex_cloud_monitoring-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 39.4 kB
Release files / python_yandex_cloud_monitoring-1.0.1.tar.gz
| Download URL | python_yandex_cloud_monitoring-1.0.1.tar.gz |
|---|---|
| Size | 20.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b68ca40d2898bde202c2cc50483efd79891083f0bd7c23042f08aa52dbb98405
|
|
BLAKE2b-256 checksum How to use checksums |
8c9036cfc36fa1ee334730c21c559cc778fea6ac79b55dd90bf55e2524699eee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.3
|
Release files / python_yandex_cloud_monitoring-1.0.1-py3-none-any.whl
| Download URL | python_yandex_cloud_monitoring-1.0.1-py3-none-any.whl |
|---|---|
| Size | 18.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ffe9786de7966894d6c43e5809547fb6454488e73c5e5bce6f93e13971b88d2f
|
|
BLAKE2b-256 checksum How to use checksums |
8bb0a073162678ba3780956691d90c5ebf3254296263f42c5e683e90ca57bdf3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.3
|