Metadata-Version: 2.4
Name: monium-sdk
Version: 1.2.0
Summary: Описание вашей утилиты
Author-email: ivan13821 <safarovi670@gmail.com>
License: MIT
Project-URL: Homepage, https://github.com/ivan13821/Monium
Project-URL: Repository, https://github.com/ivan13821/Monium
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: aiohappyeyeballs>=2.7.1
Requires-Dist: aiohttp>=3.14.3
Requires-Dist: aiosignal>=1.4.0
Requires-Dist: attrs>=26.1.0
Requires-Dist: certifi>=2026.7.22
Requires-Dist: cffi>=2.1.1
Requires-Dist: charset-normalizer>=3.5.1
Requires-Dist: cryptography>=50.0.1
Requires-Dist: Deprecated>=1.3.1
Requires-Dist: frozenlist>=1.8.0
Requires-Dist: googleapis-common-protos>=1.75.2
Requires-Dist: grpcio>=1.83.0
Requires-Dist: grpcio-tools>=1.81.1
Requires-Dist: idna>=3.19
Requires-Dist: multidict>=6.7.1
Requires-Dist: opentelemetry-api>=1.44.0
Requires-Dist: opentelemetry-exporter-otlp>=1.44.0
Requires-Dist: opentelemetry-exporter-otlp-proto-common>=1.44.0
Requires-Dist: opentelemetry-exporter-otlp-proto-grpc>=1.44.0
Requires-Dist: opentelemetry-exporter-otlp-proto-http>=1.44.0
Requires-Dist: opentelemetry-proto>=1.44.0
Requires-Dist: opentelemetry-sdk>=1.44.0
Requires-Dist: opentelemetry-semantic-conventions>=0.65b0
Requires-Dist: propcache>=0.5.2
Requires-Dist: protobuf>=6.33.6
Requires-Dist: pycparser>=3.0
Requires-Dist: PyJWT>=2.13.0
Requires-Dist: requests>=2.34.2
Requires-Dist: setuptools>=84.0.0
Requires-Dist: six>=1.17.0
Requires-Dist: typing_extensions>=4.16.0
Requires-Dist: urllib3>=2.7.0
Requires-Dist: wrapt>=2.3.0
Requires-Dist: yandexcloud>=0.404.0
Requires-Dist: yarl>=1.24.5
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: black; extra == "dev"
Requires-Dist: flake8; extra == "dev"
Dynamic: license-file

# 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.
This is not the official Monium library from Yandex Cloud.

## 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, you need to provide the data for connection.:

```python
from monium_sdk.security import ApiKey, IAMToken

key = ApiKey(
    secret="secret"
)

# or

key = IAMToken(
    secret="secret"
)


```

After that, you can use all the library's functionality:
```python
import asyncio
from monium_sdk import Telemetry
from monium_sdk.security import ApiKey

def test():
    
    key = ApiKey(
        secret="secret"
    )
    
    with Telemetry.logging_start(
        key=key,
        project="folder__<folder_id>",
        service="<service>",
        cluster="<cluster>"
    ) as res:
        Telemetry.log.info("first message")
        Telemetry.log.error("error")
        Telemetry.metric.add_to_counter(count=5)


if __name__ == "__main__":
    test()
```
