Athas Boilerplate

Runtime Telemetry

shared

Provider-agnostic OpenTelemetry runtime instrumentation for logs, traces, and metrics.

Design goal

Telemetry should be provider-switchable without rewriting app code.

In practice, signoz and otlp are the same OpenTelemetry transport model (standard OTLP endpoints). posthog_logs is the only mode with different routing defaults because PostHog is used as a logs sink (/i/v1/logs) with PostHog project-key auth.

  • posthog_logs: OTLP logs to PostHog ingest endpoint
  • signoz: OTLP to SigNoz collector
  • otlp: generic collector target

Package boundary

Telemetry routing logic now lives in @athas/telemetry-core and is reused by backend and web bootstraps.

  • Reusable concerns: provider normalization, OTLP endpoint routing, header parsing, and PostHog logs auth scoping.
  • Runtime enable/disable remains environment-driven (TELEMETRY_ENABLED / provider vars).

Backend controls

TELEMETRY_ENABLED=true
TELEMETRY_PROVIDER=otlp
TELEMETRY_OTLP_ENDPOINT=http://localhost:4318
BACKEND_MODULE_OBSERVABILITY_ENABLED=true

Frontend module gating:

VITE_MODULE_OBSERVABILITY_ENABLED=true
VITE_TELEMETRY_ENABLED=true

Provider-specific options:

  • PostHog logs:
    • TELEMETRY_PROVIDER=posthog_logs
    • TELEMETRY_POSTHOG_PROJECT_KEY=phc_...
    • optional TELEMETRY_POSTHOG_INGEST_URL
  • SigNoz:
    • TELEMETRY_PROVIDER=signoz
    • TELEMETRY_OTLP_ENDPOINT=<collector-endpoint>

Runtime signal baseline

  • traces (OTLP)
  • logs (OTLP)
  • metrics (OTLP)
  • HTTP access telemetry logs with request duration and status

Latency SLO baseline target includes p95 and p99 by endpoint.

When TELEMETRY_PROVIDER=posthog_logs, logs route to PostHog while traces and metrics still follow standard OTLP endpoint resolution (base endpoint or explicit per-signal endpoint overrides).

On this page