Skip to content

Support MetricsDB monitors (otel:metrics:v1) in Terraform provider (axiom_monitor only supports APL) #86

Description

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

  1. Create an Axiom dataset of kind otel:metrics:v1 (MetricsDB), e.g. gcp-dev-metrics.
  2. 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
}
  1. 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:

  1. 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).
  2. 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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions