feat: integrate Axiom MetricsDB/MPL querying and prioritize over Grafana#6
feat: integrate Axiom MetricsDB/MPL querying and prioritize over Grafana#6
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Removes duplicated ~35-line function from axiom-metrics-query and axiom-metrics-discover. Both now source scripts/lib-time instead. Addresses Cursor Bugbot review feedback on PR #6. Thread: https://ampcode.com/threads/T-019c50fb-ca56-7198-b6aa-7e14a4b01273 Co-authored-by: Amp <[email protected]> Amp-Thread-ID: https://ampcode.com/threads/T-019c50fb-ca56-7198-b6aa-7e14a4b01273
…n Linux On GNU/Linux, stat -f means --file-system (not format), which leaks filesystem info to stdout and corrupts the mtime variable. Reversing the order (GNU first, BSD fallback) prevents this. Addresses Cursor Bugbot review feedback on PR #6. Thread: https://ampcode.com/threads/T-019c50fb-ca56-7198-b6aa-7e14a4b01273 Co-authored-by: Amp <[email protected]> Amp-Thread-ID: https://ampcode.com/threads/T-019c50fb-ca56-7198-b6aa-7e14a4b01273
The OPTIONS request for MPL spec was missing Authorization and X-Axiom-Org-Id headers, causing 401 on authenticated endpoints. Now consistent with the POST query path. Addresses Cursor Bugbot review feedback on PR #6. Thread: https://ampcode.com/threads/T-019c50fb-ca56-7198-b6aa-7e14a4b01273 Co-authored-by: Amp <[email protected]> Amp-Thread-ID: https://ampcode.com/threads/T-019c50fb-ca56-7198-b6aa-7e14a4b01273
Providing only --start or only --end was silently discarded, falling through to the default 1h range. Now errors explicitly, consistent with axiom-metrics-query behavior. Addresses Cursor Bugbot review feedback on PR #6. Thread: https://ampcode.com/threads/T-019c50fb-ca56-7198-b6aa-7e14a4b01273 Co-authored-by: Amp <[email protected]> Amp-Thread-ID: https://ampcode.com/threads/T-019c50fb-ca56-7198-b6aa-7e14a4b01273
Add scripts for querying OTel metrics in Axiom MetricsDB: - scripts/axiom-metrics-query: MPL query helper with --range/--start/--end/--spec - scripts/axiom-metrics-discover: discover metrics, tags, tag values in MetricsDB datasets - scripts/discover-axiom: tag MetricsDB datasets with [MPL] in discovery output Update SKILL.core.md investigation protocol (section 4.D) and SRE methodology (sections 8.B, 8.C) to prioritize Axiom MetricsDB for ALL OTel metrics (app and infra). Grafana/PromQL is now explicitly a fallback for Prometheus-native metrics not shipped to Axiom, plus alerts and dashboards. Add reference/metrics.md with MPL syntax, discovery workflow, query patterns, and error handling. Update reference/grafana.md integration section to reflect Axiom-first priority. Thread: https://ampcode.com/threads/T-019c50ea-c33a-71c5-afef-5ed7b7ce0607 Co-authored-by: Amp <[email protected]> Amp-Thread-ID: https://ampcode.com/threads/T-019c50ea-c33a-71c5-afef-5ed7b7ce0607
Removes duplicated ~35-line function from axiom-metrics-query and axiom-metrics-discover. Both now source scripts/lib-time instead. Addresses Cursor Bugbot review feedback on PR #6. Thread: https://ampcode.com/threads/T-019c50fb-ca56-7198-b6aa-7e14a4b01273 Co-authored-by: Amp <[email protected]> Amp-Thread-ID: https://ampcode.com/threads/T-019c50fb-ca56-7198-b6aa-7e14a4b01273
…n Linux On GNU/Linux, stat -f means --file-system (not format), which leaks filesystem info to stdout and corrupts the mtime variable. Reversing the order (GNU first, BSD fallback) prevents this. Addresses Cursor Bugbot review feedback on PR #6. Thread: https://ampcode.com/threads/T-019c50fb-ca56-7198-b6aa-7e14a4b01273 Co-authored-by: Amp <[email protected]> Amp-Thread-ID: https://ampcode.com/threads/T-019c50fb-ca56-7198-b6aa-7e14a4b01273
The OPTIONS request for MPL spec was missing Authorization and X-Axiom-Org-Id headers, causing 401 on authenticated endpoints. Now consistent with the POST query path. Addresses Cursor Bugbot review feedback on PR #6. Thread: https://ampcode.com/threads/T-019c50fb-ca56-7198-b6aa-7e14a4b01273 Co-authored-by: Amp <[email protected]> Amp-Thread-ID: https://ampcode.com/threads/T-019c50fb-ca56-7198-b6aa-7e14a4b01273
Providing only --start or only --end was silently discarded, falling through to the default 1h range. Now errors explicitly, consistent with axiom-metrics-query behavior. Addresses Cursor Bugbot review feedback on PR #6. Thread: https://ampcode.com/threads/T-019c50fb-ca56-7198-b6aa-7e14a4b01273 Co-authored-by: Amp <[email protected]> Amp-Thread-ID: https://ampcode.com/threads/T-019c50fb-ca56-7198-b6aa-7e14a4b01273
Strategy 2 (fallback) was listing all datasets untagged, then listing MetricsDB datasets again separately with [MPL] tags — causing duplicates. Now tags datasets inline (consistent with Strategy 1) and only shows a summary count for MetricsDB datasets. Thread: https://ampcode.com/threads/T-019c5121-b3f1-7127-80b2-d6fe3c951b11 Co-authored-by: Amp <[email protected]> Amp-Thread-ID: https://ampcode.com/threads/T-019c5121-b3f1-7127-80b2-d6fe3c951b11
Use 'hours/days/minutes' when value != 1 for grammatically correct GNU date relative time strings (e.g. '7 days ago' not '7 day ago'). Thread: https://ampcode.com/threads/T-019c5138-6cb8-7769-a841-0cba5cb26fd1 Co-authored-by: Amp <[email protected]> Amp-Thread-ID: https://ampcode.com/threads/T-019c5138-6cb8-7769-a841-0cba5cb26fd1
Add explicit || exit 1 and empty-string checks after range_to_rfc3339 and date calls. Prevents empty timestamps from reaching the API with confusing errors when time conversion fails silently. Thread: https://ampcode.com/threads/T-019c5138-6cb8-7769-a841-0cba5cb26fd1 Co-authored-by: Amp <[email protected]> Amp-Thread-ID: https://ampcode.com/threads/T-019c5138-6cb8-7769-a841-0cba5cb26fd1
0f1ffa8 to
bd15d04
Compare
- SKILL.core.md/SKILL.md: merge Axiom (APL) and Axiom (MPL) evidence link entries into single 'Axiom' entry using scripts/axiom-link (the Axiom API uses the 'apl' field for both query types) - discover-axiom: use otel:metrics:v1 (not otel-metrics-v1) for MetricsDB dataset identification, fix cache atomicity - lib-time: support seconds (s) suffix, improve unit handling Amp-Thread-ID: https://ampcode.com/threads/T-019c6725-d052-71be-85c9-1fa159b26ff2 Co-authored-by: Amp <[email protected]>
|
TODO: Axiom UI needs native MPL support in Currently For a proper end-to-end experience, the Axiom UI should support an
Until then, the workaround is functional — the MPL query text appears in the editor, and the user can copy/paste or manually switch modes. |
…kill/SKILL.md, skill/reference/metrics.md Amp-Thread-ID: https://ampcode.com/threads/T-019c6fb7-d6f0-723a-a1c9-ed5c44d401cf Co-authored-by: Amp <[email protected]>
There was a problem hiding this comment.
Resolved merge conflicts with main (skill/ directory restructure). Conflicts in SKILL.core.md and skill/SKILL.md were trivial — took the branch's MPL-aware axiom-link comments. reference/metrics.md correctly placed in skill/reference/. Tests pass.
axiom-metrics-query, axiom-metrics-discover, and lib-time existed only in root scripts/ but were referenced by the deployed skill. The agent would be told to use scripts that don't exist. Thread: https://ampcode.com/threads/T-019c7006-79ad-739c-bb08-4f62a4f70c40 Co-authored-by: Amp <[email protected]> Amp-Thread-ID: https://ampcode.com/threads/T-019c7006-79ad-739c-bb08-4f62a4f70c40
The while...done | head -n 10 pipeline exits 141 via SIGPIPE when >10 datasets exist, killing the block under set -euo pipefail and skipping MetricsDB count output. Append || true to the pipeline. Thread: https://ampcode.com/threads/T-019c7006-79ad-739c-bb08-4f62a4f70c40 Co-authored-by: Amp <[email protected]> Amp-Thread-ID: https://ampcode.com/threads/T-019c7006-79ad-739c-bb08-4f62a4f70c40
The agent determines query order from context, not a hard-coded numbered workflow. Replace priority list with neutral capability descriptions. Thread: https://ampcode.com/threads/T-019c7006-79ad-739c-bb08-4f62a4f70c40 Co-authored-by: Amp <[email protected]> Amp-Thread-ID: https://ampcode.com/threads/T-019c7006-79ad-739c-bb08-4f62a4f70c40
Replace 'Metrics priority: Axiom first, Grafana only for...' with neutral tool listing. Remove 'fallback' label from Grafana. Rebuild skill/SKILL.md. Thread: https://ampcode.com/threads/T-019c7006-79ad-739c-bb08-4f62a4f70c40 Co-authored-by: Amp <[email protected]> Amp-Thread-ID: https://ampcode.com/threads/T-019c7006-79ad-739c-bb08-4f62a4f70c40
echo | head -3 | grep causes SIGPIPE on Linux when OUTPUT is large — head closes the pipe, pipefail propagates exit 141, test fails despite correct frontmatter. Replace head -3 with grep -m1. Thread: https://ampcode.com/threads/T-019c7006-79ad-739c-bb08-4f62a4f70c40 Co-authored-by: Amp <[email protected]> Amp-Thread-ID: https://ampcode.com/threads/T-019c7006-79ad-739c-bb08-4f62a4f70c40
RFC3339 timestamps with + timezone offsets (e.g. 2025-01-01T00:00:00+05:00) would have + interpreted as a space in query string parameters. Apply the existing uriencode function to START_TIME and END_TIME before embedding in QS. https://ampcode.com/threads/T-019c7019-dded-76e3-a177-7d120a80aa10 Co-authored-by: Amp <[email protected]> Amp-Thread-ID: https://ampcode.com/threads/T-019c7019-dded-76e3-a177-7d120a80aa10
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
The sort | head -n 10 | sed pipeline at line 138 was missing || true, which causes SIGPIPE exit under pipefail when >10 unlisted datasets exist. The analogous pipeline at line 164 already had this guard. https://ampcode.com/threads/T-019c7019-dded-76e3-a177-7d120a80aa10 Co-authored-by: Amp <[email protected]> Amp-Thread-ID: https://ampcode.com/threads/T-019c7019-dded-76e3-a177-7d120a80aa10
Summary
Adds Axiom MetricsDB (MPL) querying capabilities and establishes Axiom as the primary metrics source, with Grafana as fallback.
New Scripts
scripts/axiom-metrics-query— MPL query helper forotel-metrics-v1datasets. Supports--range,--start/--end,--spec(fetch MPL language spec),--trace.scripts/axiom-metrics-discover— Discover metrics, tags, and tag values in MetricsDB datasets. Commands:metrics,tags,tag-values,metric-tags,metric-tag-values,search.Discovery Changes
scripts/discover-axiom— Now fetches the dataset catalog and tags MetricsDB datasets with[MPL]in output, so the agent knows which query language to use.Skill & Reference Updates
Decision Criteria
Tests
scripts/test-build: 20/20 passed.Thread: https://ampcode.com/threads/T-019c50ea-c33a-71c5-afef-5ed7b7ce0607
Note
Medium Risk
Introduces new curl-based query paths and caching in discovery scripts, which could affect auth handling and dataset selection output; changes are isolated to tooling/docs but will influence incident workflows.
Overview
Adds Axiom MetricsDB support by introducing
scripts/axiom-metrics-query(MPL queries +--spec,--range/--start/--end, optional trace ID printing) andscripts/axiom-metrics-discover(list/search metrics, tags, and tag values via MetricsDB info endpoints), plus a sharedscripts/lib-timehelper for RFC3339 time handling.Updates Axiom dataset discovery (
skill/scripts/discover-axiom) to fetch/cache the dataset catalog, tagotel:metrics:v1datasets as[MPL], and surface MetricsDB datasets that aren’t in the “top datasets” list. Documentation/skill guidance is revised to treat Axiom (APL for logs, MPL for metrics) as the primary query path and reposition Grafana/PromQL as a fallback and alert/dashboard source;scripts/sync-to-skillsandscripts/test-buildare adjusted accordingly.Written by Cursor Bugbot for commit cd5bfb2. This will update automatically on new commits. Configure here.