Skip to content

Observability Overview

LayerToolWhat it covers
Logs + tracesBetterStackAll server-side services via OTLP
LLM tracingLangfuseToken usage, cost, quality scores per AI call
InstrumentationOpenTelemetry SDKSpans, trace context propagation, Pino log hook
Package@repo/observabilityWraps the OTEL SDK for TypeScript apps
Logger@repo/utils/logger (base) / @repo/observability/logger (OTEL)See Logger Usage Reference

OTLP endpoint: https://in-otel.betterstack.com

ServiceTypeNotes
webappTypeScript (Astro/Node)Full OTEL via @repo/observability; service name erp-unlocked-webapp
internalTypeScript (Astro/Node)@repo/observability
temporal-workerPythonopentelemetry-distro auto-instrumentation
ts-temporal-workerTypeScript@repo/observability
Cloudflare WorkersTypeScript@repo/utils/logger (lightweight — no OTEL runtime in Workers)

Every request gets a UUID v4 Correlation ID injected at the edge. It propagates via:

  • HTTP header x-correlation-id
  • Pino log field correlationId
  • Temporal workflow tags
  • Langfuse session_id
  • OTEL span attribute correlation_id

Find a full request trace in BetterStack: filter by correlationId = "<uuid>". See Correlation ID Querying for details.

Two tiers — pick by consumer, not by preference:

  • @repo/utils/logger — lightweight Pino logger. Use in all shared packages/ and in any app that doesn’t need OTEL (Cloudflare Workers, static sites).
  • @repo/observability/logger — OTEL-enhanced. Use only in GCP Cloud Run apps (webapp, internal, temporal-worker, ts-temporal-worker).

Details: Logger Usage Reference · Architecture · Migration Guide

All AI calls go through @repo/ai (Anthropic SDK wrapper) with Langfuse tracing via @with_langfuse(). Tracks: model, tokens in/out, cost, latency, quality score.

Setup: Langfuse + BetterStack integration

Terminal window
OTEL_EXPORTER_OTLP_ENDPOINT=https://in-otel.betterstack.com
OTEL_EXPORTER_OTLP_HEADERS=Authorization=Bearer <betterstack-source-token>
OTEL_SERVICE_NAME=erp-unlocked-webapp # per-service
OTEL_DEPLOYMENT_ENVIRONMENT=production # or staging