Bug
The alerting_manage_rules get operation returns only a querySummary for each query (ref_id, datasource_uid, expression), discarding the full query model from the provisioning API response. This makes it impossible to round-trip get -> update without silently losing datasource-specific fields.
Affected Fields
Fields present in the provisioning API response but missing from the get output:
- Graphite:
target, datasource, textEditor
- OpenSearch/Elasticsearch:
bucketAggs, metrics, queryType, timeField, format
- All datasources:
intervalMs, maxDataPoints, relativeTimeRange (full model)
- Classic conditions:
query.params, operator, reducer (within conditions)
Steps to Reproduce
- Create an alert rule with a Graphite query (e.g.,
target: "alias(asPercent(a, b), 'rate')")
- Use
alerting_manage_rules with operation: get to retrieve the rule
- The response
queries array shows only:
{"ref_id": "A", "datasource_uid": "000000004", "expression": ""}
- The Graphite
target field is invisible — expression is empty because extractQuerySummaries only looks for expr, expression, and query keys
- Using this output to construct an update payload results in an empty query model, breaking the alert
Root Cause
In tools/alerting_manage_rules_handlers.go, mergeRuleDetail calls extractQuerySummaries which creates a compact querySummary struct. The full provisioned.Data (which contains complete models.AlertQuery with full model maps) is discarded.
Expected Behavior
The get response should include the full query data alongside the summary, enabling safe get -> update round-trips for all datasource types.
Environment
Bug
The
alerting_manage_rulesgetoperation returns only aquerySummaryfor each query (ref_id,datasource_uid,expression), discarding the full query model from the provisioning API response. This makes it impossible to round-tripget->updatewithout silently losing datasource-specific fields.Affected Fields
Fields present in the provisioning API response but missing from the
getoutput:target,datasource,textEditorbucketAggs,metrics,queryType,timeField,formatintervalMs,maxDataPoints,relativeTimeRange(full model)query.params,operator,reducer(within conditions)Steps to Reproduce
target: "alias(asPercent(a, b), 'rate')")alerting_manage_ruleswithoperation: getto retrieve the rulequeriesarray shows only:{"ref_id": "A", "datasource_uid": "000000004", "expression": ""}targetfield is invisible —expressionis empty becauseextractQuerySummariesonly looks forexpr,expression, andquerykeysRoot Cause
In
tools/alerting_manage_rules_handlers.go,mergeRuleDetailcallsextractQuerySummarieswhich creates a compactquerySummarystruct. The fullprovisioned.Data(which contains completemodels.AlertQuerywith full model maps) is discarded.Expected Behavior
The
getresponse should include the full query data alongside the summary, enabling safeget->updateround-trips for all datasource types.Environment