Skip to content

Commit

Permalink
feat(otelcol/exp/prom): test case when resourceToTelemetryConversion …
Browse files Browse the repository at this point in the history
…is false

Signed-off-by: hainenber <[email protected]>
  • Loading branch information
hainenber committed Nov 25, 2023
1 parent 0043294 commit 4077196
Showing 1 changed file with 41 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -880,6 +880,47 @@ func TestConverter(t *testing.T) {
enableOpenMetrics: true,
resourceToTelemetryConversion: true,
},
{
name: "Gauge: NOT convert resource attributes to metric label",
input: `{
"resource_metrics": [{
"resource": {
"attributes": [{
"key": "service.name",
"value": { "stringValue": "myservice" }
}, {
"key": "service.instance.id",
"value": { "stringValue": "instance" }
}, {
"key": "raw",
"value": { "stringValue": "test" }
},{
"key": "foo.one",
"value": { "stringValue": "foo" }
}, {
"key": "bar.one",
"value": { "stringValue": "bar" }
}]
},
"scope_metrics": [{
"metrics": [{
"name": "test_metric_gauge",
"gauge": {
"data_points": [{
"as_double": 1234.56
}]
}
}]
}]
}]
}`,
expect: `
# TYPE test_metric_gauge gauge
test_metric_gauge{instance="instance",job="myservice"} 1234.56
`,
enableOpenMetrics: true,
resourceToTelemetryConversion: false,
},
{
name: "Summary: convert resource attributes to metric label",
input: `{
Expand Down

0 comments on commit 4077196

Please sign in to comment.