Telemetry

import { TelemetryLayers } from "@95octane/common/telemetry"

OpenTelemetry observability setup for distributed tracing, metrics, and logging.

TelemetryLayers

Creates the full OTEL instrumentation layer.

TelemetryLayers({
  appName: "service", // Service name
  appVersion: "1.0.0", // Service version
  env: "production", // Deployment environment
  isLocalOrTest: true, // Export interval: 1s (local) vs 10s (prod)
  otelApiKey: "...", // Grafana Cloud API key
  otelEndpoint: "...", // OTLP endpoint URL
});

Features:

  • OTLP/Protobuf export to Grafana Cloud
  • Automatic resource detection (host, OS)
  • Structured logging with trace correlation
  • Configurable sampling (custom sampler available for production volume reduction — keeps errors, slow requests, and 10% base rate)