TracingGuidesInstrumentation

OpenTelemetry

Send OTLP traces to Trodo with no SDK, or add Trodo beside an existing OpenTelemetry pipeline. How OTel traces become runs, and which attributes Trodo reads.

Trodo accepts OpenTelemetry traces over OTLP. Use this when your app already emits OTel spans, for example the Vercel AI SDK through @vercel/otel, or when you already export to Datadog, Jaeger or Honeycomb and want Trodo as one more destination.

Starting fresh? The SDK is less work, and it records any OTel spans emitted inside a run too.

Send OTLP without the SDK

Point your OTLP exporter at Trodo. The bearer token is your site ID.

OTEL_EXPORTER_OTLP_ENDPOINT=https://sdkapi.trodo.ai
OTEL_EXPORTER_OTLP_HEADERS=Authorization=Bearer ${TRODO_SITE_ID}

The exporter adds /v1/traces. Trodo accepts OTLP over HTTP as protobuf or JSON.

One OTel trace becomes one run. The span with no parent is the run; every other span in the trace nests under it. Model and tool spans are recognised from the GenAI conventions (gen_ai.*) and the Vercel AI SDK's ai.* attributes, and their tokens and cost are recorded like any other model call.

Which attributes Trodo reads

Set these on the root span (or on the resource) to fill in the run. The first one present wins.

Run fieldAttributes
Agent nametrodo.agent_name, gen_ai.agent.name, ai.telemetry.metadata.agentName, service.name (else the root span's name)
User (distinctId)trodo.distinct_id, ai.telemetry.metadata.userId, user.id
Conversationtrodo.conversation_id, ai.telemetry.metadata.sessionId, session.id
Metadatatrodo.metadata.<key> and ai.telemetry.metadata.<key> become metadata.<key>
User propertiestrodo.user.property.<key> (merged), trodo.user.set_once.<key> (only if not set yet), trodo.user.fixed.<key> (fixed properties)

With the Vercel AI SDK, pass the user and conversation through experimental_telemetry:

await generateText({
  model,
  prompt,
  experimental_telemetry: {
    isEnabled: true,
    metadata: { userId: user.id, sessionId: thread.id, agentName: 'support-agent', plan: user.plan },
  },
});

userId, sessionId and agentName fill the run's user, conversation and name; plan becomes metadata.plan.

Add Trodo beside your OTel pipeline

To keep your existing exporters and add Trodo, register Trodo's OTLP exporter from the SDK:

npm install trodo-node@^3 @opentelemetry/exporter-trace-otlp-proto
// instrumentation.ts, loaded before the rest of your app
import { registerOTel } from 'trodo-node';

registerOTel({ siteId: process.env.TRODO_SITE_ID!, mode: 'otlp' });
pip install "trodo-python[otlp]>=3"
import os, trodo

trodo.register_otel(site_id=os.environ["TRODO_SITE_ID"], mode="otlp")

wrapAgent, manual spans and trackMcp work the same in both modes.

On this page