Logging to Galileo using OpenTelemetry and OpenInference (Python)
This guide explains how to send OpenTelemetry (OTEL) traces to Galileo using OpenInference. Configure the endpoint and headers to get started quickly.
Installation
To integrate OpenTelemetry (OTEL) tracing with Galileo you need the following dependencies:
pip install opentelemetry-api opentelemetry-sdk opentelemetry-exporter-otlp opentelemetry-instrumentation
Authentication
- Generate an API key from your Galileo account.
- Copy your project name and log stream name from the Galileo console.
Set the authentication headers in your environment:
Once the headers are set, we can initialize the OTEL logging.
Python OpenTelemetry setup
Finally we can setup the OTEL logging to send traces to Galileo. Set the endpoint to your Galileo API. Place this setup at the top of your script, before initializing your LLM or pipeline framework:
Note: Apply instrumentation before importing or initializing your framework (e.g., LangChain, OpenAI).
Full Working Example
Check out a complete working example on Colab: π OpenTelemetry + Galileo Integration Notebook
Summary
To enable OTEL logging with Galileo:
- Set the OTEL headers using your API key, project name, and log stream name.
- Set the exporter endpoint:
https://app.galileo.ai/api/galileo/otel/traces
- Register your tracer provider and processors.
- Import and apply the OpenInference instrumentor(s) before initializing your application.
Supported Instrumentors
These can be used individually or in combination, depending on your framework:
- OpenAI
- LLama Index
- DSPy
- Bedrock
- Langchain
- Mistral
- Guardrails
- Vertex AI
- CrewAI
- Haystack
- LiteLLM
- Groq
- Instructor
- Anthropic
FAQ
How do I create a project?
Log in to the Galileo console and create a new logging project. After creation, copy the project name and log stream name from the interface.
Which instrumentors should I import?
Choose the instrumentor(s) matching your framework:
Instructor Example with Client:
What is the correct OTEL endpoint?
Use the Galileo API base URL with the /otel/traces
path:
If your console URL is https://console.your_cluster_url.com
, the endpoint becomes http://api.your_cluster_url.com/otel/traces
.
How do I verify itβs working?
- Use
ConsoleSpanExporter
to see local trace output. - Check the Galileo dashboard for incoming traces.
- Add a test span like this:
Troubleshooting
- β Confirm your API key, project name, and log stream name are correct.
- β Make sure the environment variable is correctly formatted.
- β Ensure the endpoint is accessible from your environment.
- β Instrument your framework before using it.
- β Restart environment after changing environment variables.
- β
Use
print(os.environ['OTEL_EXPORTER_OTLP_TRACES_HEADERS'])
to debug your header string.
Resources
Notebooks
π Anthropic + Galileo + Otel Notebook π Crew AI + Galileo + Otel Notebook π DSPY + Galileo + Otel Notebook π Groq + Galileo + Otel Notebook π LLamaIndex + Galileo + Otel Notebook π LangChain + Galileo + Otel Notebook π LiteLLM + Galileo + Otel Notebook π Mistral + Galileo + Otel Notebook π OpenAI + Galileo + Otel Notebook π Vertexai + Galileo + Otel Notebook