Skip to main content

Configuration

Connecting to Observatory

ConsumerObserver, ProducerObserver, and HttpTelemetrySink all take the same two values:

ParameterWhat it is
observatory_urlYour Observatory API URL
api_keyAn API key scoped to telemetry

These are plain constructor arguments. The SDK doesn't require specific environment variable names, so use whatever convention fits your service (env vars, a secrets manager, your existing settings system). Throughout these docs we use OBSERVATORY_URL and OBSERVATORY_API_KEY as that convention:

import os
from pymidil.event.observability import ConsumerObserver

observe = ConsumerObserver(
observatory_url=os.environ["OBSERVATORY_URL"],
api_key=os.environ["OBSERVATORY_API_KEY"],
consumer="orders-worker",
broker="kafka",
)

Automatic telemetry settings

If you're using the event runtime's built-in telemetry wiring rather than constructing a sink yourself, these environment variables configure it directly:

VariableDefaultWhat it controls
MIDIL_TELEMETRY_ENABLEDtrueTurn telemetry reporting on or off entirely
MIDIL_TELEMETRY_SINKstdoutWhere telemetry goes: http (to Observatory), stdout (local logging, useful in development), or null (disabled)
MIDIL_TELEMETRY_SOURCE_SERVICEunknown-serviceThe service name reported with every event
MIDIL_TELEMETRY_BROKER(unset)A default broker label, if not set per-hook
MIDIL_TELEMETRY_INCLUDE_PAYLOADtrueWhether event payloads are included, or only metadata
MIDIL_TELEMETRY_HTTP_ENDPOINT(unset)Your Observatory API URL, required when MIDIL_TELEMETRY_SINK=http
MIDIL_TELEMETRY_HTTP_API_KEY(unset)Your API key, required when MIDIL_TELEMETRY_SINK=http

Set MIDIL_TELEMETRY_SINK=stdout (the default) while developing locally so you can see the telemetry envelopes your service would send, without needing an Observatory account yet. Then switch to http once you're ready to see them in the dashboard.