[v10.0.x] CloudMonitoring: Improve parsing of GCM labels (#69812)

CloudMonitoring: Improve parsing of GCM labels (#69800)

Update parsing of GCM labels

- Include parsing of metadata labels

(cherry picked from commit 9fc1de62d5)

Co-authored-by: Andreas Christou <andreas.christou@grafana.com>
This commit is contained in:
Grot (@grafanabot)
2023-06-08 19:41:21 +03:00
committed by GitHub
co-authored by Andreas Christou
parent 5dacbb97e0
commit c90c8d88dc
3 changed files with 8 additions and 1 deletions
@@ -13,6 +13,9 @@
{
"key": "metric.response_code_class",
"valueType": "INT64"
},
{
"key": "metadata.app"
}
],
"pointDescriptors": [
@@ -37,6 +40,9 @@
},
{
"int64Value": "200"
},
{
"stringValue": "test-app"
}
],
"pointData": [
@@ -110,6 +110,7 @@ func TestTimeSeriesQuery(t *testing.T) {
labels, ok := custom["labels"].(gdata.Labels)
require.True(t, ok)
assert.Equal(t, "6724404429462225363", labels["resource.label.instance_id"])
assert.Equal(t, "test-app", labels["metadata.label.app"])
})
t.Run("includes time interval", func(t *testing.T) {
+1 -1
View File
@@ -208,7 +208,7 @@ func (ts timeSeriesData) getLabels(labelDescriptors []LabelDescriptor) (data.Lab
seriesLabels[key] = labelValue.StringValue
}
if strings.Contains(key, "metric.label") || strings.Contains(key, "resource.label") {
if strings.Contains(key, "metric.label") || strings.Contains(key, "resource.label") || strings.Contains(key, "metadata.label") {
defaultMetricName += seriesLabels[key] + " "
}
}