Monitoring & Observability
This guide explains how to monitor your DataBridge usage, track performance metrics, and set up observability for your applications.
OpenTelemetry Integration
DataBridge uses OpenTelemetry for comprehensive distributed tracing and metrics collection. This provides detailed insights into system performance and behavior.
Configuration
DataBridge automatically configures OpenTelemetry based on your environment:
from databridge import DataBridge
# Development mode (writes to local files)
db = DataBridge("your-uri", is_local=True)
# Writes to:
# - logs/telemetry/traces.log
# - logs/telemetry/metrics.log
# Production mode (uses OTLP exporters)
db = DataBridge("your-uri")
# Exports to configured OpenTelemetry collectorResource Attributes
All telemetry data includes standard resource attributes:
service.name: "databridge-core"Custom attributes for your application
Traces
Every operation in DataBridge is automatically traced, including:
Document ingestion
Semantic search queries
Completion requests
Authentication flows
Each trace includes:
Operation type
User ID
Duration
Status (success/error)
Custom metadata
Example of using traces:
Metrics
DataBridge automatically collects key metrics:
Operation Counts (
databridge.operations)Description: "Number of operations performed"
Tagged with operation type and status
Counter metric type
Helps monitor usage patterns
Token Usage (
databridge.tokens)Description: "Number of tokens processed"
Tagged with operation type
Counter metric type
Essential for cost monitoring
Operation Duration (
databridge.operation.duration)Description: "Duration of operations"
Unit: milliseconds
Tagged with operation type
Histogram metric type
Helps identify performance issues
Example of accessing metrics:
Local Development Mode
When running in local development mode (is_local=True), telemetry data is written to log files:
Local Trace Format
Traces are written as JSON objects with the following structure:
Local Metric Format
Metrics are written as JSON objects with the following structure:
Production Monitoring
In production environments, DataBridge exports telemetry data through OpenTelemetry exporters:
Trace Export
Uses OTLP (OpenTelemetry Protocol)
BatchSpanProcessor for efficient export
Includes detailed operation context
Supports distributed tracing
Metric Export
Uses OTLP (OpenTelemetry Protocol)
PeriodicExportingMetricReader (60-second intervals)
Cumulative aggregation temporality
Supports standard monitoring systems
Example configuration:
Usage Analytics
Track detailed usage patterns programmatically:
Health Checks
Implement comprehensive health monitoring:
Common Monitoring Patterns
Operation Tracking
Usage Monitoring
Performance Tracking
Next Steps
After setting up monitoring:
Configure alerting thresholds
Set up visualization dashboards
Implement automated health checks
Monitor usage patterns
Optimize based on metrics
Last updated