Skip to main content
The Grantex auth service includes built-in OpenTelemetry instrumentation. When enabled, it produces distributed traces for all HTTP requests, database queries, and Redis operations — plus custom spans for key Grantex operations (token exchange, authorization, delegation, revocation).

Enabling OpenTelemetry

Set the OTEL_EXPORTER_OTLP_ENDPOINT environment variable to activate tracing. When unset, there is zero overhead — no SDK is loaded.
The service name is grantex-auth-service.

Environment Variables

Auto-Instrumented Libraries

The following libraries are automatically instrumented:
  • HTTP/Fastify — incoming request spans with method, route, status code
  • postgres.js — database query spans with statement text
  • ioredis — Redis command spans

Custom Grantex Spans

Key operations create custom spans with Grantex-specific attributes:

Collector Configuration

Basic Collector Config

Docker Compose

Kubernetes (Helm)

Enable the OTel collector sidecar in your Helm values:

Backend-Specific Setup

Jaeger

Set OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318 on the auth service. Open http://localhost:16686 to view traces.

Honeycomb

Datadog APM

Use the OTel Collector with the Datadog exporter, or use the Datadog Agent’s OTLP ingestion:
Ensure the Datadog Agent has otlp_config.receiver.protocols.http.endpoint: 0.0.0.0:4318 in its config.
Last modified on March 1, 2026