From 0fd2e1e40926a84508f02ea96302e21e2913821c Mon Sep 17 00:00:00 2001 From: Ridwan Sharif Date: Sat, 22 Jul 2023 01:41:54 +0000 Subject: [PATCH] exporter: add namespace to internal metric label --- .../googlemanagedprometheus/extra_metrics.go | 2 +- .../fixtures/metrics/untyped_gauge.json | 92 +++++++++---------- .../metrics/untyped_gauge_expect.json | 6 +- 3 files changed, 50 insertions(+), 50 deletions(-) diff --git a/exporter/collector/googlemanagedprometheus/extra_metrics.go b/exporter/collector/googlemanagedprometheus/extra_metrics.go index b6f1f9c63..931b6f80c 100644 --- a/exporter/collector/googlemanagedprometheus/extra_metrics.go +++ b/exporter/collector/googlemanagedprometheus/extra_metrics.go @@ -25,7 +25,7 @@ import ( const ( // Special attribute key used by Ops Agent prometheus receiver to denote untyped // prometheus metric. Internal use only. - GCPOpsAgentUntypedMetricKey = "prometheus_untyped_metric" + GCPOpsAgentUntypedMetricKey = "prometheus.googleapis.com/internal/untyped_metric" gcpUntypedDoubleExportGateKey = "gcp.untyped_double_export" ) diff --git a/exporter/collector/integrationtest/testdata/fixtures/metrics/untyped_gauge.json b/exporter/collector/integrationtest/testdata/fixtures/metrics/untyped_gauge.json index 4de7b7e85..c03ca18ca 100644 --- a/exporter/collector/integrationtest/testdata/fixtures/metrics/untyped_gauge.json +++ b/exporter/collector/integrationtest/testdata/fixtures/metrics/untyped_gauge.json @@ -1,61 +1,61 @@ { - "resourceMetrics":[ - { + "resourceMetrics": [ + { "resource": { - "attributes": [ - { - "key": "cloud.availability_zone", - "value": { - "stringValue": "us-central1-c" + "attributes": [ + { + "key": "cloud.availability_zone", + "value": { + "stringValue": "us-central1-c" + } + }, + { + "key": "service.name", + "value": { + "stringValue": "demo" + } + }, + { + "key": "service.instance.id", + "value": { + "stringValue": "10.92.5.2:15692" + } } - }, - { - "key": "service.name", - "value": { - "stringValue": "demo" - } - }, - { - "key": "service.instance.id", - "value": { - "stringValue": "10.92.5.2:15692" - } - } - ] + ] }, - "scopeMetrics":[ - { - "scope":{}, - "metrics":[ - { - "name":"fake_untyped_metric", - "gauge":{ - "dataPoints":[ + "scopeMetrics": [ + { + "scope": {}, + "metrics": [ + { + "name": "fake_untyped_metric", + "gauge": { + "dataPoints": [ { - "attributes":[ + "attributes": [ { - "key":"ex_com_lemons_untyped", - "value":{ - "stringValue":"13" + "key": "ex_com_lemons_untyped", + "value": { + "stringValue": "13" } }, { - "key":"prometheus_untyped_metric", - "value":{ - "stringValue":"true" + "key": "prometheus.googleapis.com/internal/untyped_metric", + "value": { + "stringValue": "true" } } ], - "startTimeUnixNano":"1649443416286000000", - "timeUnixNano":"1649443516286000000", - "asDouble":3 + "startTimeUnixNano": "1649443416286000000", + "timeUnixNano": "1649443516286000000", + "asDouble": 3 } ] } - } - ] - } - ] - } - ] - } + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/exporter/collector/integrationtest/testdata/fixtures/metrics/untyped_gauge_expect.json b/exporter/collector/integrationtest/testdata/fixtures/metrics/untyped_gauge_expect.json index 5c5ddf4e2..0718d7c99 100644 --- a/exporter/collector/integrationtest/testdata/fixtures/metrics/untyped_gauge_expect.json +++ b/exporter/collector/integrationtest/testdata/fixtures/metrics/untyped_gauge_expect.json @@ -8,7 +8,7 @@ "type": "workload.googleapis.com/fake_untyped_metric", "labels": { "ex_com_lemons_untyped": "13", - "prometheus_untyped_metric": "true" + "prometheus_googleapis_com_internal_untyped_metric": "true" } }, "resource": { @@ -47,7 +47,7 @@ "key": "ex_com_lemons_untyped" }, { - "key": "prometheus_untyped_metric" + "key": "prometheus_googleapis_com_internal_untyped_metric" } ], "metricKind": "GAUGE", @@ -691,4 +691,4 @@ } ] } -} +} \ No newline at end of file