Mapleが利用可能になりました — 無料トライアルを開始する
Node.js

Node.js observability with OpenTelemetry

Add distributed tracing to any Node.js application with the OpenTelemetry SDK. Auto-instrumentation captures Express, Fastify, database queries, and HTTP calls with no code changes.

Quick start

Up and running in minutes

1

Install dependencies

bash
npm install @opentelemetry/sdk-node @opentelemetry/auto-instrumentations-node @opentelemetry/exporter-trace-otlp-http @opentelemetry/exporter-logs-otlp-http
2

Configure tracing

typescript
// tracing.ts — run with: node --import ./tracing.ts app.ts
import { NodeSDK } from "@opentelemetry/sdk-node";
import { getNodeAutoInstrumentations } from "@opentelemetry/auto-instrumentations-node";
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http";
import { OTLPLogExporter } from "@opentelemetry/exporter-logs-otlp-http";
import { SimpleLogRecordProcessor } from "@opentelemetry/sdk-logs";

const sdk = new NodeSDK({
  traceExporter: new OTLPTraceExporter({
    url: "https://ingest.maple.dev/v1/traces",
    headers: { Authorization: "Bearer your-api-key" },
  }),
  logRecordProcessors: [
    new SimpleLogRecordProcessor(
      new OTLPLogExporter({
        url: "https://ingest.maple.dev/v1/logs",
        headers: { Authorization: "Bearer your-api-key" },
      })
    ),
  ],
  instrumentations: [getNodeAutoInstrumentations()],
});

sdk.start();
What you get

Automatic instrumentation for Node.js

Express/Fastify routes

Automatic spans for every HTTP request with route pattern, method, and response status.

PostgreSQL/MySQL queries

Database spans with query text, connection info, and execution duration via pg and mysql2.

HTTP client calls

Outgoing HTTP requests traced with context propagation across service boundaries.

Redis operations

Redis command spans with operation type, key patterns, and latency tracking.

gRPC services

Full client and server gRPC tracing with service name, method, and status attributes.

File system operations

Spans for file reads, writes, and directory operations with path and size metadata.

Live trace preview

See your Node.js traces

Trace: Node.js App
GET /api/products
178ms
express.middleware
5ms
pg.query SELECT products
52ms
http.request https://inventory.svc
98ms
Explore more

Other integrations

明確な観測を始めませんか?

5分以内でトレース、ログ、メトリクスの送信を開始。

maple.dev — オブザーバビリティ、シンプルに