/v1/chat/completions, /v1/completions, /v1/embeddings, /v1/messages, /v1/responses) — authentication, policy, guardrails, routing, the model call — to any OTLP/HTTP endpoint you run. Files, fine-tuning, image, audio, realtime, MCP, moderation and rerank requests are written to the audit log but are not traced. Use it to see gateway time next to your own services in Jaeger, Tempo, Honeycomb, Datadog or any OTLP-compatible backend.
How it works
Destinations are configured per Gateway workspace in the console (Destinations, under Observability) or the admin API; there is no global endpoint ingateway.yaml. While a request runs, the gateway records spans in memory. When it finishes, every destination of the request’s workspace is evaluated in this order:
telemetry.max_queue_size), so an unreachable collector never slows or fails an LLM request; when a queue is full, spans are dropped. When the gateway runs with NATS, traces are published to JetStream and exported by the Worker; if that publish fails the gateway exports directly. Destination changes reach every replica within 30 seconds.
By default the gateway ignores an inbound W3C traceparent and starts a new trace for every request. Set telemetry.trace_propagation: true to adopt the caller’s trace id and nest manylayers.request under the caller’s span, so your application’s spans and the gateway’s appear as one trace. Enable it only when the caller sends its spans to the same backend as the gateway: a trace whose root lives elsewhere has no root here. The caller’s sampled flag is not consulted: each destination’s own sampling_rate decides. The gateway does not inject trace context of its own into provider calls; any traceparent or tracestate header on your request is passed through to the provider unchanged.
Every exported span carries the resource service.name manylayers-gateway, manylayers.destination.id, and deployment.environment.name when telemetry.environment is set.
Spans
A request refused before a model is called (blocked by a guardrail, denied by policy, served from cache) has no generation span; its usage and cost attributes go on the root span instead.
Only
5xx responses mark the root span as an error; a 4xx refusal is the gateway working as configured, and a policy denial leaves the policy span’s status unset. A failed generation or provider attempt, such as one that fell over to the next target, has status Error and an error.type: the provider’s HTTP status, or timeout, canceled, stream_interrupted or _OTHER.
Attributes
LLM data follows the OpenTelemetry GenAI semantic conventions. The generation span carriesgen_ai.operation.name, gen_ai.provider.name (for example openai, anthropic, aws.bedrock) and gen_ai.request.model, and, whenever the provider answered, gen_ai.request.stream and http.response.status_code (a transport failure such as a timeout sets only status Error and error.type), plus gen_ai.response.id and gen_ai.response.finish_reasons when the provider returned them and, for streamed responses, gen_ai.response.time_to_first_chunk (seconds) and manylayers.time_to_last_token_ms. The root span always carries manylayers.request.id, the organization, workspace and API key ids, manylayers.credential.type / .id, manylayers.request.source (playground for the console) and the HTTP method, route and status code.
Everything else is grouped by a destination’s metadata_config, all off by default. request_context and cost attributes go on the generation span; identity attributes go on the root span:
Input tokens include cached ones; cache and reasoning counts are subsets, so do not add them. Cache and reasoning counts appear only when the provider reported usage; when the gateway had to estimate tokens,
manylayers.usage.estimated is true. A value the gateway does not have is omitted, never exported as 0.
The policy span adds manylayers.policy.result (allowed, denied), manylayers.policy.decision and the rate-limit or budget result. Guardrail spans add manylayers.guardrail.result and, for the guardrail that blocked or modified, manylayers.guardrail.name, .type and .action; a hook that errored also carries manylayers.guardrail.reason, a content-free summary. The routing span adds manylayers.routing.strategy and, for Auto Routing, manylayers.routing.reason.
Content is gen_ai.input.messages, gen_ai.output.messages and, for a Messages API system prompt, gen_ai.system_instructions, as JSON in the conventions’ role + parts shape. Content is taken after the gateway’s PII redaction when PII detection is enabled (it fails open: if the detector errors or pii.detector is off, the original text is used). It is not governed by logging configs or X-ManyLayers-Store-Logs, which control the stored audit copy; use privacy_mode to keep content out of a destination. Content a guardrail flagged and left in place is withheld.
Configuration
Destinations belong to a Gateway workspace. Call the admin API on the console host with a personal access token (ml_pat_…) whose owner holds gateway.observability.manage:
PUT takes the same body and replaces the destination: an omitted sampling_rate returns to 1, and an omitted privacy_mode or metadata_config returns to off. Only headers and enabled are kept when omitted.
Key fields
An
http or https OTLP/HTTP traces URL, at most 2048 characters. A URL with no path uses /v1/traces. gRPC endpoints and credentials in the URL are rejected — put credentials in headers.A JSON object of string values, up to 50 headers. Stored encrypted with the deployment’s credential key (
MANYLAYERS_ENCRYPTION_KEY or connectors.encryption_key). If neither is set the gateway generates one at data/credentials.key; set the variable explicitly when you run more than one replica so every replica can decrypt. Reads return only headers_hint (names with masked values) and headers_set. On update, omit the field to keep the stored headers.Fraction of the traces your filters selected that are exported. The draw is derived from the trace id, so every span of a trace gets the same decision, and a destination at 0.5 receives a superset of one at 0.1.
When true, the content attributes
gen_ai.input.messages, gen_ai.output.messages and gen_ai.system_instructions are never attached. Identity and cost attributes are unaffected.Optional attribute groups, all off by default. New groups added in later releases also start off, so an upgrade never widens what a destination receives.
included and excluded lists of API key ids. Exclusion wins; a non-empty included list is an allow-list.Up to 20 groups of up to 20 rules; a rule value is at most 512 characters. Fields and operators come from
GET /admin/gateway/observability/filter-fields.Filter fields
cost is listed by the filter-fields endpoint but the gateway does not set it on a trace, so a rule on it never matches; filter on token counts instead. api_key, user, team, organization and workspace match internal ids, not names. model is the model the caller requested and selected_model the one that served. status is error for any HTTP status of 400 or above. A rule on a field the request has no value for does not match, including not_equals.
Deployment settings
Admin API
All routes are on the console host (https://app.manylayers.io) and take ?workspace_id=. Reading needs gateway.observability.read (every Gateway role); everything that writes or makes an outbound call needs gateway.observability.manage (Gateway admins).
Both probes accept
{"endpoint", "headers"} for an unsaved form, or {"id"} to test a saved destination with its stored headers. They answer {"ok": true} or {"ok": false, "error": "…"} within 15 seconds; send-trace also returns the trace_id to search for.
Correlating a request
The audit record id of this request. Returned on the text-generation endpoints listed above. Open it in Request Traces or query
/admin/audit?id=.The W3C trace id of the exported trace, on the same text-generation endpoints. Present only when a destination is configured somewhere in the deployment, whether or not this request’s trace is exported; search your tracing backend for it.
Only errors and large requests
Only errors and large requests
One destination at
sampling_rate: 1 with two groups: status equals error, and total_tokens greater_than 5000.Security collector without prompts
Security collector without prompts
privacy_mode: true, metadata_config.identity: true, filter guardrail_result equals blocked.Debug what your collector receives
Debug what your collector receives
Set
MANYLAYERS_OTLP_DEBUG=1 on the gateway to print every OTLP export (URL, headers, decoded spans as JSON) to stderr. It prints prompt content for non-privacy destinations — never enable it in production.Next steps
Metrics
Aggregate Prometheus series for dashboards and alerts.
Request Logging & Audit
The stored record behind
X-ManyLayers-Trace-Id.Guardrails
The checks behind the guardrail spans.
Routing
What the routing span decides.