Summary
Axiom supports OpenTelemetry metrics datasets (kind = otel:metrics:v1, aka MetricsDB) and the docs state that metrics can be used in dashboards and monitors:
However, the Terraform resource axiom_monitor only supports apl_query, and APL-based monitors appear to be executed via the events query engine. As a result, any monitor whose APL references a MetricsDB dataset is created successfully but then fails at runtime.
Expected behavior
It should be possible to create working monitors against MetricsDB datasets via Terraform (equivalent to what can be configured in the Axiom UI for metrics monitors), or at minimum the provider should prevent creation / clearly error when attempting unsupported monitor types.
Actual behavior
Monitors that reference a metrics dataset in apl_query show Query failed in the Axiom UI with an error like:
query build failed
query build failed: validateDatasets: dataset "gcp-dev-metrics" is a metrics dataset, use /query/_metrics endpoint instead
(We also observed that the APL query endpoint rejects metrics datasets with a message like Please use the builder to query metrics datasets.)
Reproduction steps
- Create an Axiom dataset of kind
otel:metrics:v1 (MetricsDB), e.g. gcp-dev-metrics.
- Create an APL-based threshold monitor via Terraform, referencing that dataset, e.g.:
resource "axiom_monitor" "example" {
name = "Metrics monitor example"
type = "Threshold"
# Any APL query that references the metrics dataset triggers the failure at runtime
apl_query = "['gcp-dev-metrics'] | summarize count()"
interval_minutes = 5
range_minutes = 5
operator = "Above"
threshold = 0
}
- The monitor is created, but when it runs, it fails with the error shown above.
Environment
- Terraform provider:
axiomhq/axiom (observed with v1.4.8; likely still applies)
- Axiom datasets:
otel:metrics:v1
Suggested fix / enhancement
One of:
- Add first-class support for metrics queries/monitors in the provider (i.e. a new field on
axiom_monitor that represents a MetricsDB query spec and uses the metrics query endpoint instead of APL).
- If Axiom’s public API does not currently support creating metrics-based monitors programmatically, document this limitation in the provider and/or prevent creation of monitors whose APL references a MetricsDB dataset (to avoid creating permanently failing monitors).
Happy to test any proposed changes.
Summary
Axiom supports OpenTelemetry metrics datasets (
kind = otel:metrics:v1, aka MetricsDB) and the docs state that metrics can be used in dashboards and monitors:However, the Terraform resource
axiom_monitoronly supportsapl_query, and APL-based monitors appear to be executed via the events query engine. As a result, any monitor whose APL references a MetricsDB dataset is created successfully but then fails at runtime.Expected behavior
It should be possible to create working monitors against MetricsDB datasets via Terraform (equivalent to what can be configured in the Axiom UI for metrics monitors), or at minimum the provider should prevent creation / clearly error when attempting unsupported monitor types.
Actual behavior
Monitors that reference a metrics dataset in
apl_queryshow Query failed in the Axiom UI with an error like:(We also observed that the APL query endpoint rejects metrics datasets with a message like
Please use the builder to query metrics datasets.)Reproduction steps
otel:metrics:v1(MetricsDB), e.g.gcp-dev-metrics.Environment
axiomhq/axiom(observed with v1.4.8; likely still applies)otel:metrics:v1Suggested fix / enhancement
One of:
axiom_monitorthat represents a MetricsDB query spec and uses the metrics query endpoint instead of APL).Happy to test any proposed changes.