Seizn./Docs/Integrazioni/OpenTelemetry
📊Ufficiale

Integrazione OpenTelemetry

Esporta le trace di recupero al tuo stack di osservabilità via OTLP.

01Panoramica in 60 Secondi

Seizn esporta nativamente trace OpenTelemetry per ogni operazione di recupero. Connettiti a qualsiasi backend compatibile OTLP per osservabilità end-to-end.

  • Esportazione OTLP zero-config con creazione automatica degli span
  • Attributi dettagliati inclusi latenza, conteggio token e costi
  • Propagazione del contesto per tracciamento distribuito

Backend Supportati

DatadogGrafana TempoJaegerHoneycombNew RelicZipkin

02Configurazione

Configura l'esportazione OTLP tramite variabili d'ambiente.

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"

03Esempi Backend

DD

Datadog

Esporta trace verso Datadog APM tramite il Datadog Agent o API diretta.

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

Invia trace a Grafana Tempo (Cloud o self-hosted).

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

Esporta verso Jaeger con supporto nativo al ricevitore OTLP.

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

04Consigli per la Produzione

Strategia di Campionamento

Controlla il volume delle trace con campionamento head-based o tail-based.

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,
    },
  },
});

Attributi Personalizzati

Aggiungi attributi di risorsa e span per un migliore filtraggio.

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',
    },
  },
});

Configurazione Batch

Ottimizza le prestazioni di esportazione con impostazioni batch.

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

05Risoluzione Problemi

ProblemaCausaSoluzione
Nessuna trace visibileTelemetria disabilitata o endpoint erratoImposta SEIZN_TELEMETRY_ENABLED=true e verifica l'endpoint
Connessione rifiutataCollector non in esecuzione o porta errataControlla lo stato del collector e la porta 4318
Span mancanti nella traceTasso di campionamento troppo bassoAumenta il tasso di campionamento o disabilita il campionamento

Modalità Debug

Abilita il logging di debug per risolvere problemi di telemetria.

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