Commit 561920f1 by Ato Araki Committed by GitHub

Cloud monitoring: fix missing title and text from cloud monitoring annotations (#27187)

* cloudmonitoring: fix empty title and text annotation

* cloudmonitoring: use metricQuery value
parent 6a9bfa19
...@@ -25,9 +25,11 @@ func (e *CloudMonitoringExecutor) executeAnnotationQuery(ctx context.Context, ts ...@@ -25,9 +25,11 @@ func (e *CloudMonitoringExecutor) executeAnnotationQuery(ctx context.Context, ts
if err != nil { if err != nil {
return nil, err return nil, err
} }
title := firstQuery.Model.Get("title").MustString()
text := firstQuery.Model.Get("text").MustString() metricQuery := firstQuery.Model.Get("metricQuery")
tags := firstQuery.Model.Get("tags").MustString() title := metricQuery.Get("title").MustString()
text := metricQuery.Get("text").MustString()
tags := metricQuery.Get("tags").MustString()
err = e.parseToAnnotations(queryRes, resp, queries[0], title, text, tags) err = e.parseToAnnotations(queryRes, resp, queries[0], title, text, tags)
result.Results[firstQuery.RefId] = queryRes result.Results[firstQuery.RefId] = queryRes
......
...@@ -302,7 +302,7 @@ func migrateLegacyQueryModel(query *tsdb.Query) { ...@@ -302,7 +302,7 @@ func migrateLegacyQueryModel(query *tsdb.Query) {
if mq == nil { if mq == nil {
migratedModel := simplejson.NewFromAny(map[string]interface{}{ migratedModel := simplejson.NewFromAny(map[string]interface{}{
"queryType": metricQueryType, "queryType": metricQueryType,
"metricQuery": query.Model, "metricQuery": query.Model.MustMap(),
}) })
query.Model = migratedModel query.Model = migratedModel
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment