# Wetech Dashboard Component Logs

<!-- auto-oncall-optimization-record
{
  "schemaVersion": "auto-oncall-optimization-record-v1",
  "optimizationId": "wetech-dashboard-logs-2026-07-23",
  "problems": [
    {
      "problemId": "wetech-component-logs-depend-on-loki-datasource",
      "summary": "Wetech component log diagnosis incorrectly depends on a Grafana Loki datasource instead of TiDB Dashboard log search.",
      "status": "ineffective",
      "issueKeys": ["APID-29215"],
      "sourceRefs": ["https://tidb.atlassian.net/browse/APID-29215#problem:ai_gap:wetech-dashboard-logs"],
      "signalTextIncludesAny": ["loki datasource", "dashboard logs", "component logs unavailable", "日志接口不可用", "找不到 loki"],
      "observedThrough": "2026-07-23",
      "effectiveAt": null,
      "verifiedAt": "2026-07-23T10:54:19Z",
      "attemptedAction": "A Dashboard log task-group path was tested, then removed and deployed disabled because it can cause unsafe PD memory growth; the unverified Loki command was removed at the same time.",
      "evidenceUrl": null
    }
  ]
}
-->

- Optimization ID: `wetech-dashboard-logs-2026-07-23`
- Owner: external `wetech-op-grafana` skill and auto-oncall
- Source reference: `APID-29215`; external skill source
  `/home/nizheming/wetech-op-grafana/wetech-op-grafana`
- Problem: Wetech TiDB component log diagnosis attempted to resolve a Grafana
  Loki datasource. The supported provider path is TiDB Dashboard log search,
  so a missing Loki datasource incorrectly stopped root-cause investigation.
- Capability: bounded TiDB, TiKV, TiFlash, and PD log search for Wetech OP
  diagnosis.
- Implementation status: the unsafe Dashboard task-group path and the
  unsupported Loki command were removed and deployed to staging
- Effective status: `ineffective`

## Local validation

- Removed the `browser-query-logs` and Loki datasource selection path.
- A bounded `dashboard-query --kind logs` prototype reached the provider, but
  the command and all `/api/logs/taskgroup` calls were then removed because log
  search can cause unsafe PD memory growth.
- Updated `java-back` to use the confirmed SaaS SG Dashboard entry
  `phkymwfdqy.pzero.perimeter81.com` and explicit Dashboard cluster name.
- The external skill contract now requires that no component log command or
  `/api/logs/taskgroup` request path is exposed.
- Skill validation and Python compilation passed.
- A live `java-back` historical query for the `APID-29215` incident window
  reached all three TiKV targets, completed Dashboard task group `18`, and
  returned the warning signature `skip invalid split key` for Region `139429`.

## Deployment verification

- At `2026-07-23T10:54:19Z`, the updated external skill was published to the
  staging `auto-oncall-services-codex-skills` PVC. The previous exact
  `wetech-op-grafana` directory was retained as
  `wetech-op-grafana.backup-before-disable-logs-20260723`.
- Deployment generation `208` rolled out pod
  `auto-oncall-services-5fd66bc499-h7f6r` on image
  `c64cddad242b5d443d1c19273f3bd19142983204`.
- The live installed script SHA-256 is
  `157cae1552a69e8155505c87063e4bc6e34be0557f0d7f14a40d42665d35e94b`.
  Its CLI exposes no `browser-query-logs` command, `dashboard-query --kind`
  accepts only `topsql`, `statements`, and `slow-query`, and the source
  contains neither `/api/logs/taskgroup` nor a Loki query path.
- The live pod reported both `/healthz` and `/readyz` as HTTP 200, installed
  `wetech-op-grafana` from the PVC, completed its poll cycle, and reported an
  idle worker. The database had no `queued` or `running` jobs.

## Unresolved gaps

- Wetech component logs remain unavailable to automated diagnosis.
- `APID-29215` must use bounded metrics and existing ticket evidence only; the
  stable Jira internal comment has not been refreshed after this safety change.
- Do not repeat the Dashboard task-group implementation without a new
  PD-memory-safe provider design and explicit approval.

## Next validation action

Keep component log search disabled. Revisit only after a provider-side
PD-memory-safe log API or equivalent isolation is available and explicitly
approved.
