Sending one simple trace to tempo via http

Hi all,

i want to run a simple prototype with Grafana Tempo (Grafana Cloud). Ideally i would like to use the Opentelemetry SDK on node.js and export Traces/Spans directly from application level to Tempo. But it does not work so far, so therefore i would like to see if there is a simple way through http to send a sample trace.

Is there any simple sample how a curl / postmen request to tempo should look like? Then i should be able to instrument and export my app.



Grafana Cloud Traces currently will only accept traces in the OTel Proto format over GRPC. It does not accept http/json.

However, I do know that there was work being into creating an http endpoint for traces. Pinging
@gouthamvegrafana who is involved in that work.

1 Like

I see, thanks.

I finally figured out what went wrong with the GRPC case and node.js grpc exporter sdk. It does not support headers, you have to use environment variables (process.env.OTEL_EXPORTER_OTLP_HEADERS) in order to forward them.

Some example for the community, i saw some have been struggling with the same issue. This worked for me. Side note, the library batches/queues request, so you have to create a bit more traffic (in case you just prototype, like i did).

process.env.OTEL_EXPORTER_OTLP_HEADERS = `Authorization=Basic ${Buffer.from(`${USER_ID}:${API_KEY}`).toString('base64')}`

const { BasicTracerProvider, SimpleSpanProcessor, AlwaysOnSampler, ConsoleSpanExporter,} = require('@opentelemetry/sdk-trace-base');
const opentelemetry = require('@opentelemetry/api');
const { OTLPTraceExporter } =  require('@opentelemetry/exporter-trace-otlp-grpc');
const grpc = require('@grpc/grpc-js');
const provider = new BasicTracerProvider({
  sampler: new AlwaysOnSampler()
const collectorOptions = {
    url: '',
    credentials: grpc.credentials.createSsl(),
const exporter = new OTLPTraceExporter(collectorOptions);
provider.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter()));
provider.addSpanProcessor(new SimpleSpanProcessor(exporter));
const tracer = opentelemetry.trace.getTracer('example-basic-tracer-node');

Hope that helps

Why you can’t use grpc metadata = headers? @opentelemetry/exporter-trace-otlp-grpc - npm

1 Like

Thanks, that works indeed as well :+1:

I just went from http exporter to grpc exporter and relied on the headers.

To close out on the HTTP format, we recommend using the OTLP Gateway which supports HTTP.

See: Sending data using OpenTelemetry Protocol (OTLP) | Grafana Cloud documentation