maple-agent-tracing-haystack
Installation
SKILL.md
Maple agent tracing: Haystack
Goal: one conversation = one Maple Agent Session, with transcript, model calls, tool calls (failures marked), tokens and (on OpenRouter) cost.
Step 0: Detect
haystack-aiversion:python -c "import haystack; print(haystack.__version__)". Need>=3.0; guide verified on 3.2. For 2.x, stop and tell the user this skill targets Haystack 3.- Find where Agents/Pipelines run (
Agent(,Pipeline(,.run(,AgentTool(,PipelineTool() and where a chat/thread id is available per request. - Existing OTel: grep for
TracerProvider(,set_tracer_provider,configure_otel,logfire.configure,opentelemetry-instrument. If a provider exists, reuse it: only add the Maple exporter (if not already exporting to Maple) andenable_tracing(...). Never create a second provider. - Remove/skip
HaystackInstrumentor().instrument()(OpenInference) and OpenLLMetry's Haystack instrumentor if present: they double every model call. Remove any existingenable_tracing(OpenTelemetryTracer(...))orOpenTelemetryConnectorcomponent and replace with Step 2.
Step 1: Key and region
- US endpoint
https://ingest.maple.dev; EU endpointhttps://ingest.eu.maple.dev. HeaderAuthorization=Bearer <key>. Protocolhttp/protobuf. - Key given in the prompt: use it. No key: use the literal
MAPLE_TEST(ingest accepts and discards it) and tell the user to replace it with their key from Settings → Ingestion. - Private
maple_sk_keys never go in browser code. - Follow the repo's secret/env convention (
.env, settings module, deployment env). If none exists, inline is acceptable: ingest keys are write-only. - Building the header in code from an env var: when it is unset, log one warning (
MAPLE_INGEST_KEY is not set; Maple telemetry export is disabled) and skip the Maple exporter so the app runs normally. Never raise or exit over the key, and never sendBearer None(opaque 401) or hit a bareKeyErroron import. Or inline the key when the repo has no env convention. - 401
ingest_unauthorized/ "Invalid ingest key" with a key you trust: keys are region-bound, so it usually belongs to the other region. Try the other endpoint.