CloudMonitoring: Improve parsing of GCM labels (#69800)

Update parsing of GCM labels

- Include parsing of metadata labels
This commit is contained in:
Andreas Christou 2023-06-08 17:30:22 +01:00 committed by GitHub
parent 8aae6b679a
commit 9fc1de62d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 1 deletions

View File

@ -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": [

View File

@ -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) {

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] + " "
}
}