Skip to content

Traces quickstart

By the end of this guide you’ll have an instrumented Node service emitting OTLP traces to SiteQwality and a working trace visible in the Trace Explorer.

Terminal window
npm install \
@opentelemetry/api \
@opentelemetry/sdk-node \
@opentelemetry/auto-instrumentations-node \
@opentelemetry/exporter-trace-otlp-http

Create tracing.js at the top of your project (loaded before everything else):

const { NodeSDK } = require('@opentelemetry/sdk-node');
const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-http');
const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node');
const sdk = new NodeSDK({
serviceName: 'demo-api',
traceExporter: new OTLPTraceExporter({
url: 'https://traces.siteqwality.com/v1/traces',
headers: {
Authorization: `Bearer ${process.env.SITEQWALITY_API_KEY}`,
},
}),
instrumentations: [getNodeAutoInstrumentations()],
});
sdk.start();

Load it at the top of your entry point:

index.js
require('./tracing');
const express = require('express');
// ... rest of your app

Start the app, hit any endpoint:

Terminal window
SITEQWALITY_API_KEY=sq_live_... node index.js
curl http://localhost:3000/api/anything

The auto-instrumentations-node package automatically traces Express, HTTP, fs, common DB drivers, and more — you don’t have to write spans by hand.

Traces → Explorer → filter service_name = demo-api. Your trace appears within ~10 seconds. Click into it to see the span tree.

For business-logic instrumentation:

const { trace } = require('@opentelemetry/api');
const tracer = trace.getTracer('demo-api');
app.post('/api/charge', async (req, res) => {
await tracer.startActiveSpan('charge_card', async (span) => {
span.setAttribute('user_id', req.body.userId);
span.setAttribute('amount_cents', req.body.amountCents);
try {
const result = await stripe.charges.create({ ... });
span.setStatus({ code: 1 }); // OK
res.json(result);
} catch (err) {
span.recordException(err);
span.setStatus({ code: 2, message: err.message }); // ERROR
res.status(500).send(err.message);
} finally {
span.end();
}
});
});

This wraps your Stripe call in a custom span with attributes you can search on.

The OTLP HTTP endpoint accepts the standard format from any OTel SDK. The pattern is the same: install the SDK + OTLP exporter, point at https://traces.siteqwality.com/v1/traces, set the Authorization header.

LanguageOTel docs
Pythonhttps://opentelemetry.io/docs/instrumentation/python/
Javahttps://opentelemetry.io/docs/instrumentation/java/
Gohttps://opentelemetry.io/docs/instrumentation/go/
.NEThttps://opentelemetry.io/docs/instrumentation/net/