Skip to content

Instantly share code, notes, and snippets.

@quiiver
Created April 3, 2026 15:48
Show Gist options
  • Select an option

  • Save quiiver/f2a43ffe383244e034a2c2257246a85b to your computer and use it in GitHub Desktop.

Select an option

Save quiiver/f2a43ffe383244e034a2c2257246a85b to your computer and use it in GitHub Desktop.

Plan: Tag Grafana Dashboards with app_code Tags

Phase 0: Documentation & API Confirmation

Findings:

  • mcp__grafana__update_dashboard supports patching $.tags via JSONPath
  • Append: {"op": "add", "path": "$.tags/- ", "value": "app_code=fxa"}
  • Replace: {"op": "replace", "path": "$.tags", "value": ["app_code=fxa", ...]}
  • Folders cannot be tagged — only dashboards
  • Must read existing tags first, then replace with merged array to avoid clobbering

Anti-patterns:

  • Don't blindly append if $.tags is null/missing
  • No filter expressions in JSONPath — only numeric indices
  • Don't attempt to tag folders

Phase 1: List Dashboards per Folder and Read Existing Tags

For each folder in the mapping, search for all dashboards, then read current tags via get_dashboard_property(uid, "$.tags").

33 folder-to-app_code mappings across 26 tenants:

Confidence Count App Codes
High 25 folders 0din, amo, autograph, autopush, balrog, bugbug, bugzilla, classify-client, cinder, common-voice (x2), crlite, ctms, dap, fakespot, fxa, merino, monitor, pontoon, relay, remote-settings, sumo, sync (x2), taskcluster, vpn
Medium 5 folders ads, basket, bedrock, vpn (Guardian), socorro

Phase 2: Apply Tags (High Confidence Folders)

For each dashboard in high-confidence folders:

  1. Read existing tags
  2. Skip if app_code=<tenant> already present
  3. Build merged tag array: existing + ["app_code=<tenant>"]
  4. Apply via update_dashboard replace operation

Process in order of 90-day activity:

  1. fxa (743 views, 25 dashboards)
  2. merino (429 views, 5 dashboards)
  3. taskcluster (294 views, 8 dashboards)
  4. sync (225 views, 15 dashboards, 2 folders)
  5. bugzilla (178 views)
  6. autopush, autograph, relay, monitor
  7. Remaining high-confidence folders

Verification: Search by tag app_code=<tenant> after each folder.

Phase 3: Apply Tags (Medium Confidence Folders)

Same process for:

  • ads-engineering → app_code=ads
  • Basket → app_code=basket
  • Bedrock / www.mozilla.orgapp_code=bedrock
  • Guardian → app_code=vpn
  • crash-ingestion → app_code=socorro

Extra caution: Shared folders (svcops) may contain multi-tenant dashboards — only tag where slug/title clearly matches.

Phase 4: Tag Orphan Dashboards

Dashboards in shared folders matched to tenants by the 90-day activity cross-reference:

Dashboard UID Tag
AMO CsSDyxTZ1 app_code=amo
Autograph gohbKM0WZ app_code=autograph
Bouncer - v2 eesc80sgxn30ge app_code=bouncer

Phase 5: Verification & Report

  1. Search Grafana for app_code=<tenant> per tenant
  2. Compare counts against cross-reference
  3. Update the Confluence report with tagging results

Want me to start executing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment