Python Client for Yandex Cloud Monitoring
Project description
Python Client for Yandex Cloud Monitoring
Supported Python versions
The 0.1.* release line officially supports Python 3.6–3.8 (see python_requires and classifiers in setup.py). Make sure your dependencies (especially cryptography) are installed with versions compatible with your interpreter.
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).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file python_yandex_cloud_monitoring-0.1.0.tar.gz.
File metadata
- Download URL: python_yandex_cloud_monitoring-0.1.0.tar.gz
- Upload date:
- Size: 20.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
13c52ab5c328d8899e429886218b7a8c5af5a88dac9d0e913f537da15e6f1b7f
|
|
| MD5 |
c0e34d61f3cd325ce7eafa96f5105574
|
|
| BLAKE2b-256 |
e268b0e2a69225637a8a8a83ae90e31eeddeca1951f436b1d176010aa61d982c
|
File details
Details for the file python_yandex_cloud_monitoring-0.1.0-py3-none-any.whl.
File metadata
- Download URL: python_yandex_cloud_monitoring-0.1.0-py3-none-any.whl
- Upload date:
- Size: 18.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0776dff5d954b1ea11f1721597fd9f40228d28a571371288f87c165b4adf6d16
|
|
| MD5 |
9cac2572df82984616113d87178ef68a
|
|
| BLAKE2b-256 |
24ab5e7b72cf9581270f7bffe7fba0d4eabee06f2640c546249934488bf87001
|