OTEL Trace Ingestion

Publish OTEL Traces directly to your DBNL Deployment

OpenTelemetryarrow-up-right (OTEL) Trace Ingestion allows for the richest data to be uploaded to your Project, but requires some off-platform coding and does not support backfilling data. This guide provides comprehensive instructions for instrumenting your AI agent application to send OpenTelemetry (OTEL) traces to DBNL

Prerequisites

DBNL Credentials: You'll need:

  • DBNL API URL (e.g., http://localhost:8080/api)

  • API Token (Bearer token for authenticationarrow-up-right which can be generated at DBNL_API_URL/tokens)

  • Project ID (your DBNL project identifier, typically starts with proj_ and is part of the URL for your project)

circle-exclamation

You will need to install the required OpenTelemetry packages:

pip install opentelemetry-sdk>=1.20.0
pip install opentelemetry-exporter-otlp>=1.20.0

For LangChain applications, also install OpenInferencearrow-up-right instrumentation:

pip install openinference-instrumentation-langchain>=0.1.0

Implementation

Basic Setup

Create a telemetry initialization module (telemetry.py) in your application:

LangChain Integration

For LangChain applications, add OpenInference instrumentation:

Application Integration

Initialize telemetry early in your application startup:

FastAPI Example:

Standalone Script Example:

Required Trace Fields

The following fields are required regardless of which ingestion method you are using:

  • input: The text input to the LLM as a string

  • output: The text response from the LLM as a string

  • timestamp: The UTC timecode associated with the LLM call as a timestamptz

You may choose to track other attributes such as total_token_count or feedback_score which are part of the DBNL semantic convention.

Custom Attributes

You can add custom attributes for better analytics:

Advanced Configuration

Batch Processing

DBNL uses BatchSpanProcessor by default for efficient trace export. This batches spans before sending, reducing network overhead:

For immediate export (useful for debugging), use SimpleSpanProcessor:

Verification

Test Trace Export

Create a test span to verify traces are being sent:

View Traces in DBNL

After sending traces, verify they appear in your DBNL dashboard. By default, traces are processed into logs nightly so you will not see them right away.

  1. Log into your DBNL deployment and go to your project

  2. Check the Status page to confirm that they have been processed

  3. Navigate to the Explorer or Logs section

  4. Filter by your project ID or service name

  5. Verify traces are appearing with the expected attributes

Troubleshooting

Traces Not Appearing in DBNL

  1. Check Environment Variables: Verify all required variables are set:

  2. Verify API Endpoint: Test connectivity to DBNL:

  3. Check Logs: Look for DBNL exporter configuration messages:

  4. Verify URL Formatting: Ensure the endpoint is correctly formatted:

    • Format: https://{DBNL_API_URL}/otel/v1/traces

    • Example: https://api.dev.dbnl.com/otel/v1/traces

Common Issues

Issue: "DBNL configuration incomplete"

  • Solution: Ensure DBNL_API_URL, DBNL_API_TOKEN, and DBNL_PROJECT_ID are all set

Issue: "Failed to configure DBNL exporter"

  • Solution: Check that the API URL is valid and the token has proper permissions

Issue: Traces appear but missing attributes

  • Solution: Ensure you're using OpenInference semantic conventions or manually setting required attributes (input, output, timestamp)

Issue: High latency or performance impact

  • Solution: Use BatchSpanProcessor (default) instead of SimpleSpanProcessor for better performance

For issues or questions:

  1. Check the troubleshooting section above

  2. Review DBNL documentation

  3. Verify your DBNL deployment has OTEL Trace Ingestion enabled

  4. Contact DBNL support at [email protected]envelope with your project ID and API endpoint

Best Practices

  1. Use Batch Processing: Always use BatchSpanProcessor in production for better performance

  2. Use Semantic Conventions: Follow OpenInference conventions for automatic attribute mapping

  3. Error Handling: Wrap exporter creation in try-except blocks to prevent application failures

  4. Graceful Degradation: Allow your application to function even if DBNL configuration is incomplete

Example: Complete Integration

Here's a complete example combining all the concepts:

Additional Resources

Was this helpful?