Obs Query
Execute arbitrary PromQL or LogQL queries and present results.
Query type detection
- LogQL: starts with
{(stream selector) → route to Loki - PromQL: everything else → route to Prometheus
How to execute
PromQL instant query
scripts/obs-api.sh prom /api/v1/query --raw --jq '.data.result' --data-urlencode "query=<EXPR>"
PromQL range query
scripts/obs-api.sh prom /api/v1/query_range --raw --jq '.data.result' --data-urlencode "query=<EXPR>" --data-urlencode "start=$(date -v-1H +%s)" --data-urlencode "end=$(date +%s)" --data-urlencode "step=60"
LogQL query
scripts/obs-api.sh loki /loki/api/v1/query_range --raw --jq '.data.result' --data-urlencode "query=<EXPR>" --data-urlencode "limit=20"
Examples
For a comprehensive list of PromQL and LogQL examples, read references/examples.md in this skill directory.
Output
For output format options (table/csv/json), read .claude/skills/obs-shared/assets/output-formats.md.
Instructions
- Take the user's query from the skill argument (everything after
/obs-query) - If no query provided, read
references/examples.mdand show common examples - Detect query type and execute with appropriate endpoint
- Format results as table (instant vectors), summary (range), or log lines
- If query fails, show the error and suggest fixes
- Safety: read-only GET queries only — never POST, PUT, DELETE, or admin endpoints