Configuration
Connecting to Observatory
ConsumerObserver, ProducerObserver, and HttpTelemetrySink all take the same two values:
| Parameter | What it is |
|---|---|
observatory_url | Your Observatory API URL |
api_key | An 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:
| Variable | Default | What it controls |
|---|---|---|
MIDIL_TELEMETRY_ENABLED | true | Turn telemetry reporting on or off entirely |
MIDIL_TELEMETRY_SINK | stdout | Where telemetry goes: http (to Observatory), stdout (local logging, useful in development), or null (disabled) |
MIDIL_TELEMETRY_SOURCE_SERVICE | unknown-service | The service name reported with every event |
MIDIL_TELEMETRY_BROKER | (unset) | A default broker label, if not set per-hook |
MIDIL_TELEMETRY_INCLUDE_PAYLOAD | true | Whether 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.