Enabling OpenTelemetry
Set theOTEL_EXPORTER_OTLP_ENDPOINT environment variable to activate tracing. When unset, there is zero overhead — no SDK is loaded.
grantex-auth-service.
Environment Variables
| Variable | Required | Description |
|---|---|---|
OTEL_EXPORTER_OTLP_ENDPOINT | Yes | OTLP HTTP endpoint (e.g., http://localhost:4318) |
OTEL_EXPORTER_OTLP_HEADERS | No | Additional headers (e.g., x-honeycomb-team=YOUR_KEY) |
OTEL_SERVICE_NAME | No | Override service name (default: grantex-auth-service) |
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:| Span Name | Attributes |
|---|---|
grantex.token.sign | grantex.agent_id, grantex.grant_id, grantex.principal_id, grantex.developer_id, grantex.scopes |
grantex.authorize | grantex.agent_id, grantex.principal_id, grantex.developer_id, grantex.scopes |
grantex.revoke | grantex.grant_id, grantex.developer_id |
grantex.delegate | grantex.agent_id, grantex.grant_id, grantex.principal_id, grantex.developer_id, grantex.scopes |
Collector Configuration
Basic Collector Config
Docker Compose
Kubernetes (Helm)
Enable the OTel collector sidecar in your Helm values:Backend-Specific Setup
Jaeger
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:otlp_config.receiver.protocols.http.endpoint: 0.0.0.0:4318 in its config.