--- name: observe-lens-telemetry description: >- Query observability tools read-only for runtime evidence: logs (Loki, LogQL), traces (Tempo, TraceQL, spans and timings), metrics (Prometheus, PromQL: error rates, latency, restarts, CPU and memory), firing alerts and dashboards, through Grafana or directly against Prometheus, Loki and Tempo. Use this whenever the user asks what a service logged, why a request, order, call or job failed at runtime, which downstream call was slow or errored, whether errors or latency spiked, whether pods restarted, what an alert means, how a release changed error rates, or wants a dashboard or Explore link, even if they only give a trace id, request id, error message or time window and do not say Grafana, Loki, Tempo or Prometheus. Read-only; not for building or editing dashboards, alert rules or silences. compatibility: >- Python 3.11+ (standard library only) on macOS, Linux or Windows, network access, and an instance in ~/.config/observe-lens/telemetry (see references/setup.md). license: Apache-2.0 metadata: version: "1.0.1" --- # observe-lens: telemetry Query logs, traces, metrics and alerts to back an investigation with runtime evidence: what the service logged, which span failed, whether errors spiked or pods restarted. Run scripts with `python3`; on Windows use `python` or `py -3` if `python3` is not found. Paths below are relative to this skill's folder. ## Inputs - What to look for: a trace id, request or correlation id, record id, error text, service, or a symptom. - When: a time window. If the user gives none, derive it from other evidence (a CI run, a deploy time, a database timestamp, a ticket) and keep it tight, minutes rather than days, because log and trace searches are slow and capped. - Where: the instance (`config list`) and the environment, namespace or service label the user's notes define. ## Step 0: Read-command permission The first time this skill is used in a session, before running any command, ask the user once (with the multiple-choice question tool if there is one): 1. **Ask every time**: confirm each read command before running it. 2. **Auto-run reads for this skill**: run this skill's read commands without asking for the rest of the session. 3. **Auto-run reads for all observe-lens skills**: the same for `observe-lens`, `observe-lens-pipelines`, `observe-lens-cd`, `observe-lens-db` and `observe-lens-telemetry` for the rest of the session. Skip the question if the user already picked option 3 in another observe-lens skill this session, or option 2 for this skill. Keep the choice for the session; the user can change it at any time ("ask me again", "stop auto-running"). - **Read commands** (covered by options 2 and 3): every `scripts/telemetry.py` subcommand except `config init` and `config add` (`whoami`, `datasources`, `dashboards`, `logs`, `labels`, `metric`, `metric-range`, `traces`, `trace`, `alerts`, `link`, `get`, `config list|check|path|knowledge`). They only send GET requests (Grafana is queried through its datasource proxy). - **Any other read-only operation** (also covered by options 2 and 3, on any OS or shell): commands that only list, read, search or inspect, such as listing files and folders, reading or searching non-secret files, and checking tool versions, processes, open ports, environment variables or the time (for example `ls`/`dir`/`Get-ChildItem`, `cat`/`type`/`Get-Content`, `grep`/`findstr`/`Select-String`). If a command could change anything, treat it as state-changing. Reading credential files is never covered (see Rules). - **Production instances ask once, whatever the choice.** Before the first command against an instance that `config list` marks `confirm=yes` (environment `prod`, `production`, `prd` or `live` unless the instance sets `"confirm": false`, or any instance with `"confirm": true`), name the instance and ask once. Later reads against it follow the choice above for the rest of the session. Production systems are shared and hold real customer data, so a deliberate first look is worth one question. - **Always ask, whatever the choice**, for anything that creates, updates, deletes or otherwise changes state: `config init`, editing files under the observe-lens config folder, installing anything. One yes covers that one action only. Creating or editing dashboards, alert rules, silences, annotations or datasources stays off even when asked: tell the user what to change instead. ## Workflow 1. **Check access.** `python3 scripts/telemetry.py config check`, then `python3 scripts/telemetry.py --instance whoami`. On an error, give the user the fix from `references/setup.md`. 2. **Read the user's notes.** `python3 scripts/telemetry.py config knowledge` lists notes on datasources, label names, namespaces, service names, id fields and useful queries. Read them before writing a query; label names are the most common wrong guess. 3. **Pick the signal** (read `references/query-cookbook.md` for ready-made LogQL, TraceQL and PromQL): - What a service logged about an id or error → logs: `telemetry.py logs '' --from --to --limit 200`. Unsure of label names? `telemetry.py labels [