# Wetech Datasource Name Fallback

<!-- auto-oncall-optimization-record
{
  "schemaVersion": "auto-oncall-optimization-record-v1",
  "optimizationId": "wetech-datasource-name-fallback-2026-07-23",
  "problems": [
    {
      "problemId": "wetech-panel-datasource-name-cannot-query-prometheus",
      "summary": "A datasource selected from Grafana dashboard panels by name cannot be used for Prometheus queries when the list API omits its numeric id.",
      "status": "optimized_verified",
      "issueKeys": ["APID-29226"],
      "sourceRefs": ["https://tidb.atlassian.net/browse/APID-29226#problem:diagnostic_gap:datasource-name-fallback"],
      "signalTextIncludesAny": ["selected datasource has no id", "dashboard_panels", "datasource name fallback"],
      "observedThrough": "2026-07-23",
      "effectiveAt": "2026-07-23T15:59:00+08:00",
      "verifiedAt": "2026-07-23T16:05:32+08:00",
      "attemptedAction": "Resolve a panel-derived datasource name through the Grafana datasource API and query by UID when available or numeric ID otherwise.",
      "evidenceUrl": "https://tidb.atlassian.net/browse/APID-29226?focusedCommentId=23269769"
    }
  ]
}
-->

- Optimization ID: `wetech-datasource-name-fallback-2026-07-23`
- Owner: wetech-op-grafana skill
- Source reference: `APID-29226`
- Bounded problem: `browser-query-range` could select the exact `btwallet`
  datasource name from dashboard panel JSON, but then required a numeric ID
  that the fallback record did not contain.
- Implementation status: published to the staging skill PVC and loaded by the
  staging pod.
- Effective status: `optimized_verified`.

## Verification evidence

- Pre-change replay `fee2eef3-3f94-4412-b089-f9e36d5a70ad` tried both
  configured Grafana origins and failed with `selected datasource has no id`.
- The current external skill contract suite passed on 2026-07-23: 22 tests, 0
  failures; the skill package validator also passed.
- A temporary copy of the updated skill was exercised against the staging
  browser session without replacing the installed skill. The same bounded
  `btwallet` TiKV process-start query returned HTTP 200 with 3 series and 723
  points, proving that the panel-derived datasource name was resolved to a
  usable Grafana proxy target.
- Post-deployment write replay `1398d45f-8abf-453c-add1-f088e6b15eab`
  used the installed skill through datasource proxy ID `2`, returned TiKV
  process-start and availability series, and wrote the bounded evidence into
  the run workspace without exposing authentication data.

## Unresolved gaps

- None for the datasource-name-to-proxy conversion problem.

## Next validation action

Monitor later panel-derived datasource queries for Grafana API contract changes.
