Skip to main content

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 to info.

Available Log Levels

Configuration

Add to your .env file:
To enable debug logging for troubleshooting:

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:

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 your docker-compose.yml:
Then update your backend environment:

Example: Collector Configuration for Jaeger

Create an otel-config.yaml file:

What Gets Instrumented

When OpenTelemetry is enabled, Databrain automatically instruments:

Example Trace

A typical API request trace shows:

Troubleshooting

Logs Not Appearing at Expected Level

  1. Verify LOG_LEVEL is set correctly in your .env
  2. Restart the backend service after changing the value
  3. Log levels are case-insensitive (DEBUG, debug, Debug all work)

OpenTelemetry Not Working

  1. Verify OTEL_ENABLED=true (must be exactly true)
  2. Check that OTEL_EXPORTER_OTLP_ENDPOINT is reachable from the backend container
  3. Check backend logs for [Telemetry] OpenTelemetry initialized message
  4. 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:
  1. Ensure your collector can handle the volume
  2. Consider sampling in the collector configuration
  3. 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_id and span_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
This maintains backward compatibility with existing deployments.