Skip to content

feat: integrate Axiom MetricsDB/MPL querying and prioritize over Grafana#6

Open
Licenser wants to merge 17 commits intomainfrom
axiom-metrics
Open

feat: integrate Axiom MetricsDB/MPL querying and prioritize over Grafana#6
Licenser wants to merge 17 commits intomainfrom
axiom-metrics

Conversation

@Licenser
Copy link
Copy Markdown

@Licenser Licenser commented Feb 12, 2026

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 for otel-metrics-v1 datasets. 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

  • SKILL.core.md — Section 4.D (EXECUTE) now prioritizes Axiom MetricsDB for ALL OTel metrics (app and infra). Grafana/PromQL is explicitly a fallback for Prometheus-native metrics not in Axiom, plus alerts/dashboards. Sections 8.B (RED) and 8.C (USE) updated similarly.
  • reference/metrics.md — New reference covering MetricsDB vs EventDB, MPL syntax, discovery workflow, query patterns, and error handling.
  • reference/grafana.md — Integration section updated to reflect Axiom-first priority.

Decision Criteria

Signal Primary Source Fallback
App metrics (RED) Axiom MetricsDB (MPL) Grafana (PromQL)
Infra metrics (USE) Axiom MetricsDB (MPL) Grafana (PromQL)
Alerts & dashboards Grafana
Logs & traces Axiom EventDB (APL)

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) and scripts/axiom-metrics-discover (list/search metrics, tags, and tag values via MetricsDB info endpoints), plus a shared scripts/lib-time helper for RFC3339 time handling.

Updates Axiom dataset discovery (skill/scripts/discover-axiom) to fetch/cache the dataset catalog, tag otel:metrics:v1 datasets 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-skills and scripts/test-build are adjusted accordingly.

Written by Cursor Bugbot for commit cd5bfb2. This will update automatically on new commits. Configure here.

@vercel
Copy link
Copy Markdown

vercel bot commented Feb 12, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
gilfoyle Ready Ready Preview, Comment Feb 18, 2026 9:57am

Request Review

Licenser added a commit that referenced this pull request Feb 12, 2026
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
Licenser added a commit that referenced this pull request Feb 12, 2026
…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
Licenser added a commit that referenced this pull request Feb 12, 2026
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
Licenser added a commit that referenced this pull request Feb 12, 2026
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
Licenser and others added 8 commits February 16, 2026 13:17
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
- 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]>
@tsenart
Copy link
Copy Markdown
Collaborator

tsenart commented Feb 16, 2026

TODO: Axiom UI needs native MPL support in initForm

Currently scripts/axiom-link uses the apl field in initForm for both APL and MPL queries — this works because the Axiom web UI accepts any text in that field and pre-fills the editor. However, the query page stays in APL mode and won't auto-detect or switch to MPL mode.

For a proper end-to-end experience, the Axiom UI should support an initForm parameter (or equivalent) that:

  1. Recognizes MPL queries and switches the editor to MPL mode
  2. Ideally auto-runs the query on load

Until then, the workaround is functional — the MPL query text appears in the editor, and the user can copy/paste or manually switch modes.

Copy link
Copy Markdown
Contributor

@gilfoyle-sre gilfoyle-sre bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Licenser and others added 4 commits February 18, 2026 10:18
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
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants