Observability Setup for Self-Hosted Deployments
This guide explains how to configure logging levels and enable OpenTelemetry for comprehensive observability in your self-hosted Databrain deployment.Log Level Configuration
Databrain supports configurable log levels to help with troubleshooting. By default, the log level is set toinfo.
Available Log Levels
| Level | Description |
|---|---|
error | Only error messages |
warn | Warnings and errors |
info | Informational messages, warnings, and errors (default) |
debug | All messages including detailed debug information |
Configuration
Add to your.env file:
OpenTelemetry Integration
Databrain supports OpenTelemetry (OTel) for distributed tracing and metrics. This enables you to:- Track API latency for all endpoints
- Monitor error rates
- See processing time breakdowns (database queries, external API calls, etc.)
- Correlate logs with traces for easier debugging
Prerequisites
To use OpenTelemetry, you need an OTLP-compatible collector or backend. Popular options include:- Self-hosted: SigNoz, Jaeger, Grafana Tempo
- Cloud: Datadog, New Relic, Honeycomb, or any OTLP-compatible backend
Configuration
Add these environment variables to your.env file:
Docker Compose Setup
If you want to run an OpenTelemetry Collector alongside Databrain, uncomment the collector service in yourdocker-compose.yml:
Example: Collector Configuration for Jaeger
Create anotel-config.yaml file:
What Gets Instrumented
When OpenTelemetry is enabled, Databrain automatically instruments:| Component | What’s Tracked |
|---|---|
| HTTP Requests | Incoming API requests with latency, status codes |
| Express Routes | Route-level timing and errors |
| PostgreSQL | Database query duration and errors |
| Redis | Cache operations timing |
| Outgoing HTTP | External API calls (Hasura, Keycloak, etc.) |
Example Trace
A typical API request trace shows:Troubleshooting
Logs Not Appearing at Expected Level
- Verify
LOG_LEVELis set correctly in your.env - Restart the backend service after changing the value
- Log levels are case-insensitive (
DEBUG,debug,Debugall work)
OpenTelemetry Not Working
- Verify
OTEL_ENABLED=true(must be exactlytrue) - Check that
OTEL_EXPORTER_OTLP_ENDPOINTis reachable from the backend container - Check backend logs for
[Telemetry] OpenTelemetry initializedmessage - If you see
OTEL_ENABLED=true but OTEL_EXPORTER_OTLP_ENDPOINT not set, configure the endpoint
High Overhead Concerns
OpenTelemetry adds minimal overhead when enabled. If you experience performance issues:- Ensure your collector can handle the volume
- Consider sampling in the collector configuration
- Disable OTel temporarily by setting
OTEL_ENABLED=false
Structured Logging
Databrain uses Winston for structured, JSON-formatted logging. All logs include:- Timestamp: ISO format with milliseconds
- Level: error, warn, info, or debug
- Message: Human-readable description
- Metadata: Structured data as key-value pairs
- Trace Context: When OpenTelemetry is enabled, includes
trace_idandspan_id
Example Log Output
Usage in Code
Default Behavior (No Configuration Required)
If you don’t configure any observability settings:- Log level defaults to
info - OpenTelemetry is disabled (zero overhead)
- Logs output to stdout in JSON format
- Structured logging with Winston is always enabled

