Skip to content

Observability ​

@connectum/otel connects RPC telemetry and application instrumentation to OpenTelemetry. Instrumentation decides what signals to create; provider/exporter configuration decides where those signals go.

Create signals and configure their destination RPC and application instrumentation create spans, metrics and structured logs that configured providers export, with explicit resource metadata, initialization and shutdown behavior. RPC + applicationinstrumentationServer + client RPC hookstraced() / traceAll()getMeter() / getLogger() TracesSpans + propagationErrors + remote-parent trust MetricsRPC duration + app metersStreaming sizes are zero LogsStructured event recordsTrace IDs from active spans Provider andexportersService metadataPer-signal exportersOTLP / console / noneInit before first useFlush at shutdown TelemetrydestinationCollector or console
Instrumentation creates signals; providers configure their resources and destinations. Log correlation needs an active span. Configure remote-parent trust and data recording deliberately.

Minimal RPC instrumentation ​

typescript
import { createServer } from '@connectum/core';
import { createOtelInterceptor } from '@connectum/otel';

const server = createServer({
  services: [routes],
  interceptors: [
    createOtelInterceptor(),
  ],
});

Here routes is your service registration. Configure the provider and exporter as well.

Exclude health RPCs from this instrumentation

Use createOtelInterceptor({ filter: ({ service }) => !service.includes('grpc.health') }).

Choose the signal ​

Trace one call, measure many calls, or write correlated logs.

Instrumentation and configuration references
NeedCanonical guide
Server/client RPC spans, propagation, traced() or traceAll()Tracing
Automatic RPC instruments and application metersMetrics
Structured records and trace correlationLogging
OTLP endpoints, exporters, resource metadata, provider lifecycleBackends and configuration

Focused guides explain task behavior. Exact option fields belong to generated interfaces such as OtelInterceptorOptions and ProviderOptions.

Exporter tables and provider configuration belong to Backends and configuration.

The project's Bun CI does not validate this telemetry integration; see runtime limitations.

Installation ​

Add OpenTelemetry integration
bash
npm install @connectum/otel
bash
pnpm add --allow-build='!protobufjs' @connectum/otel
bash
bun add @connectum/otel

On pnpm 11 and later, explicitly decline the transitive protobufjs build script as above; otherwise installation ends with ERR_PNPM_IGNORED_BUILDS. OpenTelemetry APIs, SDKs and exporters are regular dependencies; @opentelemetry/api stays in >=1.9.0 <1.10.0. Protobuf and Connect are peers; see peer dependency compatibility. Installation alone does not initialize a provider or select an exporter; follow the backend guide before expecting telemetry.