Skip to content

get_dashboard_panel_queries omits non-Prometheus panels (CloudWatch, Elasticsearch, etc.) #585

@nullren

Description

@nullren

Description

The get_dashboard_panel_queries tool only returns panels that use Prometheus/Loki-style queries. Panels using other datasource types (CloudWatch, Elasticsearch, etc.) are silently omitted from the results.

Root Cause

In tools/dashboard.go around line 320, the query extraction only checks for the expr field:

expr, _ := target["expr"].(string)
if expr != "" {
    result = append(result, panelQuery{
        Title:      title,
        Query:      expr,
        Datasource: datasourceInfo,
    })
}

Since expr is specific to Prometheus/Loki targets, any panel using a different datasource type gets skipped. For example:

  • CloudWatch targets use namespace, metricName, dimensions, statistic, region
  • Elasticsearch targets use query, metrics, bucketAggs
  • Other datasource types have their own query structures

Steps to Reproduce

  1. Create a dashboard with a mix of Prometheus and CloudWatch panels
  2. Call get_dashboard_panel_queries with the dashboard UID
  3. Only Prometheus panels are returned; CloudWatch panels are missing

Expected Behavior

All panels should be returned regardless of datasource type, with a normalized or datasource-appropriate query representation.

Suggestion

The tool could:

  1. Check for expr (Prometheus/Loki)
  2. Fall back to other common query fields like query (Elasticsearch), or build a summary from structured fields (namespace/metricName for CloudWatch)
  3. As a last resort, include the panel with a serialized representation of its targets so it's at least visible in the results rather than silently dropped

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