Set up OpenTelemetry
To log Mastra applications using Galileo, the first step is to set up OpenTelemetry.Add the OpenTelemetry packages to your application
Add the Mastra OTel Exporter and OpenTelemetry packages to your Mastra application project.
Create environment variables for your Galileo settings
Set environment variables for your Galileo settings, for example in a
.env file:Get your endpoint
The OTel endpoint is different from Galileo’s regular API endpoint and is specifically designed to receive telemetry data in the OTLP format.If you are using:
-
Galileo Cloud at app.galileo.ai, then you don’t need to provide a custom OTel endpoint.
The default endpoint
https://api.galileo.ai/otel/traceswill be used automatically. -
A self-hosted Galileo deployment, replace the
https://api.galileo.ai/otel/tracesendpoint with your deployment URL. The format of this URL is based on your console URL, replacingconsolewithapiand appending/otel/traces.
- if your console URL is
https://console.galileo.example.com, the OTel endpoint would behttps://api.galileo.example.com/otel/traces - if your console URL is
https://console-galileo.apps.mycompany.com, the OTel endpoint would behttps://api-galileo.apps.mycompany.com/otel/traces
Configure OpenTelemetry in your Mastra instance
In your Mastra configuration file, add the observability configuration with the Galileo OTel exporter:
TypeScript
What gets logged
Mastra spans are automatically sent to Galileo through the OpenTelemetry integration. The following information is captured:- Agent executions: Complete agent runs with input/output messages
- LLM calls: Model interactions with prompts and responses
- Tool executions: Tool invocations with arguments and results
- Workflows: Multi-step workflow executions