Skip to main content

Observability

Keyline provides comprehensive observability through health checks, logging, metrics, and distributed tracing.

Health Checks

/healthz - Basic Health Check

curl http://localhost:9000/healthz

Response:

{
"status": "healthy",
"version": "1.0.0"
}

/_health - Detailed Health Check

curl http://localhost:9000/_health

Response:

{
"status": "healthy",
"checks": {
"session_store": "ok",
"oidc_provider": "ok",
"elasticsearch": "ok"
}
}

Kubernetes Probes

livenessProbe:
httpGet:
path: /healthz
port: 9000
initialDelaySeconds: 30
periodSeconds: 30

readinessProbe:
httpGet:
path: /healthz
port: 9000
initialDelaySeconds: 10
periodSeconds: 10

Logging

Configuration

observability:
log_level: info
log_format: json # or 'text'

Log Levels

LevelUse Case
debugDevelopment, troubleshooting
infoProduction default
warnWarning conditions
errorCritical failures

Example Output

JSON Format (Production):

{
"timestamp": "2024-01-01T00:00:00Z",
"level": "info",
"message": "User authenticated successfully",
"username": "user@example.com",
"method": "oidc",
"source_ip": "192.168.1.1"
}

Text Format (Development):

2024-01-01T00:00:00Z INFO User authenticated successfully username=user@example.com method=oidc

Metrics

Configuration

observability:
metrics_enabled: true

Endpoint

curl http://localhost:9000/_metrics

Available Metrics

MetricTypeDescription
keyline_auth_attempts_totalCounterTotal authentication attempts
keyline_auth_successes_totalCounterSuccessful authentications
keyline_auth_failures_totalCounterFailed authentications
keyline_session_creates_totalCounterSessions created
keyline_user_upserts_totalCounterES user upserts
keyline_cred_cache_hits_totalCounterCredential cache hits
keyline_cred_cache_misses_totalCounterCredential cache misses

Prometheus Integration

# Prometheus scrape config
- job_name: 'keyline'
static_configs:
- targets: ['keyline:9000']
metrics_path: '/_metrics'

Distributed Tracing

Configuration

observability:
otel_enabled: true
otel_endpoint: http://otel-collector:4318
otel_service_name: keyline
otel_trace_ratio: 1.0 # 0.0 to 1.0

Trace Propagation

Keyline supports:

  • W3C Trace Context headers
  • B3 headers (Zipkin compatibility)

Compatible Backends

  • Jaeger
  • Zipkin
  • AWS X-Ray
  • Google Cloud Trace
  • Any OTLP-compatible collector