🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
docs(agents): add Datadog query recipes skill (#13575)
Max Deichmann08615fe741f7
diff --git a/.agents/AGENTS.md b/.agents/AGENTS.mdindex ecc7dfae0d..12d07103ca 100644--- a/.agents/AGENTS.md+++ b/.agents/AGENTS.md@@ -34,6 +34,9 @@ evaluating, and debugging AI applications.- Langfuse Cloud cost structure, infra spend, AWS/ClickHouse cost splits, orMetabase cost marts:`.agents/skills/analyze-cloud-costs/SKILL.md`+- Production telemetry research, Datadog query recipes, tenant/public API usage+ audits, or queue consumer telemetry:+ `.agents/skills/datadog-query-recipes/SKILL.md`- Backend/API work in `web/src/server/**`, `web/src/pages/api/public/**`,`worker/src/**`, or `packages/shared/src/**`:`.agents/skills/backend-dev-guidelines/SKILL.md`diff --git a/.agents/skills/README.md b/.agents/skills/README.mdindex 3d2e581ca2..3f3e7a0377 100644--- a/.agents/skills/README.md+++ b/.agents/skills/README.md@@ -43,6 +43,18 @@ Use for:Open: [analyze-cloud-costs/SKILL.md](analyze-cloud-costs/SKILL.md)+### datadog-query-recipes++Use for:+- production telemetry research across `prod-us`, `prod-eu`, `prod-hipaa`,+ and `prod-jp`+- Datadog query recipes for spans, logs, metrics, tenants, public API usage,+ and queue consumers+- ad hoc measured questions where the task is not yet an incident root-cause+ analysis++Open: [datadog-query-recipes/SKILL.md](datadog-query-recipes/SKILL.md)+### frontend-browser-reviewUse for:diff --git a/.agents/skills/datadog-query-recipes/SKILL.md b/.agents/skills/datadog-query-recipes/SKILL.mdnew file mode 100644index 0000000000..178881c894--- /dev/null+++ b/.agents/skills/datadog-query-recipes/SKILL.md@@ -0,0 +1,73 @@+---+name: datadog-query-recipes+description: |+ Langfuse-specific Datadog query recipes for production telemetry research.+ Use when asked to investigate tenant or project activity, public API endpoint+ usage, queue consumer behavior, spans, logs, metrics, or ad hoc production+ questions across prod-us, prod-eu, prod-hipaa, and prod-jp. This skill is for+ reusable query shapes and measured research; pair it with+ debug-issue-with-datadog when the task is an incident or root-cause analysis.+---++# Datadog Query Recipes++Use this skill for Langfuse production telemetry research where the main work is+finding the right Datadog data path. Keep findings evidence-based and include+the exact Datadog links or query shapes that support the answer.++## Required Scope++Unless the user explicitly narrows the scope, cover every production+environment:++- `prod-us`+- `prod-eu`+- `prod-hipaa`+- `prod-jp`++Query both Datadog sites when needed. Default to the EU site for `prod-eu` and+the US site for the other prod environments, but verify with a small count or+facet query before concluding an environment has no data.++Before querying live Datadog, load the relevant Datadog MCP guidance for the+data domain you need: traces, logs, metrics, and visualizations.++## Workflow++1. Identify the entity and signal: tenant ID, org ID, project ID, route, queue,+ service, error class, or metric.+2. Read only the relevant reference:+ - Prod environment/site routing:+ [`references/environments.md`](references/environments.md)+ - Public API tenant or legacy endpoint usage:+ [`references/public-api-tenant-usage.md`](references/public-api-tenant-usage.md)+ - Queue inventory, queue consumers, and queue metrics:+ [`references/queue-consumers.md`](references/queue-consumers.md)+3. Start with aggregate queries, grouped by environment, service, route,+ queue, project, org, status, or error facets as appropriate.+4. Fetch raw spans, logs, or traces only after aggregation identifies the+ cluster or sample you need.+5. For tenant-specific HTTP usage, prefer trace correlation over single-span+ queries when tenant tags and route tags live on different spans.+6. Report the windows, environments, sites, query links, and any sampling or+ missing-data caveats.++## When To Use Other Skills++- Use [`debug-issue-with-datadog`](../debug-issue-with-datadog/SKILL.md) when a+ Linear issue, GitHub issue, incident report, or monitor needs root-cause+ analysis and patch recommendations.+- Use [`detect-prod-regressions`](../detect-prod-regressions/SKILL.md) when the+ user asks for a proactive production sweep or baseline comparison.+- Use [`linear-bug-triage`](../linear-bug-triage/SKILL.md) only after a human+ approves sharing measured findings in Linear.++## Output Expectations++Summarize what was checked, including:++- Datadog site and `env` values covered.+- Time windows.+- Core filters or metrics used.+- Count, rate, latency, queue depth, trace sample, or "No measurements found".+- Datadog links or trace IDs that let the human rerun the query.diff --git a/.agents/skills/datadog-query-recipes/agents/openai.yaml b/.agents/skills/datadog-query-recipes/agents/openai.yamlnew file mode 100644index 0000000000..8e34167315--- /dev/null+++ b/.agents/skills/datadog-query-recipes/agents/openai.yaml@@ -0,0 +1,4 @@+interface:+ display_name: "Datadog Query Recipes"+ short_description: "Langfuse production telemetry queries"+ default_prompt: "Use $datadog-query-recipes to investigate Langfuse production telemetry for a tenant, endpoint, queue, or regression."diff --git a/.agents/skills/datadog-query-recipes/references/environments.md b/.agents/skills/datadog-query-recipes/references/environments.mdnew file mode 100644index 0000000000..60b587ae87--- /dev/null+++ b/.agents/skills/datadog-query-recipes/references/environments.md@@ -0,0 +1,45 @@+# Production Environments++Langfuse production deploys cover these environments and services. The deploy+matrix is defined in `.github/workflows/deploy.yml`.++| Environment | Primary Datadog site | Common services |+| --- | --- | --- |+| `prod-us` | US, `datadoghq.com` | `web`, `web-ingestion`, `web-iso`, `worker`, `worker-cpu` |+| `prod-eu` | EU, `datadoghq.eu` | `web`, `web-ingestion`, `web-iso`, `worker`, `worker-cpu` |+| `prod-hipaa` | US, `datadoghq.com` | `web`, `web-ingestion`, `web-iso`, `worker`, `worker-cpu` |+| `prod-jp` | US, `datadoghq.com` | `web`, `web-ingestion`, `web-iso`, `worker`, `worker-cpu` |++The site mapping is a starting point, not proof. For cross-region research, run+a small count or facet query on both Datadog sites before saying an environment+has no data.++## Starter Filters++Use these as first-pass filters, then add the subsystem-specific route, queue,+tenant, or error facets.++```text+env:prod-us+env:prod-eu+env:prod-hipaa+env:prod-jp+```++```text+env:<env> (service:web OR service:web-ingestion OR service:web-iso)+env:<env> (service:worker OR service:worker-cpu)+```++For HTTP routes, start with `service:web` or `service:web-ingestion` depending+on the endpoint. For queue consumers, start with `service:worker` and+`service:worker-cpu`.++## Cross-Site Rule++When a query returns zero:++1. Check the time window and spelling of `env`, `service`, and route/resource.+2. Query facets on the same site for `env` and `service`.+3. Repeat a small count query on the other Datadog site.+4. Only then report "No measurements found".diff --git a/.agents/skills/datadog-query-recipes/references/public-api-tenant-usage.md b/.agents/skills/datadog-query-recipes/references/public-api-tenant-usage.mdnew file mode 100644index 0000000000..a937800a5a--- /dev/null+++ b/.agents/skills/datadog-query-recipes/references/public-api-tenant-usage.md@@ -0,0 +1,99 @@+# Public API Tenant Usage++Use this recipe when checking whether an org or project calls a public API+route, including legacy endpoints such as:++- `/api/public/traces`+- `/api/public/traces/<traceId>` (`/api/public/traces/[traceId]` in Next.js)+- `/api/public/observations`+- `/api/public/observations/<observationId>`+ (`/api/public/observations/[observationId]` in Next.js)+- `/api/public/metrics`++Migrated endpoints commonly include:++- `/api/public/v2/observations`+- `/api/public/v2/metrics`+- `/api/public/otel/v1/traces`++## Why Correlation Is Needed++Public API auth attaches tenant attributes to the `api-auth-verify` child span:++- `@langfuse.project.id`: project-scoped API key target.+- `@langfuse.org.id`: owning org or org-scoped key target.+- `@langfuse.org.plan`: plan when present.++The HTTP route is on the request root span, usually in `http.path_group`,+`http.route`, `http.target`, or `resource_name`.++Because tenant tags and route tags often live on different spans in the same+trace, do not expect this single-span query to work:++```text[email protected]:<id> @http.path_group:/api/public/observations+```++## Per-Tenant Endpoint Recipe++1. Aggregate auth spans for the tenant to confirm the identifier and active+ projects.++```text+env:<env> @langfuse.org.id:<orgId> resource_name:api-auth-verify+env:<env> @langfuse.project.id:<projectId> resource_name:api-auth-verify+```++Group by `service`, `@langfuse.project.id`, and optionally a daily interval.++2. Fetch representative matching auth spans with `search_datadog_spans`.+ Include custom attributes such as `langfuse.*`, then copy representative+ `traceid` values.++3. Open those traces with `get_datadog_trace`. Request service-entry spans and+ include HTTP and Langfuse attributes:++```text+only_service_entry_spans: true+extra_fields: ["http.*", "next.*", "langfuse.*"]+```++4. Read the request root span's `http.path_group`, `http.route`,+ `http.target`, and `resource_name` to identify the endpoint.+ ID lookup routes may appear with the concrete ID in `http.target` or with+ the normalized Next.js route, such as+ `/api/public/traces/[traceId]` or+ `/api/public/observations/[observationId]`.++5. Repeat across all relevant prod environments and both Datadog sites when the+ user asks for a global answer.++Treat per-tenant endpoint results as sampled unless you have an unsampled+metric or log source with tenant and route on the same event.++## Fleet-Level Endpoint Volume++For endpoint volume without tenant scoping, aggregate request spans directly:++```text+env:<env> service:web resource_name:"GET /api/public/observations*"+env:<env> service:web resource_name:"GET /api/public/observations/*"+env:<env> service:web resource_name:"POST /api/public/traces*"+env:<env> service:web resource_name:"GET /api/public/traces/*"+env:<env> service:web resource_name:"POST /api/public/metrics*"+```++Use route facets where available:++```text+env:<env> service:web @http.path_group:/api/public/observations+env:<env> service:web @http.path_group:/api/public/observations/*+env:<env> service:web @http.path_group:/api/public/observations/[observationId]+env:<env> service:web @http.route:/api/public/observations+env:<env> service:web @http.route:/api/public/observations/[observationId]+env:<env> service:web @http.path_group:/api/public/traces/[traceId]+env:<env> service:web @http.route:/api/public/traces/[traceId]+```++If route facets and resource names disagree, fetch a few traces and inspect the+root span before reporting the result.diff --git a/.agents/skills/datadog-query-recipes/references/queue-consumers.md b/.agents/skills/datadog-query-recipes/references/queue-consumers.mdnew file mode 100644index 0000000000..e292283153--- /dev/null+++ b/.agents/skills/datadog-query-recipes/references/queue-consumers.md@@ -0,0 +1,234 @@+# Queue Consumers++Use this reference when a task asks which Langfuse queues exist, whether a+consumer is running, how much work a queue has, or how to query queue processor+spans.++## Source Of Truth++- Queue names and job names:+ `packages/shared/src/server/queues.ts` (`QueueName`, `QueueJobs`).+- Queue producer classes and shard naming:+ `packages/shared/src/server/redis/*.ts`.+- Worker consumer registration and feature gates:+ `worker/src/app.ts`.+- Worker consumer env vars:+ `worker/src/env.ts` (`QUEUE_CONSUMER_*_IS_ENABLED` plus feature-specific+ gates).+- Worker registration, request/error counters, wait/processing time, and+ sampled old-style depth metrics:+ `worker/src/queues/workerManager.ts`.+- Queue depth background reporter:+ `worker/src/features/queue-metrics-runner/index.ts`.+- Metric name conversion:+ `packages/shared/src/server/instrumentation/index.ts`+ (`convertQueueNameToMetricName`).+- Sharded queue registry:+ `worker/src/queues/shardedQueueRegistry.ts`.+- BullMQ tracing setup:+ `worker/src/instrumentation.ts` (`BullMQInstrumentation`).++## Queue Inventory++Current `QueueName` values:++| Queue | Notes |+| --- | --- |+| `trace-upsert` | Sharded. Registers all `TraceUpsertQueue` shards. |+| `trace-delete` | Delete traces from storage. |+| `project-delete` | Project deletion cleanup. |+| `evaluation-execution-queue` | Sharded eval execution. |+| `secondary-evaluation-execution-queue` | Sharded secondary eval execution. |+| `llm-as-a-judge-execution-queue` | Sharded observation-based eval execution. |+| `dataset-run-item-upsert-queue` | Dataset run item upserts. |+| `batch-export-queue` | Batch exports. |+| `otel-ingestion-queue` | Sharded OTel ingestion. |+| `secondary-otel-ingestion-queue` | Sharded secondary OTel ingestion. |+| `ingestion-queue` | Sharded single-event ingestion. |+| `secondary-ingestion-queue` | Sharded secondary single-event ingestion. |+| `cloud-usage-metering-queue` | Cloud-only, Stripe-gated. |+| `cloud-spend-alert-queue` | Cloud-only, Stripe-gated. |+| `cloud-free-tier-usage-threshold-queue` | Cloud-only, Stripe-gated. |+| `experiment-create-queue` | Experiment creation. |+| `posthog-integration-queue` | Schedules PostHog integration jobs. |+| `posthog-integration-processing-queue` | Processes PostHog projects. |+| `mixpanel-integration-queue` | Schedules Mixpanel integration jobs. |+| `mixpanel-integration-processing-queue` | Processes Mixpanel projects. |+| `blobstorage-integration-queue` | Schedules blob storage jobs. |+| `blobstorage-integration-processing-queue` | Processes blob storage projects. |+| `core-data-s3-export-queue` | Cloud export feature gate. |+| `metering-data-postgres-export-queue` | Cloud export feature gate. |+| `data-retention-queue` | Schedules data retention jobs. |+| `data-retention-processing-queue` | Processes data retention projects. |+| `batch-action-queue` | Batch actions. |+| `create-eval-queue` | Eval job creation. |+| `score-delete` | Score deletion cleanup. |+| `dataset-delete-queue` | Dataset deletion cleanup. |+| `dead-letter-retry-queue` | Dead letter retry worker. |+| `webhook-queue` | Webhook delivery. |+| `entity-change-queue` | Entity change propagation. |+| `event-propagation-queue` | Experiment event propagation gate. |+| `notification-queue` | Notifications. |++Sharded queues use the base queue for shard 0 and append `-1`, `-2`, etc. for+additional shards. The sharded base queues are:++- `trace-upsert`+- `evaluation-execution-queue`+- `secondary-evaluation-execution-queue`+- `llm-as-a-judge-execution-queue`+- `otel-ingestion-queue`+- `secondary-otel-ingestion-queue`+- `ingestion-queue`+- `secondary-ingestion-queue`++## Consumer Gates++Consumer registration is in `worker/src/app.ts`. Some gates register multiple+queues or every shard for a sharded queue.++| Gate | Queues registered |+| --- | --- |+| `QUEUE_CONSUMER_TRACE_UPSERT_QUEUE_IS_ENABLED` | `trace-upsert` shards |+| `QUEUE_CONSUMER_CREATE_EVAL_QUEUE_IS_ENABLED` | `create-eval-queue` |+| `LANGFUSE_S3_CORE_DATA_EXPORT_IS_ENABLED` | `core-data-s3-export-queue` |+| `LANGFUSE_POSTGRES_METERING_DATA_EXPORT_IS_ENABLED` | `metering-data-postgres-export-queue` |+| `QUEUE_CONSUMER_TRACE_DELETE_QUEUE_IS_ENABLED` | `trace-delete` |+| `QUEUE_CONSUMER_SCORE_DELETE_QUEUE_IS_ENABLED` | `score-delete` |+| `QUEUE_CONSUMER_DATASET_DELETE_QUEUE_IS_ENABLED` | `dataset-delete-queue` |+| `QUEUE_CONSUMER_PROJECT_DELETE_QUEUE_IS_ENABLED` | `project-delete` |+| `QUEUE_CONSUMER_DATASET_RUN_ITEM_UPSERT_QUEUE_IS_ENABLED` | `dataset-run-item-upsert-queue` |+| `QUEUE_CONSUMER_EVAL_EXECUTION_QUEUE_IS_ENABLED` | `evaluation-execution-queue` shards, `llm-as-a-judge-execution-queue` shards |+| `QUEUE_CONSUMER_EVAL_EXECUTION_SECONDARY_QUEUE_IS_ENABLED` | `secondary-evaluation-execution-queue` shards |+| `QUEUE_CONSUMER_BATCH_EXPORT_QUEUE_IS_ENABLED` | `batch-export-queue` |+| `QUEUE_CONSUMER_BATCH_ACTION_QUEUE_IS_ENABLED` | `batch-action-queue` |+| `QUEUE_CONSUMER_OTEL_INGESTION_QUEUE_IS_ENABLED` | `otel-ingestion-queue` shards |+| `QUEUE_CONSUMER_OTEL_INGESTION_SECONDARY_QUEUE_IS_ENABLED` | `secondary-otel-ingestion-queue` shards |+| `QUEUE_CONSUMER_INGESTION_QUEUE_IS_ENABLED` | `ingestion-queue` shards |+| `QUEUE_CONSUMER_INGESTION_SECONDARY_QUEUE_IS_ENABLED` | `secondary-ingestion-queue` shards |+| `QUEUE_CONSUMER_CLOUD_USAGE_METERING_QUEUE_IS_ENABLED` plus `STRIPE_SECRET_KEY` | `cloud-usage-metering-queue` |+| `QUEUE_CONSUMER_CLOUD_SPEND_ALERT_QUEUE_IS_ENABLED` plus `STRIPE_SECRET_KEY` | `cloud-spend-alert-queue` |+| `QUEUE_CONSUMER_FREE_TIER_USAGE_THRESHOLD_QUEUE_IS_ENABLED` plus cloud region and Stripe gates | `cloud-free-tier-usage-threshold-queue` |+| `QUEUE_CONSUMER_EXPERIMENT_CREATE_QUEUE_IS_ENABLED` | `experiment-create-queue` |+| `QUEUE_CONSUMER_POSTHOG_INTEGRATION_QUEUE_IS_ENABLED` | `posthog-integration-queue`, `posthog-integration-processing-queue` |+| `QUEUE_CONSUMER_MIXPANEL_INTEGRATION_QUEUE_IS_ENABLED` | `mixpanel-integration-queue`, `mixpanel-integration-processing-queue` |+| `QUEUE_CONSUMER_BLOB_STORAGE_INTEGRATION_QUEUE_IS_ENABLED` | `blobstorage-integration-queue`, `blobstorage-integration-processing-queue` |+| `QUEUE_CONSUMER_DATA_RETENTION_QUEUE_IS_ENABLED` | `data-retention-queue`, `data-retention-processing-queue` |+| `QUEUE_CONSUMER_DEAD_LETTER_RETRY_QUEUE_IS_ENABLED` | `dead-letter-retry-queue` |+| `QUEUE_CONSUMER_WEBHOOK_QUEUE_IS_ENABLED` | `webhook-queue` |+| `QUEUE_CONSUMER_ENTITY_CHANGE_QUEUE_IS_ENABLED` | `entity-change-queue` |+| `QUEUE_CONSUMER_EVENT_PROPAGATION_QUEUE_IS_ENABLED` plus events-table experiment gate | `event-propagation-queue` |+| `QUEUE_CONSUMER_NOTIFICATION_QUEUE_IS_ENABLED` | `notification-queue` |++## Query Consumer Spans++Start with aggregate spans on worker services:++```text+env:<env> (service:worker OR service:worker-cpu) operation_name:bullmq.process+```++Then group by `resource_name`, queue facets such as `bullmq.queue` or+`messaging.*`, and error fields. Facet names can differ between Datadog sites,+so inspect one sample span before relying on a specific facet.++Queue-specific starter query:++```text+env:<env> (service:worker OR service:worker-cpu) operation_name:bullmq.process (resource_name:"process otel-ingestion-queue" OR resource_name:"Worker.run otel-ingestion-queue" OR bullmq.queue:otel-ingestion-queue)+```++For sharded queues, query the base queue and shard suffixes:++```text+env:<env> (service:worker OR service:worker-cpu) operation_name:bullmq.process resource_name:"*otel-ingestion-queue*"+```++If a queue file wraps the handler with `instrumentAsync`, also search the+domain-specific resource name. Examples:++| Subsystem | Resource name |+| --- | --- |+| PostHog project processing | `process posthog-integration-project` |+| Mixpanel project processing | `process mixpanel-integration-project` |+| Blob storage project processing | `process blob-storage-project` |+| Data retention project processing | `process data-retention-project` |+| Event propagation | `process event-propagation` |+| Cloud usage metering | `process cloud-usage-metering` |+| Free-tier usage threshold | `process cloud-free-tier-usage-threshold` |++Useful aggregations:++- Count by `env`, `service`, and `resource_name`.+- Count by queue facet and status.+- Count by `error.type` and `error.message`.+- p50, p95, and p99 duration by queue or shard.+- Count by `messaging.bullmq.job.input.projectId` when the processor attaches+ project IDs to the current span.++## Query Queue Metrics++Metric base names come from `convertQueueNameToMetricName(queueName)`:++```text+langfuse.queue.<queue-name-with-hyphens-replaced-by-underscores-and-trailing-_queue-removed>+```++Examples:++| Queue | Metric base |+| --- | --- |+| `ingestion-queue` | `langfuse.queue.ingestion` |+| `otel-ingestion-queue` | `langfuse.queue.otel_ingestion` |+| `secondary-otel-ingestion-queue` | `langfuse.queue.secondary_otel_ingestion` |+| `evaluation-execution-queue` | `langfuse.queue.evaluation_execution` |+| `trace-upsert` | `langfuse.queue.trace_upsert` |+| `batch-export-queue` | `langfuse.queue.batch_export` |++Prefer the newer tagged metrics:++```text+<metric_base>.depth{env:<env>,type:waiting}+<metric_base>.depth{env:<env>,type:failed}+<metric_base>.depth{env:<env>,type:active}+<metric_base>.rate{env:<env>,type:request}+<metric_base>.rate{env:<env>,type:failed}+<metric_base>.rate{env:<env>,type:error}+<metric_base>.time{env:<env>,type:wait}+<metric_base>.time{env:<env>,type:processing}+```++For sharded queues, use the `shard` tag when present. `shard:all` is emitted by+the depth runner for aggregate depth across shards.++Backward-compatible metrics may still appear:++```text+<metric_base>.length+<metric_base>.dlq_length+<metric_base>.active+<metric_base>.request+<metric_base>.failed+<metric_base>.error+<metric_base>.wait_time+<metric_base>.processing_time+```++For non-BullMQ internal write buffering, `ClickhouseWriter` emits+`langfuse.queue.clickhouse_writer.*` metrics, but it is not a `QueueName`+consumer.++## Consumer Running Checklist++To establish whether a consumer is running in production:++1. Check queue depth metrics for waiting, failed, and active counts.+2. Check `rate{type:request}` or old `.request` metrics for recent processing.+3. Search BullMQ processor spans on `worker` and `worker-cpu`.+4. Search worker logs for the queue name or processor-specific log prefix.+5. If all signals are empty, verify the relevant `QUEUE_CONSUMER_*_IS_ENABLED`+ gate and any feature-specific gates in `worker/src/app.ts`.++The queue metrics runner only polls queues with registered workers. Missing+depth metrics can mean the consumer is not registered on that worker, queue+metrics are disabled, or the data is on the other Datadog site.diff --git a/.agents/skills/debug-issue-with-datadog/SKILL.md b/.agents/skills/debug-issue-with-datadog/SKILL.mdindex a5b340318b..27c7eefe77 100644--- a/.agents/skills/debug-issue-with-datadog/SKILL.md+++ b/.agents/skills/debug-issue-with-datadog/SKILL.md@@ -53,6 +53,9 @@ supports them.spans, error logs, metrics, and monitors — split across `prod-eu`and `prod-us` (and `prod-hipaa` / `prod-jp` when relevant). Always checkregional disparity first; it usually rules whole hypotheses in or out.+ Use [`datadog-query-recipes`](../datadog-query-recipes/SKILL.md) for+ reusable tenant, public API, queue consumer, and cross-environment query+ shapes.4. **Cluster the errors.** Group by `(projectId, error.message)` or`(error.type, error.message)`. Treat each distinct cluster as its own@@ -107,6 +110,9 @@ do not invent root causes.## Cross-References+- Production telemetry query recipes, tenant/public API usage, and queue+ consumer measurements:+ [`datadog-query-recipes`](../datadog-query-recipes/SKILL.md)- Backend layout, queue contracts, instrumentation patterns:[`backend-dev-guidelines`](../backend-dev-guidelines/SKILL.md)- ClickHouse-related findings (memory ceilings, JOIN spills, slow queries):diff --git a/.agents/skills/debug-issue-with-datadog/references/datadog-playbook.md b/.agents/skills/debug-issue-with-datadog/references/datadog-playbook.mdindex a34781a22c..cb0ccf4474 100644--- a/.agents/skills/debug-issue-with-datadog/references/datadog-playbook.md+++ b/.agents/skills/debug-issue-with-datadog/references/datadog-playbook.md@@ -45,6 +45,14 @@ If `aggregate_spans` returns no results, check:- the time window covers when the issue was actually firing;- the region tag matches reality (the EU MCP only sees EU traces).+### Public API tenant / legacy-endpoint usage++For tenant-specific public API route usage, use+[`../../datadog-query-recipes/references/public-api-tenant-usage.md`](../../datadog-query-recipes/references/public-api-tenant-usage.md).+The key gotcha is that tenant tags usually live on the `api-auth-verify` child+span while the HTTP route lives on the request root span, so correlate by+`traceid` rather than relying on one combined span filter.+## 2. Log Sweep — read what the handler saidLogs are the right tool for *messages* the handler emitted. Spans are thediff --git a/.agents/skills/debug-issue-with-datadog/references/repo-debug-map.md b/.agents/skills/debug-issue-with-datadog/references/repo-debug-map.mdindex b1302f2d07..8d80d86dd8 100644--- a/.agents/skills/debug-issue-with-datadog/references/repo-debug-map.md+++ b/.agents/skills/debug-issue-with-datadog/references/repo-debug-map.md@@ -33,17 +33,28 @@ name constants live inFor queues using BullMQ default spans (no `instrumentAsync` wrapper), searchAPM with `service:worker operation_name:bullmq.process` filtered by-`bullmq.queue:<queue-name>`.+`bullmq.queue:<queue-name>`. For queue inventory, sharded queue naming, and+queue metric recipes, use+[`../../datadog-query-recipes/references/queue-consumers.md`](../../datadog-query-recipes/references/queue-consumers.md).## Web (Next.js / tRPC / public API)| Subsystem | Code | Span / log filter || --- | --- | --- |-| Public REST API | `web/src/pages/api/public/**` | `service:web resource_name:"GET /api/public/<path>"` |+| Public REST API | `web/src/pages/api/public/**` | Request span: `service:web resource_name:"GET /api/public/<path>"`; tenant span: `resource_name:api-auth-verify` with `@langfuse.project.id` / `@langfuse.org.id` || tRPC procedures | `web/src/server/api/routers/**` | `service:web resource_name:"POST /api/trpc/<router>.<proc>"` || Auth / API key verification | `web/src/features/public-api/server/apiAuth.ts` | look for `verifyAuthHeaderAndReturnScope` spans || Stripe billing | `web/src/ee/features/billing/server/stripeBillingService.ts` | wrapped in `instrumentAsync`; spans named after the method |+For tenant-specific public API usage questions, first query+`resource_name:api-auth-verify` by `@langfuse.project.id` or+`@langfuse.org.id`, then open representative trace IDs and inspect the request+root span for `http.path_group`, `http.route`, and `http.target`. The tenant+tags and endpoint path are usually on different spans, so a single-span query+combining both may return no results even when the trace proves usage.+For the full reusable recipe, use+[`../../datadog-query-recipes/references/public-api-tenant-usage.md`](../../datadog-query-recipes/references/public-api-tenant-usage.md).+## Shared LayersThese are not subsystems on their own, but are *frequently the actual cause*diff --git a/.agents/skills/detect-prod-regressions/SKILL.md b/.agents/skills/detect-prod-regressions/SKILL.mdindex 3540ac2e71..68732fe178 100644--- a/.agents/skills/detect-prod-regressions/SKILL.md+++ b/.agents/skills/detect-prod-regressions/SKILL.md@@ -71,8 +71,11 @@ Linear.Before querying Datadog, load the relevant Datadog MCP guidance for logs,traces, metrics, and visualizations. Use the existing-[`debug-issue-with-datadog`](../debug-issue-with-datadog/SKILL.md) playbook-when you need query syntax, repo mapping, or trace drill-down patterns.+[`datadog-query-recipes`](../datadog-query-recipes/SKILL.md) skill for query+syntax, production environment coverage, tenant/public API usage, and queue+consumer measurements. Use+[`debug-issue-with-datadog`](../debug-issue-with-datadog/SKILL.md) when a+candidate regression becomes an incident-style root-cause analysis.For each environment, check: