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.1.0

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.1.0
File Size Uploaded Provenance Actions
monium_sdk-1.1.0.tar.gz 15.9 kB Without provenance Details for monium_sdk-1.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 33.6 kB

Release files / monium_sdk-1.1.0.tar.gz

Download URL monium_sdk-1.1.0.tar.gz
Size 15.9 kB
Tags Source
SHA-256 checksum
How to use checksums
c0a2e3c30665847c2007538f879cc5f8601a950da9dc5826578e41dd41ca1efc
BLAKE2b-256 checksum
How to use checksums
cb73ef5a88d01adc435ad0e207d4a127496e208bc37dd4914fdb0433bfbe2e17
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.1.0-py3-none-any.whl

Download URL monium_sdk-1.1.0-py3-none-any.whl
Size 17.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ad2068474a98c27b5c03b540bec6b85fa327691321a5b138d78eefc26d5ed866
BLAKE2b-256 checksum
How to use checksums
eff3179035a21a3a398e2ea62276c15971f4929880f6100fdf436f91d7300459
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.1.0

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