datadog-analysis
Skill321 starsChanged 54 days agoApache-2.0View on GitHub
Analyze Datadog error logs for Packmind production services (api-proprietary, frontend-proprietary), group them into patterns, root-cause against the codebase, and produce a structured bug report. Triggers on Datadog, production logs, prod errors, service health, or periodic error reviews.
In this repository92 other files it gives its agents.
- AGENTS.mdAGENTS.md
- apps/AGENTS.mdAGENTS.md
- packages/AGENTS.mdAGENTS.md
- apps/CLAUDE.mdCLAUDE.md
- CLAUDE.mdCLAUDE.md
- packages/CLAUDE.mdCLAUDE.md
- .cursor/rules/packmind/standard-backend-tests-redaction.mdcCursor rule
- .cursor/rules/packmind/standard-changelog.mdcCursor rule
- .cursor/rules/packmind/standard-code-comments.mdcCursor rule
- .cursor/rules/packmind/standard-compliance-logging-personal-information.mdcCursor rule
- .cursor/rules/packmind/standard-typescript-good-practices.mdcCursor rule
- agent-skill-frontmatter-auditSkill
- amplitude-listener-events-adoptionSkill
- cli-e2e-test-authoringSkill
- doc-auditSkill
- feature-specSkill
- feature-sprintSkill
- packmind-onboardSkill
- packmind-update-playbookSkill
- playbook-cli-auditSkill
- product-mapSkill
- qa-reviewSkill
- release-proprietarySkill
- upgrade-runtime-stackSkill
- working-with-playground-appSkill
- working-with-pm-design-kitSkill
- agentic-design-sessionSkill
- agentic-doc-ingestSkill
- agentic-feature-framingSkill
- agentic-orchestratorSkill
- agent-skill-frontmatter-auditSkill
- amplitude-listener-events-adoptionSkill
- cli-e2e-test-authoringSkill
- create-run-e2e-testsSkill
- creating-end-user-documentation-for-packmindSkill
- datadog-analysisSkill
- doc-auditSkill
- feature-flags-auditSkill
- feature-flags-authoringSkill
- feature-specSkill
- feature-sprintSkill
- how-to-write-typeorm-migrations-in-packmindSkill
- improve-claude-mdSkill
- packmind-onboardSkill
- packmind-update-playbookSkill
- playbook-cli-auditSkill
- product-mapSkill
- qa-reviewSkill
- release-proprietarySkill
- upgrade-runtime-stackSkill
- working-with-playground-appSkill
- working-with-pm-design-kitSkill
- agent-skill-frontmatter-auditSkill
- amplitude-listener-events-adoptionSkill
- cli-e2e-test-authoringSkill
- creating-end-user-documentation-for-packmindSkill
- datadog-analysisSkill
- doc-auditSkill
- feature-flags-auditSkill
- feature-flags-authoringSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 1 is distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 13
Read references/datadog_mcp.md before making any MCP tool calls for guidance on tool usage, gotchas, and known pitfalls.
- Distinctive: line 40
When filtering in Phase 1, exclude these patterns from the analysis by appending the exclusion terms to Datadog queries, or remove them …
- Very specific: line 48
Every Datadog MCP call requires a telemetry object with an intent string describing the call's purpose (e.g., {"intent": "Discover error …
- Very specific: line 87
Before grepping, consult references/known_patterns.md — if the error matches a catalogued pattern, jump straight to its entry point and …
- Very specific: line 101
Read references/report-template.md before writing the report for the output path, scaffold, severity ordering, occurrence labels, and final …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Datadog Analysis
Analyze production error logs from Packmind Datadog services, group them into patterns, cross-reference stack traces with the codebase, and produce a structured markdown report with root causes and Datadog search patterns.
Prerequisites
- The Datadog MCP server must be connected. If not connected, prompt the user to run
/mcpfirst. - Read
references/datadog_mcp.mdbefore making any MCP tool calls for guidance on tool usage, gotchas, and known pitfalls.
Services
The analysis covers two production services. Each maps to a Datadog service name, a codebase location, and a Dockerfile:
| Datadog service | App | Codebase | Dockerfile | Runtime |
api-proprietary | API | apps/api/ + all packages/ | dockerfile/Dockerfile.api | Node.js (NestJS, TypeORM, Redis/ioredis, BullMQ) |
frontend-proprietary | Frontend | apps/frontend/ | dockerfile/Dockerfile.frontend | Nginx (static SPA serving) |
Root cause analysis should trace errors back to source files in the monorepo. For Nginx (frontend), also check the Nginx configs in dockerfile/nginx.*.conf and the entrypoint dockerfile/nginx-entrypoint.sh.
Parameters
| Parameter | Default | Description |
| Days to analyze | 7 | Number of past days to look at. Override by user request (e.g., "last 3 days") |
Exclusions
The following log patterns should be discarded and not included in the report. Skip them during pattern discovery and do not count them as errors:
(node:1) [DEP0060] DeprecationWarning: The util._extend API is deprecated. Please use Object.assign() instead.-- Known Node.js deprecation from a transitive dependency. Noise, not actionable. Filter with-DEP0060.- Nginx stale asset 404s (
open() "/usr/share/nginx/html/assets/..." failed (2: No such file or directory)) -- Expected SPA behavior after deployments. Browsers with a cachedindex.htmlrequest old hashed JS chunks that no longer exist. Not a bug. Filter with-"No such file or directory" -"/assets/"onfrontend-proprietary.
When filtering in Phase 1, exclude these patterns from the analysis by appending the exclusion terms to Datadog queries, or remove them during report consolidation.
Workflow
Phase 1: Discover Error Patterns (all services in parallel)
For each of the two services, launch two parallel MCP calls (4 calls total, all in parallel). If rate-limited by the MCP server, fall back to batching 2 calls per service sequentially.
Every Datadog MCP call requires a telemetry object with an intent string describing the call's purpose (e.g., {"intent": "Discover error patterns for api-proprietary over last 7 days"}). Keep intents concise and avoid including PII or secrets.
- Pattern discovery -- Use
mcp__datadog-mcp__search_datadog_logswith:query:service:{service_name} status:(error OR critical OR emergency)from:now-{N}d(where N = number of days, default 7)use_log_patterns:truemax_tokens:10000
- Error message counts -- Use
mcp__datadog-mcp__analyze_datadog_logswith:filter:service:{service_name} status:(error OR critical OR emergency)sql_query:SELECT message, count(*) as cnt FROM logs GROUP BY message ORDER BY cnt DESC LIMIT 50from:now-{N}dmax_tokens:10000
From these results, identify the distinct error groups per service. If a service has zero errors in the period, mention "No issues found" in the report and skip Phases 2-3 for that service.
Phase 2: Deep Dive Each Error Group
For each distinct error group identified in Phase 1:
- Fetch raw logs -- Use
search_datadog_logswith a targeted query to get full stack traces and context. Useextra_fields: ["*"]for tag metadata when useful. - Get daily distribution -- Use
analyze_datadog_logswith:sql_query:SELECT DATE_TRUNC('day', timestamp) as day, count(*) as cnt FROM logs WHERE message LIKE '%<pattern>%' GROUP BY DATE_TRUNC('day', timestamp) ORDER BY DATE_TRUNC('day', timestamp)
- Count occurrences -- Use
analyze_datadog_logsto get total unique occurrences grouped by message.
Parallelize independent MCP calls wherever possible to save time.
Frontend-Specific Notes
For frontend-proprietary, Nginx writes all error_log output (including [notice]) to stderr. Datadog classifies stderr as status:error. Filter out Nginx lifecycle noise:
- Ignore patterns containing
[notice](worker start/stop, SIGQUIT, SIGCHLD, SIGIO) -- these are normal Nginx operations misclassified as errors - Focus on
[error](404s for missing files) and[alert](permission issues, config errors)
Phase 3: Codebase Root Cause Analysis
For each application-level error (not infra/external):
Before grepping, consult references/known_patterns.md — if the error matches a catalogued pattern, jump straight to its entry point and skip to step 2.
- Grep for the error class or message in the codebase using the Grep tool (e.g.,
SpaceMembershipRequiredError,Recipe.*not found) - Read the source files where the error is thrown
- Trace the call chain: error class -> service/use case -> controller/adapter
- Identify the root cause: missing error handling, wrong HTTP status, race condition, missing validation, Dockerfile misconfiguration, etc.
For frontend Nginx errors, check:
dockerfile/Dockerfile.frontendfor permission/ownership issuesdockerfile/nginx.k8s.conf,dockerfile/nginx.k8s.no-ingress.conf,dockerfile/nginx.compose.conffor config issuesdockerfile/nginx-entrypoint.shfor entrypoint issues
Phase 4: Generate Report
Read references/report-template.md before writing the report for the output path, scaffold, severity ordering, occurrence labels, and final summary table.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

