# Studio Plan E: Metric Entry Grafana Links

## Summary

Add a direct link beside each metric entry so users can jump from Studio metrics
to the corresponding Clinic/Grafana query.

Use the existing generated PromQL link as the first implementation. Fixed panel
links discovered through `grafana-panel-finder` are useful, but should be a
later enhancement instead of a hard dependency for evidence collection.

This plan only changes metric entry links. It does not change Key Evidence,
Quick Links, Studio width, or TiDB/TiKV CPU chart grouping.

## Recommendation

Implement generated PromQL links first.

Generated PromQL links are the better default because they point to the exact
query used to collect the evidence. They work for standard metrics, ad-hoc
PromQL, GC checks, TiKV Thread CPU, nodegroup-specific metrics, and future
derived evidence.

Fixed panel links should be optional because they require reliable panel
matching through `grafana-panel-finder`. They are best added later as
`panel_link` when the match is high confidence.

## Key Changes

- In metrics entry lists, render a small external-link action when `metric.link`
  is present.
- The link should open in a new tab.
- Do not render disabled or empty link controls when no link is available.
- Keep link text/icon compact so long URLs do not affect layout.
- Reserve optional future support for `metric.panel_link`:
  - `metric.link`: exact generated PromQL/Clinic query link
  - `metric.panel_link`: optional fixed Grafana dashboard panel link
- Do not require `grafana-panel-finder` in this first implementation.

## Test Plan

- Open metrics evidence where entries contain `metric.link`; verify each entry
  shows a link action.
- Click links for CPU, latency, GC, and log-derived metric examples; verify they
  open the matching Clinic/Grafana query time window.
- Verify entries without `link` do not show a dead action.
- Verify long URLs do not wrap into or stretch the metric card.
- Verify keyboard/mouse accessibility is preserved for the link action.

## Assumptions

- Existing metric records already include generated `link` for most metric
  groups.
- Missing links should be handled gracefully rather than synthesized in the UI.
- Fixed panel lookup is a separate enhancement and should not block this smaller
  UI improvement.
