Skip to main content
Permitech supports logging traces from Mastra applications using OpenTelemetry.

Set up OpenTelemetry

To log Mastra applications using Permitech, the first step is to set up OpenTelemetry.
1

Add the OpenTelemetry packages to your application

Add the Mastra OTel Exporter and OpenTelemetry packages to your Mastra application project.
2

Create environment variables for your Permitech settings

Set environment variables for your Permitech settings, for example in a .env file:
3

Get your endpoint

The OTel endpoint is different from Permitech’s regular API endpoint and is specifically designed to receive telemetry data in the OTLP format.If you are using:
  • Permitech Cloud at permi.tech, then you don’t need to provide a custom OTel endpoint. The default endpoint https://permi.tech/api/otel/traces will be used automatically.
  • A self-hosted Permitech deployment, replace the https://permi.tech/api/otel/traces endpoint with your deployment URL. The format of this URL is based on your console URL, replacing console with api and appending /otel/traces.
For example:
  • if your console URL is https://console.permitech.example.com, the OTel endpoint would be https://api.permitech.example.com/otel/traces
  • if your console URL is https://console-permitech.apps.mycompany.com, the OTel endpoint would be https://api-permitech.apps.mycompany.com/otel/traces
4

Configure OpenTelemetry in your Mastra instance

In your Mastra configuration file, add the observability configuration with the Permitech OTel exporter:
TypeScript
5

Run your application

Your application is now configured to send telemetry to Permitech using OpenTelemetry. Run your application to see traces in your Log stream.

What gets logged

Mastra spans are automatically sent to Permitech 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
For a complete working example with tools and workflows, see the .