cetra reads the spans n8n sends for each workflow execution and each node it runs, including the token counts of its AI nodes.
Install
Section titled “Install”Install n8n with npm. The fixture was captured with n8n 2.48.4.
npm install -g n8n@2.48.4Set up
Section titled “Set up”n8n exports its spans when the server starts. Set the export variables, then start the server with n8n start.
export N8N_OTEL_ENABLED=trueexport N8N_OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:8080export N8N_OTEL_EXPORTER_OTLP_HEADERS="authorization=Bearer <SK_CETRA_KEY>"export N8N_OTEL_EXPORTER_OTLP_PROTOCOL=http/protobufexport N8N_OTEL_TRACES_PRODUCTION_ONLY=falseexport N8N_DIAGNOSTICS_ENABLED=false
n8n startReplace <SK_CETRA_KEY> with your sk-cetra-… API key. See Send OpenTelemetry. n8n appends /v1/traces to the endpoint.
n8n execute, the command-line runner, exports nothing. Only the server exports spans.N8N_OTEL_TRACES_PRODUCTION_ONLYdefaults totrue, which leaves out runs started by hand in the editor. Set it tofalseto export those too.N8N_DIAGNOSTICS_ENABLED=falseturns off n8n’s own diagnostics. The fixture was captured with it off.
What you get
Section titled “What you get”One workflow execution is one trace:
- a
chainspan for the whole execution, namedworkflow.execute, with the workflow’s name and ID; - one
spanfor each node, namednode.execute; - an
agentspan for an AI Agent node, with the provider and the operationinvoke_agent; - an
llmspan for a Chat Model node, with the provider, the request and response models, the token counts and the cost, which cetra computes from its price table.
Every node span has the same name. To tell the nodes apart, look at the Attributes tab: each node carries its name in n8n.node.name, and its type in n8n.node.type.
Limits
Section titled “Limits”- n8n sends no content. No span has an input or an output, so the messages and the answers of an AI node are not in cetra.
- The AI Agent node carries its model’s token counts as attributes, but cetra does not count them on the
agentspan. The Chat Model node is the one that counts them and prices the call, so a sum over the trace counts each model call once. - The fixture covers a webhook workflow with an AI Agent, a Chat Model and a Webhook node. Tool nodes and n8n’s agent tracing were not captured.
- The fixture was captured with n8n 2.48.4 and the OpenAI Chat Model node, with the fake model answering in one turn.
- If a field is missing, look at the span’s Attributes tab and compare it with Span attributes.
- Traces: read the trace as a tree and a timeline.
- Cost and tokens: how cost is computed from the token counts.