{
  "license": "CC BY 4.0",
  "licenseUrl": "https://creativecommons.org/licenses/by/4.0/",
  "recipe": {
    "slug": "top-error-fingerprints",
    "title": "Rank Error Fingerprints by Customer Impact",
    "testedWith": "Apache DataFusion 45.2.0",
    "lastReviewed": "2026-07-27"
  },
  "contract": {
    "tableName": "api_requests",
    "schema": [
      {
        "name": "timestamp_utc",
        "type": "Timestamp",
        "description": "Failure time."
      },
      {
        "name": "error_fingerprint",
        "type": "Utf8",
        "description": "Stable normalized error group."
      },
      {
        "name": "team_id",
        "type": "Utf8",
        "description": "Safe affected account identifier."
      },
      {
        "name": "status_code",
        "type": "Int64",
        "description": "HTTP status code."
      }
    ]
  },
  "query": "SELECT\n  error_fingerprint,\n  COUNT(*) AS occurrences,\n  COUNT(DISTINCT team_id) AS affected_teams\nFROM api_requests\nWHERE timestamp_utc >= now() - INTERVAL '24 hours'\n  AND status_code >= 500\n  AND error_fingerprint IS NOT NULL\nGROUP BY error_fingerprint\nORDER BY affected_teams DESC, occurrences DESC\nLIMIT 20;",
  "fixtureKind": "schema-example",
  "inputRows": [
    {
      "timestamp_utc": "2026-07-28T10:00:00Z",
      "error_fingerprint": "none",
      "team_id": "team_id_example_1",
      "status_code": 200
    },
    {
      "timestamp_utc": "2026-07-28T11:00:00Z",
      "error_fingerprint": "dependency_timeout",
      "team_id": "team_id_example_2",
      "status_code": 503
    },
    {
      "timestamp_utc": "2026-07-28T12:00:00Z",
      "error_fingerprint": "none",
      "team_id": "team_id_example_3",
      "status_code": 200
    }
  ],
  "illustrativeInputRows": [
    {
      "timestamp_utc": "2026-07-28T10:00:00Z",
      "error_fingerprint": "none",
      "team_id": "team_id_example_1",
      "status_code": 200
    },
    {
      "timestamp_utc": "2026-07-28T11:00:00Z",
      "error_fingerprint": "dependency_timeout",
      "team_id": "team_id_example_2",
      "status_code": 503
    },
    {
      "timestamp_utc": "2026-07-28T12:00:00Z",
      "error_fingerprint": "none",
      "team_id": "team_id_example_3",
      "status_code": 200
    }
  ],
  "expectedOutput": {
    "columns": [
      "error_fingerprint",
      "occurrences",
      "affected_teams"
    ],
    "rows": [
      {
        "error_fingerprint": "checkout.tax_service_timeout",
        "occurrences": 184,
        "affected_teams": 73
      },
      {
        "error_fingerprint": "sync.oauth_token_expired",
        "occurrences": 920,
        "affected_teams": 18
      },
      {
        "error_fingerprint": "report.pdf_render_failed",
        "occurrences": 44,
        "affected_teams": 16
      }
    ]
  },
  "notes": [
    "The compact input rows demonstrate field names and JSON types; they are not claimed to generate the displayed aggregate by themselves.",
    "The expected output is deterministic synthetic review data for the documented output shape.",
    "Adapt time windows, thresholds, identities, and business definitions before operational use."
  ]
}