query-metrics
Skill này làm gì
Skill này chạy truy vấn trên các chỉ số được lưu trong Axiom. Nó dành cho người theo dõi số đo của hệ thống hoặc app và muốn có câu trả lời mà không phải viết từng truy vấn bằng tay.
Khi nào nên dùng
- ✓Khi bạn muốn tìm xem có những chỉ số nào trong các dataset Axiom của mình.
- ✓Khi bạn cần giá trị của một chỉ số trong một khoảng thời gian.
- ✓Khi bạn muốn tìm xem chỉ số nào mang một tên service hoặc tên host cụ thể.
Liên kết skill
https://github.com/openclaw/clawhub/blob/main/.agents/skills/query-metrics/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Hãy cho tôi xem chỉ số số lượng yêu cầu của service API của tôi trong một ngày qua.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent liệt kê các chỉ số và tag của chúng, đọc quy tắc truy vấn, rồi chạy truy vấn trên dataset của bạn trong khoảng thời gian bạn chọn. Nó tinh chỉnh truy vấn cho đến khi kết quả trả lời đúng câu hỏi của bạn.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
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— required before composing any query. MPL evolves; the spec is the source of truth. Also use it to answer general MPL/metrics questions.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. Usebucket … usingwith the histogram functions frommetrics-spec; quantiles are float specs to those functions, andtemporalityselects the variant (CumulativevsDeltainterpolation). Consultmetrics-specfor the exact signatures. 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 [-w pixels] [--pixel-per-point n] <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). |
-w / --chart-width <px> |
Optional. Target chart width in pixels; lets the server resolve $__interval. |
--pixel-per-point <n> |
Optional. Pixels per point (server default 10); with -w sets the bucket count. |
Always single-quote the MPL string in the shell. MPL is full of backticks; inside double quotes the shell executes them as command substitution, silently mangling the query (or running whatever the identifier names).
Bound the output before grouping. group by <tag> returns one series per tag value with no cap — on a high-cardinality tag this floods the output. Check cardinality first (describe, or tags <tag> values) and prefer plain group using <agg> while exploring.
Examples:
scripts/metrics-query prod -w 1200 \
'`my-dataset`:`http.server.duration` | align to $__interval using avg' \
now-1h now
scripts/metrics-query prod -w 1200 \
'`my-dataset`:`http.server.duration`
| wh
Câu hỏi thường gặp
Tôi có cần biết ngôn ngữ truy vấn không?
Không cần chi tiết. Agent đọc quy tắc truy vấn trước và tự viết truy vấn cho bạn.
Cần cài đặt gì?
Cài đặt truy cập Axiom của bạn phải được cấu hình trước, như mô tả trong readme của skill.
Nó có tìm chỉ số theo tên được không?
Nó tìm theo giá trị tag, nên phù hợp nhất để tìm các chỉ số mang một tên service hoặc host đã biết.
Chi tiết
Mô tả gốc của tác giả
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.
repo: openclaw/clawhub
Độ phổ biến
- Sao GitHub
- 9.5k
- Vị trí xếp hạng
- #12263
- Giấy phép
- MIT
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
axiom-alerting
9.5kGiúp agent của bạn tạo và quản lý monitor cùng các tuyến thông báo của Axiom qua API Axiom, và kiểm tra cảnh báo hoạt động đúng như mong đợi.
axiom-sre
9.5kGiúp agent của bạn điều tra sự cố và lỗi production từng bước, kiểm tra mỗi giả thuyết với log Axiom trước khi đưa ra kết luận.
building-dashboards
9.5kGiúp agent của bạn thiết kế dashboard Axiom với biểu đồ, truy vấn và bộ lọc phù hợp, bắt đầu từ các quyết định mà dashboard phải hỗ trợ.
controlling-costs
9.5kGiúp agent của bạn tìm dữ liệu không dùng đến trong Axiom và xây dựng dashboard cùng monitor để theo dõi và giảm chi phí ghi log.
Skill tương tự
gitcrawl
394kCho phép agent của bạn tìm trong kho lưu trữ issue và pull request GitHub, gom các mục trùng lặp và kiểm tra trạng thái hiện tại trên GitHub.
slacrawl
394kCho phép agent của bạn tìm và đếm tin nhắn trong kho lưu trữ Slack cục bộ, kiểm tra kho đó mới đến mức nào và làm mới khi cần.
goplaces
394kGiúp agent của bạn tìm địa điểm, lấy chi tiết và đánh giá, và xác định tên địa điểm bằng Google Places, với đầu ra JSON cho script.