Back to docsRecipe

Tempo Distributed Traces

Wire Meridian into Grafana Tempo for end-to-end distributed tracing across your ingest pipeline, enrichment workers, and API surface.

Architecture

OTLP/gRPC exporterTempo 2.4+Grafana 10Span metrics

1. SDK bootstrap

Initialize the OpenTelemetry SDK with a batch OTLP exporter pointed at your Tempo distributor.

import { NodeTracerProvider } from '@opentelemetry/sdk-trace-node'
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-grpc'

const exporter = new OTLPTraceExporter({
  url: 'http://tempo-distributor:4317',
})

const provider = new NodeTracerProvider()
provider.addSpanProcessor(new BatchSpanProcessor(exporter))
provider.register()

2. Instrument Meridian

Wrap your core pipeline stages in spans so every hop appears in the Tempo waterfall.

const tracer = trace.getTracer('meridian-ingest')

async function processEvent(raw: Buffer) {
  return tracer.startActiveSpan('process-event', async (span) => {
    span.setAttribute('event.size', raw.length)
    const enriched = await enrich(raw)
    span.end()
    return enriched
  })
}

3. Grafana datasource

Add Tempo as a datasource in Grafana with the distributor HTTP endpoint. Use the Explore view to search by trace ID, service name, or custom attribute.

Pro tip: Tag spans with tenant.id so you can filter traces per customer in multi-tenant deployments.