No description
This repository has been archived on 2026-04-20. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
Find a file
backwardspy (cl) 42f75f0419
📄 add license
2023-01-19 09:39:28 +00:00
azure_monitor_client 🎉 initial commit 2023-01-18 17:40:39 +00:00
tests 🎉 initial commit 2023-01-18 17:40:39 +00:00
.gitignore 🎉 initial commit 2023-01-18 17:40:39 +00:00
LICENSE 📄 add license 2023-01-19 09:39:28 +00:00
poetry.lock 🎉 initial commit 2023-01-18 17:40:39 +00:00
pyproject.toml 🎉 initial commit 2023-01-18 17:40:39 +00:00
README.md 🎉 initial commit 2023-01-18 17:40:39 +00:00

Azure Monitor Client

A simple async client for the Azure Monitor Data Collector API.

Minimal Usage Example

from datetime import datetime
from uuid import uuid4
import asyncio
import json

from azure_monitor_client import AzureMonitorClient

client = AzureMonitorClient(
    workspace_id=WORKSPACE_ID,
    shared_key=SHARED_KEY
)

async def send_event() -> None:
    # This is just an example of the kind of data you can send.
    # None of these fields are required.
    # For more information on data types, see:
    # https://www.stefanroth.net/2018/05/08/azure-log-analytics-get-data-types/
    payload = {
        "timestamp": datetime.utcnow().isoformat(),
        "record_uid": str(uuid()),
        "active": True,
        "fields": json.dumps({
            "name": "Jackie Welles",
            "age": 30,
        })
    }

    await client.send("AuditLog", payload)

asyncio.run(send_event())