Sazabi
Log sourcesManual: send to an endpoint

Mastra

Add Sazabi as a custom OTLP exporter in your Mastra observability config to stream agent traces directly to Sazabi.

All Mastra integration capabilities

About

Stream Mastra agent traces into Sazabi. Add Mastra's OtelExporter to your app's observability config and point it at a Sazabi endpoint. Mastra creates and batches spans for your agent runs, so traces flow to Sazabi without you setting up the OpenTelemetry SDK yourself.

Prerequisites

  • A Mastra application using @mastra/core. You also need @mastra/otel-exporter and @mastra/observability.
  • Your Sazabi intake URL (shown above).

Set up in the dashboard

Set the intake URL

Set SAZABI_INTAKE_URL to your intake URL (shown above) in the application that initializes Mastra. Mastra's custom OTLP exporter reads this environment variable.

SAZABI_INTAKE_URL=<your intake URL>

Configure Mastra

Add Sazabi as a custom OTLP exporter in your Mastra observability config:

// src/mastra/index.ts
import { Mastra } from "@mastra/core";
import { OtelExporter } from "@mastra/otel-exporter";
import { Observability } from "@mastra/observability";

export const mastra = new Mastra({
  observability: new Observability({
    configs: {
      default: {
        serviceName: "my-mastra-app",
        exporters: [
          new OtelExporter({
            provider: {
              custom: {
                endpoint: process.env.SAZABI_INTAKE_URL,
                protocol: "http/json",
              },
            },
          }),
        ],
      },
    },
  }),
  // Add your agents, tools, and workflows here
});

// Use your Mastra instance
const agent = mastra.getAgent("my-agent");
const response = await agent.generate("Hello, world!");

Redeploy the service

Redeploy or restart the service so Mastra picks up the new observability configuration and the SAZABI_INTAKE_URL environment variable.

Hand off the change

Commit these changes on a new branch, push it, and open a pull request. Keep the intake URL and any keys in environment variables or a secret store, and commit only configuration that references them.

Set up with the CLI

You can also register the Mastra log source with the Sazabi CLI (installed and authenticated — see CLI reference).

Registering the source mints the same intake URL the dashboard shows above (the public key is embedded in its hostname):

sazabi log-sources create mastra --mode manual

The command prints the intake URL for the new source — copy the whole URL and point your sender at it using the configuration shown above. Run sazabi log-sources get <log-source-id> at any time to reprint the endpoint, or sazabi log-sources list to see every log source in the project.

Verify

Run a Mastra agent, tool, or workflow to generate a trace. Open the Intake page in the Sazabi dashboard and confirm traces from the Mastra source appear. Records typically arrive within a minute or two of the run.

Troubleshooting

No traces appear after running an agent — Confirm SAZABI_INTAKE_URL is set in the process environment and that new Observability({ configs: { default: { exporters: [...] } } }) is wired into the Mastra constructor. Check the application logs for exporter initialization errors.

Spans have no agent or tool attributes — The OtelExporter sends spans produced by Mastra's built-in instrumentation. If the agent definition is not registered with the Mastra instance, its runs produce no spans.

Further reading