From 54bb068ff7508c90901312926eeb81298a11b0b4 Mon Sep 17 00:00:00 2001 From: Ridwan Sharif <18472685+ridwanmsharif@users.noreply.github.com> Date: Mon, 24 Jul 2023 11:45:40 -0400 Subject: [PATCH] exporter: add namespace to internal metric label (#684) * exporter: add namespace to internal metric label * fix linting error Signed-off-by: Ridwan Sharif --------- Signed-off-by: Ridwan Sharif --- .../googlemanagedprometheus/extra_metrics.go | 2 +- .../fixtures/metrics/untyped_gauge.json | 92 +++++++++---------- .../metrics/untyped_gauge_expect.json | 4 +- 3 files changed, 49 insertions(+), 49 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..52a524866 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",