Skip to main content
This guide provides instructions for integrating Lunary with the TrueFoundry AI Gateway to export OpenTelemetry traces.

What is Lunary?

Lunary is an open source observability platform for LLM applications. It helps teams capture traces, inspect prompts and responses, monitor agent behavior, and track costs across production GenAI workloads.

Key Features of Lunary

  • Agent and LLM tracing: End-to-end visibility into chains, agents, tool calls, and model responses
  • OpenTelemetry ingestion: Accepts OTLP/HTTP traces so you can send spans from gateways, SDKs, and custom instrumentation
  • Session-level monitoring: Track conversations, users, and performance across chatbot and RAG workflows
  • Evaluation and analytics: Analyze runs, categorize outputs, and iterate on prompts with measurable feedback loops
This guide documents OTLP over HTTP from the TrueFoundry AI Gateway (Integration Steps). Lunary also supports SDK-based instrumentation and additional OTLP configuration options; see Lunary’s documentation for framework-specific guides.
TrueFoundry exports OTEL traces only through this configuration. OTEL metrics are not included. Leave the Otel Metrics Exporter Configuration toggle disabled unless you configure a separate metrics destination.

Prerequisites

Before integrating Lunary with TrueFoundry, ensure you have:
  1. TrueFoundry Account: Create a TrueFoundry account and follow the instructions in our Gateway Quick Start Guide
  2. Lunary Account: Sign up at lunary.ai
  3. Lunary project public key: Copy the Project ID / Public Key from your Lunary project settings
Lunary project settings showing Project ID and Public Key with copy button for trace ingestion credentials

Integration Steps

TrueFoundry AI Gateway can export OpenTelemetry traces to Lunary over HTTP so you can analyze gateway traffic alongside the rest of your stack.
1

Get your Lunary public key

  1. Log into the Lunary dashboard.
  2. Open your project and go to SettingsAPI Keys (or the project keys section).
  3. Copy the Project ID / Public Key. Store it securely — treat it like a credential used for trace ingestion.
Lunary projects include both a public and private key. For OTLP trace export from TrueFoundry, use the public key in the Authorization header as shown below.
2

Configure OTEL export in TrueFoundry

  1. In the TrueFoundry dashboard, go to SettingsOrganisationOTEL Config (under AI Gateway).
TrueFoundry Settings Organisation OTEL Config showing HTTP traces endpoint https://api.lunary.ai/v1/traces and Authorization header
  1. Click edit on the OTEL Config section to open the exporter form (if it is not already open).
  2. Enable the OTEL Traces Exporter Configuration toggle.
  3. Select HTTP Configuration.
  4. Enter the Lunary traces endpoint: https://api.lunary.ai/v1/traces
  5. Set Encoding to Proto.
3

Configure headers

Enable Headers and add Lunary authentication:
HeaderValue
AuthorizationBearer <LUNARY_PUBLIC_KEY>
Replace <LUNARY_PUBLIC_KEY> with the public key from the first step.
TrueFoundry OTEL Traces Exporter Configuration with HTTP endpoint https://api.lunary.ai/v1/traces, Proto encoding, and Authorization Bearer header for Lunary
Click Save to apply your configuration.
4

Verify the integration

  1. Send a few requests through the TrueFoundry AI Gateway (via the Playground or any API call).
  2. In TrueFoundry, open Monitor and confirm traces are being generated for those requests.
  3. In Lunary, open ExploreTraces and confirm new spans appear with the expected hierarchy, token usage, and latency details.
Lunary Traces dashboard showing gateway span hierarchy with MCP and model call details, metadata, and input and output panels
Lunary ingests OTLP spans asynchronously. Allow a short delay after your first gateway request before checking the Traces view.

Configuration summary

ConfigurationValue
Traces endpointhttps://api.lunary.ai/v1/traces
ProtocolHTTP
EncodingProto
AuthenticationAuthorization: Bearer <LUNARY_PUBLIC_KEY>
The table above matches HTTP OTLP fields in TrueFoundry. For SDK-based instrumentation, self-hosted Lunary, or additional OpenTelemetry setup options, see Lunary’s documentation.