Pular para o conteúdo

OpenTelemetry Export

Este conteúdo não está disponível em sua língua ainda.

Overview

Floopy uses a dual export architecture: every request trace is always stored in ClickHouse for the built-in dashboard, and can optionally be exported in real time to any OpenTelemetry (OTLP) compatible backend. This lets you correlate AI gateway traces with your existing application traces in tools like Datadog, Grafana Tempo, Jaeger, New Relic, or Honeycomb.

How it works:

  1. The gateway instruments each request as a set of spans (auth, cache, firewall, provider call, etc.)
  2. Spans are batched and flushed to ClickHouse on a regular interval
  3. After each ClickHouse flush, if your organization has OTLP export enabled, spans are converted to the OpenTelemetry format and exported in parallel via gRPC or HTTP/protobuf
  4. OTLP export is fire-and-forget — failures never affect request processing or ClickHouse storage

Span Schema Reference

Resource Attributes

Resource attributes are set on all spans from your organization:

AttributeTypeDescriptionExample
service.namestringAlways floopy-gatewayfloopy-gateway
service.versionstringGateway version from Cargo.toml0.1.0
floopy.org_idstringYour organization UUID550e8400-e29b-41d4-a716-446655440000
floopy.key_idstringAPI key UUID used for the request (if available)d4e5f6a7-b8c9-0123-4567-89abcdef0123

Span Attributes

Each span carries attributes describing the request:

AttributeTypeDescriptionExample
floopy.request_idstringUnique request UUID (also used to derive trace_id)7c9e6679-7425-40de-944b-e07fc1f90ae7
floopy.providerstringAI provider nameopenai, anthropic, gemini
floopy.modelstringModel used for the requestgpt-4o, claude-sonnet-4-20250514
floopy.cache_hitstringWhether the request was served from cachetrue, false
floopy.firewall_resultstringFirewall evaluation resultpass, block
http.methodstringHTTP method of the original requestPOST
http.status_codestringHTTP response status code200, 429
http.urlstringRequest URL path/v1/chat/completions

Additional custom attributes set by your application are passed through as-is.

Span Field Mapping

Floopy’s internal span format is converted to OTLP as follows:

Floopy FieldOTLP FieldNotes
request_idtrace_idFull 16-byte UUID mapped to OTLP trace ID
span_idspan_idLast 8 bytes of UUID for maximum entropy
parent_span_idparent_span_idLinks child spans to parent operations
operation_namenamee.g., auth, cache_lookup, provider_call
start_timestart_time_unix_nanoParsed from %Y-%m-%d %H:%M:%S%.3f format
duration_msend_time_unix_nanoComputed as start_time + duration
statusstatusok → OTLP OK, error → OTLP Error with description
error_messagestatus.descriptionIncluded when status is error
attributesattributesKey-value pairs mapped to OTLP attributes

Span Hierarchy Example

A typical request produces a trace with the following span hierarchy:

gateway_request (root span)
├── auth # API key validation
├── rate_limit # Rate limit check
├── cache_lookup # Exact + semantic cache check
├── firewall # LLM firewall evaluation
│ ├── verdict_cache # Qdrant lookup (skipped on cache miss)
│ └── llm_call # Safety-tuned LLM via BackendRouter
│ # span fields: backend, model_ref, attempt_count
├── provider_call # Upstream AI provider request
│ └── retry_attempt # Individual retry attempts (if any)
└── post_process # Logging, metering, cache storage

Setup Guide

Step 1: Enable OTLP Export in Settings

  1. Navigate to SettingsIntegrations in the Floopy dashboard
  2. Enter your OTLP collector endpoint URL
  3. Select the protocol: gRPC or HTTP/protobuf
  4. Add any required authentication headers (e.g., API keys, bearer tokens)
  5. Click Test Connection to verify connectivity
  6. Toggle Enable Export to activate

Step 2: Verify Spans Are Arriving

After enabling, send a few test requests through the gateway and check your observability backend for traces with service.name = floopy-gateway.

Integration Guides

Datadog

FieldValue
Endpointhttps://trace.agent.datadoghq.com (US1) or https://trace.agent.datadoghq.eu (EU)
ProtocolHTTP/protobuf
HeadersDD-API-KEY: your Datadog API key

Grafana Cloud / Tempo

FieldValue
Endpointhttps://tempo-us-central1.grafana.net:443 (check your Grafana Cloud stack URL)
ProtocolgRPC
HeadersAuthorization: Basic <base64(instanceId:apiToken)>

Jaeger

FieldValue
Endpointhttp://localhost:4317 (default Jaeger OTLP gRPC port)
ProtocolgRPC
Headers(none required for local Jaeger)

New Relic

FieldValue
Endpointhttps://otlp.nr-data.net:4317 (US) or https://otlp.eu01.nr-data.net:4317 (EU)
ProtocolgRPC
Headersapi-key: your New Relic Ingest License key

Honeycomb

FieldValue
Endpointhttps://api.honeycomb.io:443
ProtocolgRPC
Headersx-honeycomb-team: your Honeycomb API key

Self-Hosted OpenTelemetry Collector

If you run your own OpenTelemetry Collector, point Floopy directly at it:

FieldValue
Endpointhttp://your-collector:4317 (gRPC) or http://your-collector:4318 (HTTP)
ProtocolgRPC or HTTP/protobuf
Headers(depends on your collector auth config)

Example collector config to receive Floopy spans and export to multiple backends:

receivers:
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
processors:
batch:
timeout: 5s
exporters:
otlp/jaeger:
endpoint: jaeger:4317
tls:
insecure: true
otlp/datadog:
endpoint: https://trace.agent.datadoghq.com
headers:
DD-API-KEY: ${DD_API_KEY}
service:
pipelines:
traces:
receivers: [otlp]
processors: [batch]
exporters: [otlp/jaeger, otlp/datadog]

Troubleshooting

Connection Refused

  • Symptom: Test Connection fails with “connection refused”
  • Cause: Endpoint is unreachable from the Floopy gateway
  • Fix: Verify the endpoint URL and port. Ensure firewalls allow outbound connections from the gateway. For gRPC, the default port is 4317; for HTTP, it’s 4318.

Authentication Failures

  • Symptom: Test Connection fails with 401 or 403
  • Cause: Missing or incorrect authentication headers
  • Fix: Double-check your API key or token. Headers are stored encrypted — re-enter the value if you suspect it was saved incorrectly. Verify the header name matches your backend’s requirements exactly (e.g., api-key vs Api-Key).

TLS / Certificate Errors

  • Symptom: Test Connection fails with TLS handshake error
  • Cause: Self-signed certificate or missing CA on the gateway host
  • Fix: Use http:// for local/internal collectors without TLS. For production, ensure your collector’s certificate is signed by a trusted CA.

Spans Not Appearing After Config Change

  • Symptom: Updated endpoint or headers, but spans still go to old destination
  • Cause: OTLP configuration is cached in Redis with a 5-minute TTL
  • Fix: Wait up to 5 minutes for the cache to expire, or restart the gateway to clear the cache immediately.

Export Timeout

  • Symptom: Gateway logs show “OTLP export timed out” warnings
  • Cause: Collector is slow to respond or overloaded
  • Fix: OTLP export has a 5-second timeout. Check your collector’s health and resource allocation. Consider deploying the collector closer to the gateway to reduce network latency.

Missing Attributes

  • Symptom: Spans arrive but are missing expected attributes
  • Cause: Attributes are only set when the corresponding data is available in the request
  • Fix: floopy.provider, floopy.model, and floopy.cache_hit are set by the gateway pipeline. If a request fails before reaching the provider stage, provider-specific attributes won’t be present. This is expected behavior.