Use DBOS With Logfire
Pydantic Logfire is an observability platform built on OpenTelemetry that makes it easy to monitor your application.
This guide shows how to configure your DBOS application to export OpenTelemetry traces and logs to Logfire.
Installation and Requirements
First, set up your Logfire account by following the instructions here.
Next, generate a write token so your application can push data to Logfire.
Then, set the OTEL_EXPORTER_OTLP_HEADERS
environment variable to include your token:
export OTEL_EXPORTER_OTLP_HEADERS='Authorization=your-write-token'
If you're deploying your app on DBOS Cloud, make sure to set OTEL_EXPORTER_OTLP_HEADERS
in your application's environment variables.
Configure DBOS OpenTelemetry Export
Configure your DBOS application to enable OpenTelemetry traces and export them to Logfire:
- Python
- Typescript
dbos_config: DBOSConfig = {
"name": "my-app",
"otlp_traces_endpoints": ["https://logfire-us.pydantic.dev/v1/traces"],
"otlp_logs_endpoints": ["https://logfire-us.pydantic.dev/v1/logs"],
"enable_otlp": True,
}
DBOS(config=dbos_config)
DBOS.setConfig({
name: 'my-app',
otlpTracesEndpoints: ["https://logfire-us.pydantic.dev/v1/traces"],
otlpLogsEndpoints: ["https://logfire-us.pydantic.dev/v1/logs"],
enableOTLP: true,
});
await DBOS.launch();
This page shows https://logfire-us.pydantic.dev as the base URL which is for the US region. If you are using the EU region, use https://logfire-eu.pydantic.dev instead.
Now start your DBOS application. You should see your logs and traces appear on the Logfire dashboard!
For more details on using Logfire instrumentation with your application, see the Pydantic Logfire documentation.