Skip to content

datadog-cr-validate: catch dashboard queries that break when a template variable is set to * #158

Open

Description

@swibrow

What

The dashboard lint in actions/datadog-cr-validate/validate.py (dashboards()) checks only that spec.widgets is a JSON array, that every widget has a definition.type, and that every $variable is declared. It does not fill in template variables or parse the queries that result. The tag check (metric_filters) skips any filter that contains * or $.

Why it matters

DND-IT/launchpad's App Overview dashboard filtered on gateway.k8s.aws.alb/resource:*$namespace.value*. With the variable set to * (the default, or the built-in All entry), the filter became ***. Datadog rejects that query (Rule 'or_op' didn't match at '**}'), so every ALB widget showed no data, and the lint passed it.

Suggested fix

  • Lint: flag a template variable wrapped in wildcards (*$var.value*, *$var*), because selecting * always yields ***.
  • And/or: fill in each variable's defaults plus *, then run each metric query through POST /api/v1/query (or the scalar/timeseries query API) and fail on parse errors.

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

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions