query-metrics by axiomhq/skills
npx skills add https://github.com/axiomhq/skills --skill query-metricsCRITICAL: 所有脚本路径均相对于此技能的文件夹。请使用完整路径运行它们(例如,
scripts/metrics-query)。
查询存储在 Axiom MetricsDB 中的 OpenTelemetry 指标。
运行 scripts/setup 以检查要求(curl、jq、~/.axiom.toml)。
配置位于 ~/.axiom.toml(与 axiom-sre 共享):
[deployments.prod]
url = "https://api.axiom.co"
token = "xaat-your-token"
org_id = "your-org-id"
目标数据集必须是 otel:metrics:v1 类型。
列出部署中的所有数据集:
scripts/datasets <deployment>
仅筛选指标数据集:
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
scripts/datasets <deployment> --kind otel:metrics:v1
这将返回每个数据集的 name、region 和 kind。在后续的 metrics-info 和 metrics-query 调用中使用数据集名称。
数据集可能位于不同的区域(例如,us-east-1 与 eu-central-1)。脚本在查询前会自动解析正确的区域边缘 URL。无需手动配置——metrics-info 和 metrics-query 会检测数据集的区域并将请求路由到正确的端点。
| 数据集区域 | 边缘端点 |
|---|---|
cloud.us-east-1.aws | https://us-east-1.aws.edge.axiom.co |
cloud.eu-central-1.aws | https://eu-central-1.aws.edge.axiom.co |
如果解析失败或区域未知,请求将回退到 ~/.axiom.toml 中的部署 URL。
查询端点是自描述的。在编写任何查询之前,请获取完整的规范:
scripts/metrics-spec <deployment> <dataset>
这将返回包含语法、运算符和示例的完整指标查询规范。在编写查询之前,请阅读它以了解查询结构。
scripts/datasets <deployment> 以查看可用数据集及其区域scripts/metrics-spec <deployment> 以阅读指标查询规范scripts/metrics-query 运行如果不确定要查询什么,可以先搜索与相关标签值匹配的指标:
scripts/metrics-info <deployment> <dataset> find-metrics "frontend"
这将查找与已知值(例如,服务名称或主机)关联的指标,为您构建查询提供一个起点。
对数据集执行指标查询:
scripts/metrics-query <deployment> '<mpl>' '<startTime>' '<endTime>'
示例:
scripts/metrics-query prod \
'my-dataset:http.server.duration | align to 5m using avg' \
'2025-06-01T00:00:00Z' \
'2025-06-02T00:00:00Z'
| 参数 | 必需 | 描述 |
|---|---|---|
deployment | 是 | 来自 ~/.axiom.toml 的名称(例如,prod) |
mpl | 是 | 指标查询字符串。数据集从查询本身提取。 |
startTime | 是 | RFC3339(例如,2025-01-01T00:00:00Z)或相对表达式(例如,now-1h,now-1d) |
endTime | 是 | RFC3339(例如,2025-01-02T00:00:00Z)或相对表达式(例如,now) |
在编写查询之前,使用 scripts/metrics-info 来探索数据集中存在哪些指标、标签和值。时间范围默认为最近 24 小时;可以使用 --start 和 --end 覆盖。
scripts/metrics-info <deployment> <dataset> metrics
scripts/metrics-info <deployment> <dataset> tags
scripts/metrics-info <deployment> <dataset> tags <tag> values
scripts/metrics-info <deployment> <dataset> metrics <metric> tags
scripts/metrics-info <deployment> <dataset> metrics <metric> tags <tag> values
scripts/metrics-info <deployment> <dataset> find-metrics "<search-value>"
所有信息命令都接受 --start 和 --end 参数以设置自定义时间范围:
scripts/metrics-info prod my-dataset metrics \
--start 2025-06-01T00:00:00Z \
--end 2025-06-02T00:00:00Z
HTTP 错误返回包含 message、code 和可选 detail 字段的 JSON:
{"message": "description", "code": 400, "detail": {"errorType": 1, "message": "raw error"}}
常见状态码:
遇到 500 错误 时,使用 curl -v 标志重新运行失败的脚本调用以捕获响应头,然后将 traceparent 或 x-axiom-trace-id 头值报告给用户。此跟踪 ID 对于后端团队调试故障至关重要。
| 脚本 | 用途 |
|---|---|
scripts/setup | 检查要求和配置 |
scripts/datasets <deploy> [--kind <kind>] | 列出数据集(包含区域信息) |
scripts/metrics-spec <deploy> <dataset> | 获取指标查询规范 |
scripts/metrics-query <deploy> <mpl> <start> <end> | 执行指标查询 |
scripts/metrics-info <deploy> <dataset> ... | 发现指标、标签和值 |
scripts/axiom-api <deploy> <method> <path> [body] | 底层 API 调用 |
scripts/resolve-url <deploy> <dataset> | 将数据集解析为区域边缘 URL |
运行任何脚本时不带参数可查看完整用法。
每周安装数
91
代码仓库
GitHub 星标数
2
首次出现
2026年2月12日
安全审计
安装于
codex90
opencode88
gemini-cli87
github-copilot87
amp86
kimi-cli86
CRITICAL: ALL script paths are relative to this skill's folder. Run them with full path (e.g.,
scripts/metrics-query).
Query OpenTelemetry metrics stored in Axiom's MetricsDB.
Run scripts/setup to check requirements (curl, jq, ~/.axiom.toml).
Config in ~/.axiom.toml (shared with axiom-sre):
[deployments.prod]
url = "https://api.axiom.co"
token = "xaat-your-token"
org_id = "your-org-id"
The target dataset must be of kind otel:metrics:v1.
List all datasets in a deployment:
scripts/datasets <deployment>
Filter to only metrics datasets:
scripts/datasets <deployment> --kind otel:metrics:v1
This returns each dataset's name, region, and kind. Use the dataset name in subsequent metrics-info and metrics-query calls.
Datasets can live in different regions (e.g., us-east-1 vs eu-central-1). The scripts automatically resolve the correct regional edge URL before querying. No manual configuration is needed — metrics-info and metrics-query detect the dataset's region and route requests to the right endpoint.
| Dataset Region | Edge Endpoint |
|---|---|
cloud.us-east-1.aws | https://us-east-1.aws.edge.axiom.co |
cloud.eu-central-1.aws | https://eu-central-1.aws.edge.axiom.co |
If resolution fails or the region is unknown, requests fall back to the deployment URL in ~/.axiom.toml.
The query endpoint is self-describing. Before writing any query, fetch the full specification:
scripts/metrics-spec <deployment> <dataset>
This returns the complete metrics query specification with syntax, operators, and examples. Read it to understand query structure before composing queries.
scripts/datasets <deployment> to see available datasets and their regionsscripts/metrics-spec <deployment> to read the metrics query specscripts/metrics-queryIf you are unsure what to query, start by searching for metrics that match a relevant tag value:
scripts/metrics-info <deployment> <dataset> find-metrics "frontend"
This finds metrics associated with a known value (e.g., a service name or host), giving you a starting point for building queries.
Execute a metrics query against a dataset:
scripts/metrics-query <deployment> '<mpl>' '<startTime>' '<endTime>'
Example:
scripts/metrics-query prod \
'my-dataset:http.server.duration | align to 5m using avg' \
'2025-06-01T00:00:00Z' \
'2025-06-02T00:00:00Z'
| Parameter | Required | Description |
|---|---|---|
deployment | Yes | Name from ~/.axiom.toml (e.g., prod) |
mpl | Yes | Metrics query string. Dataset is extracted from the query itself. |
startTime | Yes | RFC3339 (e.g., 2025-01-01T00:00:00Z) or relative expression (e.g., now-1h, ) |
Use scripts/metrics-info to explore what metrics, tags, and values exist in a dataset before writing queries. Time range defaults to the last 24 hours; override with --start and --end.
scripts/metrics-info <deployment> <dataset> metrics
scripts/metrics-info <deployment> <dataset> tags
scripts/metrics-info <deployment> <dataset> tags <tag> values
scripts/metrics-info <deployment> <dataset> metrics <metric> tags
scripts/metrics-info <deployment> <dataset> metrics <metric> tags <tag> values
scripts/metrics-info <deployment> <dataset> find-metrics "<search-value>"
All info commands accept --start and --end for custom time ranges:
scripts/metrics-info prod my-dataset metrics \
--start 2025-06-01T00:00:00Z \
--end 2025-06-02T00:00:00Z
HTTP errors return JSON with message, code, and optional detail fields:
{"message": "description", "code": 400, "detail": {"errorType": 1, "message": "raw error"}}
Common status codes:
On a 500 error , re-run the failing script call with curl -v flags to capture response headers, then report the traceparent or x-axiom-trace-id header value to the user. This trace ID is essential for debugging the failure with the backend team.
| Script | Usage |
|---|---|
scripts/setup | Check requirements and config |
scripts/datasets <deploy> [--kind <kind>] | List datasets (with region info) |
scripts/metrics-spec <deploy> <dataset> | Fetch metrics query specification |
scripts/metrics-query <deploy> <mpl> <start> <end> | Execute a metrics query |
scripts/metrics-info <deploy> <dataset> ... | Discover metrics, tags, and values |
scripts/axiom-api <deploy> <method> <path> [body] |
Run any script without arguments to see full usage.
Weekly Installs
91
Repository
GitHub Stars
2
First Seen
Feb 12, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
codex90
opencode88
gemini-cli87
github-copilot87
amp86
kimi-cli86
Azure 升级评估与自动化工具 - 轻松迁移 Functions 计划、托管层级和 SKU
111,700 周安装
TorchTitan:PyTorch原生分布式大语言模型预训练平台,支持4D并行与H100 GPU加速
69 周安装
screenshot 截图技能:跨平台桌面截图工具,支持macOS/Linux权限管理与多模式捕获
69 周安装
tmux进程管理最佳实践:交互式Shell初始化、会话命名与生命周期管理
69 周安装
Git Rebase Sync:安全同步分支的Git变基工具,解决冲突与备份
69 周安装
LinkedIn自动化工具 - Claude Code专属,自然对话拓展人脉,避免垃圾信息
69 周安装
实验流水线框架:4阶段科研实验执行与消融研究方法论 | EvoScientist
69 周安装
now-1dendTime | Yes | RFC3339 (e.g., 2025-01-02T00:00:00Z) or relative expression (e.g., now) |
| Low-level API calls |
scripts/resolve-url <deploy> <dataset> | Resolve dataset to regional edge URL |