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

* cloudmonitoring: fix empty title and text annotation

* cloudmonitoring: use metricQuery value
This commit is contained in:
Ato Araki 2020-09-08 19:18:41 +09:00 committed by GitHub
parent 6a9bfa19be
commit 561920f18b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View File

@ -25,9 +25,11 @@ func (e *CloudMonitoringExecutor) executeAnnotationQuery(ctx context.Context, ts
if err != nil {
return nil, err
}
title := firstQuery.Model.Get("title").MustString()
text := firstQuery.Model.Get("text").MustString()
tags := firstQuery.Model.Get("tags").MustString()
metricQuery := firstQuery.Model.Get("metricQuery")
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)
result.Results[firstQuery.RefId] = queryRes

View File

@ -302,7 +302,7 @@ func migrateLegacyQueryModel(query *tsdb.Query) {
if mq == nil {
migratedModel := simplejson.NewFromAny(map[string]interface{}{
"queryType": metricQueryType,
"metricQuery": query.Model,
"metricQuery": query.Model.MustMap(),
})
query.Model = migratedModel
}