Skip to main content

Monium

This library is designed for working with Monium from Yandex Cloud. It provides a simplified way to write logs and metrics. Internally, it uses the OpenTelemetry protocol.

Performance

  • The library uses asynchronous calls to obtain IAM tokens and API keys. Renewal and deletion are also performed asynchronously.
  • API keys are cached. If any existing key contains the required set of roles, that key is returned. In other words, the role set of an existing key must include the role set of the requested key.
  • Token validation runs as a background process, so it does not block the main execution flow.

Security

Several security measures are implemented:

  1. IAM token rotation. Tokens have a short lifespan — 1 hour by default — after which they become invalid and are automatically renewed.
  2. API key rotation. Each API key is created with the minimum required permissions requested by the user. When the key expires, it is deleted from the cloud and a new one is created.
  3. Automatic metadata detection. If the program is running on a Yandex Cloud VM, the library automatically obtains the IAM token from the VM metadata.

Usage

First, configure the class for token management:

from monium_sdk.security import ServiceAccountConfigData, Tokens

config = ServiceAccountConfigData(
    service_account_id="Service account ID",
    private_key="Private key for the service account",
    key_id="Key ID"
)

# If you are using a file downloaded from Yandex Cloud, you can specify it:

config_path = ServiceAccountConfigData(
    patch="path/to/file"
)

Tokens.service_account_config = config_path

After that, you can use all the library's functionality:

import asyncio
from monium_sdk import Telemetry

async def test():
    
    # Set configuration for log collection
    Telemetry.project = "folder__*****"
    Telemetry.service = "your service"
    Telemetry.cluster = "test"
    
    # Start the background process to refresh local providers.
    # This is needed to update keys and tokens.
    Telemetry.init()
    
    # Collect logs
    Telemetry.log.info("msg")
    Telemetry.log.error("msg for error")
    
    # Collect metrics
    Telemetry.metric.add_to_counter()


if __name__ == "__main__":
    # An active event loop is required for the library to work
    asyncio.run(test())

Metadata

Release files for monium-sdk 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for monium-sdk 1.0.1
File Size Uploaded Provenance Actions
monium_sdk-1.0.1.tar.gz 15.4 kB Without provenance Details for monium_sdk-1.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for monium-sdk 1.0.1
File Interpreter ABI Platform Actions
monium_sdk-1.0.1-py3-none-any.whl Python 3 none any Details for monium_sdk-1.0.1-py3-none-any.whl

Total release size: 32.0 kB

Release files / monium_sdk-1.0.1.tar.gz

Download URL monium_sdk-1.0.1.tar.gz
Size 15.4 kB
Tags Source
SHA-256 checksum
How to use checksums
3e4322996e8c2cd9be2a0a1069f68caca1eca2eadfe8fef2da1a7709087e2975
BLAKE2b-256 checksum
How to use checksums
53d986c0a25a7879ef749e0fbd517bb08ebd11c6d03129d8635131c034235df8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / monium_sdk-1.0.1-py3-none-any.whl

Download URL monium_sdk-1.0.1-py3-none-any.whl
Size 16.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
538304d881d39c87b0103d0fe16972b4f4dd993e3f566be5a03559fcdc2e722b
BLAKE2b-256 checksum
How to use checksums
a4b9a5deb3c9cacfb324ab2801ebbd8dd1eb4174fee7eb10665b5e49745285d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for monium-sdk 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page