跳到正文
cccskills
免费在 GitHub 公开

query-metrics

Explore and query measurements stored in Axiom MetricsDB. The skill discovers metrics and tags, checks measurement types and units, and builds MPL queries, Axiom’s metrics query language, to retrieve values and aggregate them over a chosen period.

中文简介正在准备中。当前显示英语简介。

原文查看原文说明

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.

查看安装方法

适用场景

  • Explore available metrics and tag values
  • Check metrics for a specific service or host
  • Aggregate values over a selected time range
  • Choose calculations based on metric types

包含的文件(9)

  • SKILL.md10.3 KB
  • README.md2.7 KB
  • scripts/axiom-api2.4 KB
  • scripts/datasets991 B
  • scripts/metrics-info17.5 KB
  • scripts/metrics-query8.5 KB
  • scripts/metrics-spec633 B
  • scripts/resolve-url2.7 KB
  • scripts/setup2.5 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

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

  1. scripts/datasets <deploy> --kind otel:metrics:v1 — list metrics datasets.
  2. 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.
  3. scripts/metrics-info <deploy> <dataset> metrics — list metrics with {type, temporality, unit} metadata. Read this before writing the query (see Choosing a Query Shape).
  4. scripts/metrics-info <deploy> <dataset> tags [<tag> values] — explore filter dimensions.
  5. 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.

FieldValuesDrives
typeGauge, CounterMonotonic, CounterNonMonotonic, HistogramRequired pre-aggregation operators.
temporalityCumulative, Delta, nullWhether counter values are running totals or per-interval deltas. null is normal for Gauges.
unitUCUM string (Cel, kW.h, s, %, [ppm], …) or nullDisplay 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 avg produces nonsense. Use bucket … using with the histogram functions from metrics-spec; quantiles are float specs to those functions, and temporality selects the variant (Cumulative vs Delta interpolation). Consult metrics-spec for 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>
ParameterNotes
deployName from ~/.axiom.toml (e.g. prod).
MPLPipeline string. Dataset is parsed from the MPL itself.
start / endRFC3339 (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`
   | where `service.name` == "frontend" and method == "GET"
   | align to $__interval using avg
   | group by status_code using sum' \
  now-1d now

Adaptive resolution ($__interval)

Hardcoding a step (align to 5m) makes charts look wrong at other zoom levels — too sparse zoomed in, too dense zoomed out. Prefer the system parameter $__interval wherever a Duration is expected, and pass the chart width so the server picks the step:

scripts/metrics-query prod -w 1200 \
  '`my-dataset`:`http.server.duration` | align to $__interval using avg' \
  now-7d now

The metrics service computes $__interval from the query's time range and the target chart width, then snaps it up to a nice resolution from the ladder 1s, 5s, 10s, 15s, 30s, 1m, 5m, 10m, 15m, 30m, 1h, 12h, 1d, 1w, 1M, 1Y. It never drops below a metric's stored resolution.

  • No declaration needed — the server auto-registers $__interval; do not add param $__interval: Duration; (the edge forwards the query verbatim and the metrics service injects the parameter).
  • Bucket count ≈ chart-width / pixel-per-point (pixel-per-point default 10). Omit -w and the server targets ~500 buckets.
  • Works anywhere a Duration is valid, e.g. bucket to $__interval using histogram(0.5, 0.95).
  • Set -w to your render width (e.g. the metrics-chart skill's plot width) so one bucket ≈ one pixel column. The value is forwarded under the request body's queryOptions (chart-width, pixel-per-point).

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. Both accept RFC3339 (offsets allowed) or relative now / now-<N><unit> with <unit> in s m h d w, resolved to RFC3339 UTC client-side. This is narrower than metrics-query, which forwards times to the server unparsed and so also accepts forms like now-1y; in metrics-info anything outside now / now-<N>[smhdw] must already be RFC3339 or the request 400s.

CommandReturns
metrics-info <d> <ds> metricsAll metrics, keyed by name, with {type, temporality, unit}.
metrics-info <d> <ds> metrics --by-typeSame listing grouped by type (client-side reshape).
metrics-info <d> <ds> metrics --type Gauge --type HistogramFiltered listing (repeatable, OR semantics; composes with --by-type).
metrics-info <d> <ds> metrics <metric> infoSingle metric's {type, temporality, unit}. Non-zero exit if absent.
metrics-info <d> <ds> metrics <metric> describeBundle: 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> tagsTags carried by a specific metric.
metrics-info <d> <ds> metrics <metric> tags <tag> valuesTag values for that metric.
metrics-info <d> <ds> metrics <metric> tags <tag> typeProbe 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> tagsAll tags in the dataset.
metrics-info <d> <ds> tags <tag> valuesAll 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 code and message; some include a detail object:

{"code": 400, "message": "MPL syntax error: …"}

Syntax errors (400) include an annotated source pointer listing the valid operators at the failure position — read it, it usually names the fix.

CodeCause
400Invalid query syntax or bad dataset name
401Missing/invalid auth
403No permission
404Dataset not found
429Rate limited — back off and retry; don't tight-loop
500Internal error

Requests time out client-side after 120s (AXIOM_MAX_TIME to override; AXIOM_CONNECT_TIMEOUT for the 10s connect timeout).

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

ScriptUsage
scripts/setupCheck requirements and config.
scripts/datasets <deploy> [--kind <kind>]List datasets with edge deployment.
scripts/metrics-specFetch the MPL query spec.
scripts/metrics-query [-w px] [--pixel-per-point n] <deploy> <mpl> <start> <end>Execute a query; use $__interval + -w for adaptive resolution.
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.

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Review code using shared OpenClaw instructions and a Python helper, while also following the target repository’s review requirements. This skill points to a common installation that supplies the actual review procedure.

中文简介正在准备中。当前显示英语简介。

  • Reviewing code with shared OpenClaw instructions
  • Applying repository-specific review requirements
  • Keeping shared review instructions up to date
openclaw/clawhub95172026年10月18日 更新

Create and manage Axiom alert rules and notification destinations through its API. Connect alerts to email, Slack, or webhooks, check monitor history, and adjust thresholds and evaluation schedules to address excessive or missing alerts.

中文简介正在准备中。当前显示英语简介。

  • Set up error alerts and notification destinations
  • Tune monitors that send too many alerts
  • Investigate monitors that never trigger
openclaw/clawhub95172026年10月18日 更新

axiom-sre

免费

Investigate production incidents and bugs using logs, metrics, and code evidence. The skill guides hypothesis testing, root cause analysis, fix validation, and reusable investigation notes, with access to configured observability tools such as Axiom.

中文简介正在准备中。当前显示英语简介。

  • Investigate production outages and rising error rates
  • Trace causes using logs, metrics, and code
  • Reproduce bugs and validate minimal fixes
openclaw/clawhub95172026年10月18日 更新

Design and build Axiom dashboards from logs or metrics, the numerical measurements of system behavior. Create charts, filters, and layouts for monitoring and reporting, or migrate existing Splunk and Grafana panels while validating queries against available data.

中文简介正在准备中。当前显示英语简介。

  • Build a service health monitoring dashboard
  • Create interactive filters for investigating logs
  • Migrate dashboards from Splunk or Grafana
openclaw/clawhub95172026年10月18日 更新

Drafts, previews, sends, and records emails for existing ClawHub content rights cases. It supports publisher removal notices and requester updates, requires approval of the final draft, and preserves the exact correspondence in the case record.

中文简介正在准备中。当前显示英语简介。

  • Preparing a skill removal notice for a publisher
  • Sending a requester a progress update or closure note
  • Preserving sent correspondence in an existing rights case
openclaw/clawhub95172026年10月18日 更新

Apply ClawHub-specific rules when developing with Convex, including deployment targeting, runtime checks, data migrations, search performance, and skill statistics. It also directs specialized work to the appropriate companion skills.

中文简介正在准备中。当前显示英语简介。

  • Changing Convex functions or schemas
  • Planning production data migrations
  • Reviewing search query performance
openclaw/clawhub95172026年10月18日 更新

查看 openclaw 的全部技能

报告此技能的问题