📊Offiziell

OpenTelemetry-Integration

Exportieren Sie Abruf-Traces über OTLP an Ihren Observability-Stack.

0160-Sekunden-Überblick

Seizn exportiert nativ OpenTelemetry-Traces für jeden Abrufvorgang. Verbinden Sie sich mit jedem OTLP-kompatiblen Backend für End-to-End-Observability.

  • Zero-Config OTLP-Export mit automatischer Span-Erstellung
  • Umfangreiche Attribute inkl. Latenz, Token-Anzahl und Kosten
  • Kontextpropagierung für verteiltes Tracing

Unterstützte Backends

DatadogGrafana TempoJaegerHoneycombNew RelicZipkin

02Einrichtung

Konfigurieren Sie den OTLP-Export über Umgebungsvariablen.

Environment Variablesbash
# Enable OTLP export in your Seizn client
# Set these environment variables

# Required: OTLP endpoint
export SEIZN_OTLP_ENDPOINT="https://your-collector:4318"

# Optional: Authentication
export SEIZN_OTLP_HEADERS="Authorization=Bearer your-token"

# Optional: Service name (default: seizn-client)
export SEIZN_SERVICE_NAME="my-rag-app"

03Backend-Beispiele

DD

Datadog

Exportieren Sie Traces an Datadog APM über den Datadog Agent oder die direkte API.

Datadog Configurationbash
# Option 1: Direct to Datadog (via Agent)
export SEIZN_OTLP_ENDPOINT="http://localhost:4318"
# Datadog Agent must have OTLP receiver enabled

# Option 2: Direct to Datadog API
export SEIZN_OTLP_ENDPOINT="https://trace.agent.datadoghq.com"
export SEIZN_OTLP_HEADERS="DD-API-KEY=your-datadog-api-key"

# Enable in Seizn
export SEIZN_TELEMETRY_ENABLED="true"
datadog-agent.yamlyaml
otlp_config:
  receiver:
    protocols:
      http:
        endpoint: 0.0.0.0:4318
G

Grafana Tempo

Senden Sie Traces an Grafana Tempo (Cloud oder selbst gehostet).

Grafana Cloud Configurationbash
# Grafana Cloud
export SEIZN_OTLP_ENDPOINT="https://tempo-us-central1.grafana.net/tempo"
export SEIZN_OTLP_HEADERS="Authorization=Basic $(echo -n 'instance-id:api-token' | base64)"

# Self-hosted Tempo
export SEIZN_OTLP_ENDPOINT="http://tempo:4318"

# Enable in Seizn
export SEIZN_TELEMETRY_ENABLED="true"
J

Jaeger

Exportieren Sie nach Jaeger mit nativem OTLP-Receiver-Support.

Jaeger Configurationbash
# Jaeger with OTLP receiver (v1.35+)
export SEIZN_OTLP_ENDPOINT="http://jaeger:4318"
export SEIZN_TELEMETRY_ENABLED="true"
Docker Compose Examplebash
# Run Jaeger with OTLP support
docker run -d --name jaeger \
  -e COLLECTOR_OTLP_ENABLED=true \
  -p 16686:16686 \
  -p 4318:4318 \
  jaegertracing/all-in-one:latest

04Produktionstipps

Sampling-Strategie

Steuern Sie das Trace-Volumen mit Head-based oder Tail-based Sampling.

typescript
import { Seizn } from 'seizn';

const client = new Seizn({
  apiKey: process.env.SEIZN_API_KEY,
  telemetry: {
    enabled: true,
    samplingRate: 0.1, // Sample 10% of traces
    // Or use tail-based sampling
    sampleOnlyErrors: true,
    sampleSlowRequests: {
      enabled: true,
      thresholdMs: 1000,
    },
  },
});

Benutzerdefinierte Attribute

Fügen Sie Ressourcen- und Span-Attribute für bessere Filterung hinzu.

typescript
const client = new Seizn({
  apiKey: process.env.SEIZN_API_KEY,
  telemetry: {
    enabled: true,
    resourceAttributes: {
      'deployment.environment': 'production',
      'service.version': '1.2.3',
      'service.namespace': 'rag-apps',
    },
    spanAttributes: {
      'user.tier': 'enterprise',
      'feature.flag.rerank': 'enabled',
    },
  },
});

Batch-Konfiguration

Optimieren Sie die Export-Performance mit Batch-Einstellungen.

typescript
const client = new Seizn({
  apiKey: process.env.SEIZN_API_KEY,
  telemetry: {
    enabled: true,
    batchConfig: {
      maxQueueSize: 2048,
      scheduledDelayMs: 5000,
      maxExportBatchSize: 512,
    },
  },
});

05Fehlerbehebung

ProblemUrsacheLösung
Keine Traces sichtbarTelemetrie deaktiviert oder Endpunkt falschSetzen Sie SEIZN_TELEMETRY_ENABLED=true und überprüfen Sie den Endpunkt
Verbindung abgelehntCollector läuft nicht oder falscher PortPrüfen Sie den Collector-Status und Port 4318
Fehlende Spans im TraceSampling-Rate zu niedrigErhöhen Sie die Sampling-Rate oder deaktivieren Sie Sampling

Debug-Modus

Aktivieren Sie Debug-Logging zur Fehlerbehebung von Telemetrie-Problemen.

bash
export SEIZN_TELEMETRY_DEBUG="true"
export OTEL_LOG_LEVEL="debug"