Skip to content

OpenTelemetry bridge

Use @sypnia/telemetry/otel when your Node or Next.js app already uses OpenTelemetry, or when you want its instrumentations for more libraries; install, setup, what it adds, what it costs and how it lives beside @sypnia/telemetry/node.

Applies to EngineCloud
View as Markdown
On this page
  1. Which one to use
  2. Install
  3. Set it up in Node
  4. Set it up in Next.js
  5. Check that it works
  6. What it adds to a plain exporter
  7. The functions you call
  8. What it costs
  9. Which instrumentations are worth it
  10. Beside @sypnia/telemetry/node
  11. Next

This page is for whoever runs a Node or Next.js app that already uses OpenTelemetry, or that wants OpenTelemetry’s automatic instrumentations for libraries Sypnia’s own SDK does not cover (Prisma, MySQL, MongoDB, Redis, queues). @sypnia/telemetry/otel is a small package that plugs Sypnia into the OpenTelemetry SDK you run: a span processor that sends to Sypnia, and a propagator that reads the browser’s session. It is open source (MIT) and identical for the open-source engine and for Sypnia Cloud.

At the end you will have: the spans of your OpenTelemetry setup in Sypnia’s traces and performance numbers, each trace joined to the browser session that started it and to the person in it, exceptions as problems, and your other OpenTelemetry backends, if any, still receiving everything as before.

Which one to use

Your serviceUse
Node or Next.js, no OpenTelemetry today@sypnia/telemetry/node or @sypnia/telemetry/next. Lighter, nothing else to install.
Node or Next.js, OpenTelemetry already registeredThis bridge. Keep your setup and add Sypnia to it.
Node or Next.js, and you need spans for Prisma, MySQL, MongoDB, Redis or a queueThis bridge, with those instrumentations, if their cost is worth it to you. See What it costs.
Python, Go, PHP, Rust, Java, anything elseYour language’s OpenTelemetry SDK with its OTLP exporter pointed at Sypnia: OpenTelemetry.

In every case the browser runs the browser SDK, and one trace id joins the browser’s call with the server’s spans.

Install

npm

npm install @sypnia/telemetry

It needs the OpenTelemetry API (@opentelemetry/api 1.x) and an OpenTelemetry SDK for tracing (@opentelemetry/sdk-trace-base 2.x, which @opentelemetry/sdk-node and @vercel/otel include). It brings no exporter of OpenTelemetry’s: it sends to Sypnia itself.

Set it up in Node

If you have no OpenTelemetry setup yet, this is a complete one. If you have, add the marked lines to yours.

Terminal
npm install @sypnia/telemetry @opentelemetry/sdk-node @opentelemetry/auto-instrumentations-node
src/instrument.ts
import { NodeSDK } from '@opentelemetry/sdk-node';
import { getNodeAutoInstrumentations } from '@opentelemetry/auto-instrumentations-node';
import { sypnia } from '@sypnia/telemetry/otel';

const s = sypnia({
  project: process.env.SYPNIA_PROJECT_KEY,
  service: 'shop-api',
  environment: process.env.SYPNIA_ENVIRONMENT ?? 'production',
  release: process.env.SYPNIA_RELEASE,
});

new NodeSDK({
  spanProcessors: [s.spanProcessor],
  textMapPropagator: s.propagator,
  instrumentations: [
    getNodeAutoInstrumentations({
      '@opentelemetry/instrumentation-fs': { enabled: false },
      '@opentelemetry/instrumentation-dns': { enabled: false },
      '@opentelemetry/instrumentation-net': { enabled: false },
    }),
  ],
}).start();
src/server.ts
import './instrument';
import express from 'express';

const app = express();
app.post('/api/checkout', checkout);
app.listen(3000);

Self-hosted: add endpoint: 'https://sypnia.example.com' to sypnia({…}). The options and environment variables are the same as the Node SDK’s: project (SYPNIA_PROJECT_KEY), endpoint (SYPNIA_ENDPOINT), service (SYPNIA_SERVICE, else the service.name your OpenTelemetry resource has), environment (SYPNIA_ENVIRONMENT), release (SYPNIA_RELEASE), debug, enabled.

A project in ES modules ("type": "module") needs OpenTelemetry’s loader hook for most instrumentations to see the libraries: start Node with --import and the instrument file as JavaScript (node --import ./dist/instrument.js dist/server.js), and follow OpenTelemetry’s documentation for the hook of your version. That hook is part of the startup cost measured below.

If you already send to another backend, keep its processor or exporter next to Sypnia’s: spanProcessors: [s.spanProcessor, yourProcessor]. Each receives every span.

Set it up in Next.js

With @vercel/otel, the usual way to register OpenTelemetry in Next.js:

instrumentation.ts
import { registerOTel } from '@vercel/otel';
import { sypnia } from '@sypnia/telemetry/otel';

export function register() {
  const s = sypnia();
  registerOTel({ serviceName: 'shop-web', spanProcessors: [s.spanProcessor], propagators: [s.propagator] });
}

export { onRequestError } from '@sypnia/telemetry/otel/next';

In registerOTel, spanProcessors replaces @vercel/otel’s default processors, so [s.spanProcessor] sends spans to Sypnia only. If the app already exports elsewhere through those defaults (Vercel’s own trace view, or an exporter set with the OTEL_EXPORTER_OTLP_* variables), keep them with 'auto' and add Sypnia’s processor after it:

TypeScript
registerOTel({ serviceName: 'shop-web', spanProcessors: ['auto', s.spanProcessor], propagators: [s.propagator] });

Then the OTEL_EXPORTER_OTLP_* variables must not point at Sypnia too, or each span arrives twice.

sypnia() with no options takes the key, the address, the environment and the release from withSypnia in next.config.ts, like the browser’s init(). Keep withSypnia and instrumentation-client.ts exactly as in Next.js: the browser side and the source maps do not change. Do not also export register from @sypnia/telemetry/next/server: that would be a second tracer. The option names of registerOTel are @vercel/otel’s; check its documentation for your version.

Next.js emits its own OpenTelemetry spans (renders, route resolution, fetch caching) once a tracer is registered; with the bridge they reach Sypnia too. Code on the Edge runtime is not covered, as with @sypnia/telemetry/next.

Check that it works

  1. Add debug: true to sypnia({…}) and start your app.
  2. Call a route: curl -i http://localhost:3000/api/checkout -X POST.
  3. Within 2 seconds the console prints a line such as exported 7 spans (200). The number depends on the instrumentations you turned on. A 401 means the key is wrong.
  4. Within 10 minutes the route is listed in Performance and its trace is in Traces.

What it adds to a plain exporter

Any OpenTelemetry exporter can send to Sypnia without this package (OpenTelemetry). The bridge does what an exporter cannot know to do:

A plain OTLP exporterWith @sypnia/telemetry/otel
The browser’s traceJoins, through traceparentJoins, through traceparent
The browser’s sessionOnly if you copy x-sypnia-session to session.id yourselfRead by the propagator and set as session.id on every server span
Person and accountNot setidentify() sets user.id and sypnia.account.id
Environment and releaseThrough OTEL_RESOURCE_ATTRIBUTESThe same options as every Sypnia SDK
Query strings, full URLs, SQL textLeave your server, and the engine drops them on arrivalDropped before they leave your server
Messages of failed callsLeave your server as they are, and the engine redacts them on arrivalRedacted before they leave your server, all of them. The bridge reads no answers, so the database error details of @sypnia/telemetry/node are not part of it
A request’s spansCan be split across exportsExported together, at most 200 per request
Usage limitsSpans past the limit are refused (partialSuccess)Sypnia-Slow-Down obeyed: only spans with a failure are sent until the date it names
EncodingWhat you configureProtobuf, gzipped

The sypnia.* attributes it sets are listed in the semantic conventions.

The propagator reads and writes W3C traceparent (and tracestate), like OpenTelemetry’s own, so other services keep continuing your traces. It reads x-sypnia-session and never forwards it.

The functions you call

TypeScript
import { identify, reportError } from '@sypnia/telemetry/otel';
  • identify({ person: { id }, account?: { id } }) sets the person and the account on the current request’s server span. Only ids: names and e-mail addresses are never sent from the server. You need it only for requests that do not come from an identified browser session. See Identifying people.
  • reportError(error) records an exception event, with its stack, on the current span. Use it where your framework catches errors, as in Node, Errors.

For your own steps, use OpenTelemetry’s API (tracer.startActiveSpan), as you already do.

What it costs

With the bridge you run the OpenTelemetry SDK and the instrumentations you choose. That cost is OpenTelemetry’s, and it is your choice. Measured on 2026-11-15, on one machine, against a light tracer of our own (method and full table on Node, What it costs):

Light own tracerOpenTelemetry Node SDK 2.12, HTTP instrumentation, JSON exporter
CPU added per request≈ +0.15 ms≈ +0.55–0.75 ms
Requests served when the CPU is the limit−10 %−40 %
Time added before the server listens≈ 0+600–800 ms
Memory added+34 MB+60–62 MB
Data sent per 1,000 requests278 KB2,560 KB

Two things in that test are not what the bridge does: the bridge sends protobuf, not JSON, so it sends less; and each instrumentation you add costs more on top. The bridge’s own work (enriching, redacting and encoding spans) has a target of under 0.1 ms per request, to be measured on the real package. On serverless, the startup row is what every cold start pays.

Which instrumentations are worth it

InstrumentationWorth it whenNote
http, undici (fetch)Always: they make the server span and the outgoing callsThis is what was measured
express, fastify, koa, nestjs-coreYou want a span per middleware or handlerThe route name is there without them
@prisma/instrumentationYou use PrismaSypnia’s own SDK does not see Prisma’s engine
mysql2, mongodb, ioredis, redisYou use themSypnia’s own SDK does not trace them by itself: this is the way
pgYou use Postgres and the bridgeSame spans as Sypnia’s own SDK
graphqlYou need resolver timingsMany spans per request: turn it on when you look for something
aws-sdk, kafkajs, amqplibWorkers and queuesTheir spans start traces of their own
fs, dns, netAlmost neverMany spans, little to learn: leave them off, as in the example

Each one adds spans, so it also adds to what you send. See Sampling and quotas.

Beside @sypnia/telemetry/node

One tracer per process. Use the bridge or @sypnia/telemetry/node in a service, not both. If both are installed and the bridge’s processor is registered, @sypnia/telemetry/node sees it, leaves tracing to OpenTelemetry and prints one line with debug: true, so nothing is traced twice. Different services can make different choices: a request that goes from a service with @sypnia/telemetry/node to one with the bridge is one trace, through traceparent.

Moving from the bridge to @sypnia/telemetry/node later, or back, changes no data: both send the same attributes to the same endpoint.

Next

  1. Which one to use
  2. Install
  3. Set it up in Node
  4. Set it up in Next.js
  5. Check that it works
  6. What it adds to a plain exporter
  7. The functions you call
  8. What it costs
  9. Which instrumentations are worth it
  10. Beside @sypnia/telemetry/node
  11. Next

    Search pages, sections and terms