query-metrics
Runs metrics queries against Axiom MetricsDB via scripts. Discovers available metrics, tags, and tag values. Use when asked to query metrics, explore metric datasets, check metric values, or investigate OTel metrics data.
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o query-metrics.zip https://jpskill.com/download/23396.zip && unzip -o query-metrics.zip && rm query-metrics.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/23396.zip -OutFile "$d\query-metrics.zip"; Expand-Archive "$d\query-metrics.zip" -DestinationPath $d -Force; ri "$d\query-metrics.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
query-metrics.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
query-metricsフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 9
📖 Claude が読む原文 SKILL.md(中身を展開)
この本文は AI(Claude)が読むための原文(英語または中国語)です。日本語訳は順次追加中。
Querying Axiom Metrics
All script paths are relative to this skill's folder; invoke as scripts/<name>. The target dataset must be of kind otel:metrics:v1.
Setup, prerequisites, and ~/.axiom.toml configuration: see README.md. Edge-deployment routing is automatic — the scripts read each dataset's edgeDeployment and route to the right regional endpoint without configuration.
Workflow
scripts/datasets <deploy> --kind otel:metrics:v1— list metrics datasets.scripts/metrics-spec <deploy> <dataset>— required before composing any query. MPL evolves; the spec is the source of truth.scripts/metrics-info <deploy> <dataset> metrics— list metrics with{type, temporality, unit}metadata. Read this before writing the query (see Choosing a Query Shape).scripts/metrics-info <deploy> <dataset> tags [<tag> values]— explore filter dimensions.scripts/metrics-query <deploy> '<MPL>' <start> <end>— execute. Iterate.
If the user names a specific entity (service, host, …), scripts/metrics-info <deploy> <dataset> find-metrics "<value>" finds the metrics carrying it. find-metrics searches tag values, not metric names — don't use it for general discovery.
Choosing a Query Shape
The metrics-info listing returns each metric's {type, temporality, unit}. Read these before composing — never assume a metric is a simple scalar.
| Field | Values | Drives |
|---|---|---|
type |
Gauge, CounterMonotonic, CounterNonMonotonic, Histogram |
Required pre-aggregation operators. |
temporality |
Cumulative, Delta, null |
Whether counter values are running totals or per-interval deltas. null is normal for Gauges. |
unit |
UCUM string (Cel, kW.h, s, %, [ppm], …) or null |
Display unit; preserve when reporting results. |
Rules per type (consult metrics-spec for exact operator names — they evolve):
- Gauge — instantaneous value. Align directly with
avg/min/max/sum. Don't apply a rate; you'd be averaging meaningless deltas of an instantaneous value. - CounterMonotonic + Cumulative — running total (resets aside). The raw values are rarely what you want. Convert to a per-second rate first, then align/aggregate.
- CounterMonotonic + Delta — already per-interval. Sum/align without a rate step.
- CounterNonMonotonic — can go up or down (queue depth, balance). Intent is ambiguous: rate, delta, or current value all make sense for different questions. Ask the user before picking one.
- Histogram — not a scalar.
align using avgproduces nonsense. Use the bucket/quantile operators frommetrics-spec. temporality: null— "not applicable for this instrument type" (the norm for Gauges), not "missing data".
When surfacing numbers, attach the unit (treat null as unitless). If you combine metrics with mismatched units in arithmetic, warn rather than silently producing a meaningless number.
Query Metrics
scripts/metrics-query <deploy> '<MPL>' <start> <end>
| Parameter | Notes |
|---|---|
deploy |
Name from ~/.axiom.toml (e.g. prod). |
MPL |
Pipeline string. Dataset is parsed from the MPL itself. |
start / end |
RFC3339 (2025-01-01T00:00:00Z) or relative (now-1h, now). |
Examples:
scripts/metrics-query prod \
'`my-dataset`:`http.server.duration` | align to 5m using avg' \
now-1h now
scripts/metrics-query prod \
'`my-dataset`:`http.server.duration`
| where `service.name` == "frontend" and method == "GET"
| align to 5m using avg
| group by status_code using sum' \
now-1d now
Parameters
MPL can declare parameters (param $svc: string;). Pass values with repeated -p name=value. The script applies the API's param__ prefix; values are forwarded verbatim as MPL literals (string literals include their quotes).
scripts/metrics-query \
-p svc='"frontend"' \
-p window='5m' \
prod \
'param $svc: string; param $window: Duration;
`otel-metrics`:`http.server.duration` | where `service.name` == $svc | align to $window using avg' \
now-1h now
Required parameters must be supplied; optional ones may be omitted. Resulting request body shape:
{
"apl": "param $svc: string; …",
"startTime": "now-1h",
"endTime": "now",
"params": { "param__svc": "\"frontend\"", "param__window": "5m" }
}
Literal syntax per type lives in metrics-spec.
Discovery (metrics-info)
Time range defaults to the last 24h; override with --start / --end.
| Command | Returns |
|---|---|
metrics-info <d> <ds> metrics |
All metrics, keyed by name, with {type, temporality, unit}. |
metrics-info <d> <ds> metrics --by-type |
Same listing grouped by type (client-side reshape). |
metrics-info <d> <ds> metrics --type Gauge --type Histogram |
Filtered listing (repeatable, OR semantics; composes with --by-type). |
metrics-info <d> <ds> metrics <metric> info |
Single metric's {type, temporality, unit}. Non-zero exit if absent. |
metrics-info <d> <ds> metrics <metric> describe |
Bundle: metadata + all tags + tag values in one call (replaces 1+1+N round trips). Flags: --no-values (tag names only), --values-limit N (cap per-tag values; default 50, 0 = unlimited). |
metrics-info <d> <ds> metrics <metric> tags |
Tags carried by a specific metric. |
metrics-info <d> <ds> metrics <metric> tags <tag> values |
Tag values for that metric. |
metrics-info <d> <ds> metrics <metric> tags <tag> type |
Probe whether the tag is int/float/string/bool. Returns {type, present_types}; mixed if multiple types coexist, absent if not present. |
metrics-info <d> <ds> tags |
All tags in the dataset. |
metrics-info <d> <ds> tags <tag> values |
All values for a tag (across metrics). |
metrics-info <d> <ds> find-metrics "<value>" |
Metrics that carry the given tag value (not metric name). |
Error Handling
HTTP errors return JSON with message, code, and optional detail:
{"message": "...", "code": 400, "detail": {"errorType": 1, "message": "raw error"}}
| Code | Cause |
|---|---|
| 400 | Invalid query syntax or bad dataset name |
| 401 | Missing/invalid auth |
| 403 | No permission |
| 404 | Dataset not found |
| 429 | Rate limited |
| 500 | Internal error |
On 500, re-run with curl -v to capture the traceparent / x-axiom-trace-id header and report it — the trace ID is what the backend team needs to debug.
Scripts
| Script | Usage |
|---|---|
scripts/setup |
Check requirements and config. |
scripts/datasets <deploy> [--kind <kind>] |
List datasets with edge deployment. |
scripts/metrics-spec <deploy> <dataset> |
Fetch the MPL query spec. |
scripts/metrics-query <deploy> <mpl> <start> <end> |
Execute a query. |
scripts/metrics-info <deploy> <dataset> ... |
Discover metrics, tags, values. |
scripts/axiom-api <deploy> <method> <path> [body] |
Low-level API calls. |
scripts/resolve-url <deploy> <dataset> |
Resolve to the edge deployment URL. |
Run any script without arguments for full usage.
同梱ファイル
※ ZIPに含まれるファイル一覧。`SKILL.md` 本体に加え、参考資料・サンプル・スクリプトが入っている場合があります。
- 📄 SKILL.md (7,435 bytes)
- 📎 README.md (2,765 bytes)
- 📎 scripts/axiom-api (2,197 bytes)
- 📎 scripts/datasets (991 bytes)
- 📎 scripts/metrics-info (13,992 bytes)
- 📎 scripts/metrics-query (5,550 bytes)
- 📎 scripts/metrics-spec (912 bytes)
- 📎 scripts/resolve-url (2,755 bytes)
- 📎 scripts/setup (2,518 bytes)