agentleFS
PackmindHubPackmindHub/packmind/.agents/skills/datadog-analysis/SKILL.md

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.

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
  1. Very specific:

    Read references/datadog_mcp.md before making any MCP tool calls for guidance on tool usage, gotchas, and known pitfalls.

    line 13
  2. Distinctive:

    When filtering in Phase 1, exclude these patterns from the analysis by appending the exclusion terms to Datadog queries, or remove them …

    line 40
  3. Very specific:

    Every Datadog MCP call requires a telemetry object with an intent string describing the call's purpose (e.g., {"intent": "Discover error …

    line 48
  4. Very specific:

    Before grepping, consult references/known_patterns.md — if the error matches a catalogued pattern, jump straight to its entry point and …

    line 87
  5. Very specific:

    Read references/report-template.md before writing the report for the output path, scaffold, severity ordering, occurrence labels, and final …

    line 101

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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 /mcp first.
  • Read references/datadog_mcp.md before 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 serviceAppCodebaseDockerfileRuntime
api-proprietaryAPIapps/api/ + all packages/dockerfile/Dockerfile.apiNode.js (NestJS, TypeORM, Redis/ioredis, BullMQ)
frontend-proprietaryFrontendapps/frontend/dockerfile/Dockerfile.frontendNginx (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

ParameterDefaultDescription
Days to analyze7Number 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 cached index.html request old hashed JS chunks that no longer exist. Not a bug. Filter with -"No such file or directory" -"/assets/" on frontend-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.

  1. Pattern discovery -- Use mcp__datadog-mcp__search_datadog_logs with:
    • query: service:{service_name} status:(error OR critical OR emergency)
    • from: now-{N}d (where N = number of days, default 7)
    • use_log_patterns: true
    • max_tokens: 10000
  2. Error message counts -- Use mcp__datadog-mcp__analyze_datadog_logs with:
    • 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 50
    • from: now-{N}d
    • max_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:

  1. Fetch raw logs -- Use search_datadog_logs with a targeted query to get full stack traces and context. Use extra_fields: ["*"] for tag metadata when useful.
  2. Get daily distribution -- Use analyze_datadog_logs with:
    • 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)
  3. Count occurrences -- Use analyze_datadog_logs to 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.

  1. Grep for the error class or message in the codebase using the Grep tool (e.g., SpaceMembershipRequiredError, Recipe.*not found)
  2. Read the source files where the error is thrown
  3. Trace the call chain: error class -> service/use case -> controller/adapter
  4. Identify the root cause: missing error handling, wrong HTTP status, race condition, missing validation, Dockerfile misconfiguration, etc.

For frontend Nginx errors, check:

  • dockerfile/Dockerfile.frontend for permission/ownership issues
  • dockerfile/nginx.k8s.conf, dockerfile/nginx.k8s.no-ingress.conf, dockerfile/nginx.compose.conf for config issues
  • dockerfile/nginx-entrypoint.sh for 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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.