Skip to content

Commit

Permalink
add integration test with metrics from the prometheus receiver (#348)
Browse files Browse the repository at this point in the history
  • Loading branch information
dashpole authored Apr 12, 2022
1 parent 442383d commit 9f31be1
Show file tree
Hide file tree
Showing 3 changed files with 1,453 additions and 0 deletions.
5 changes: 5 additions & 0 deletions exporter/collector/integrationtest/testcases.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ var (
OTLPInputFixturePath: "testdata/fixtures/basic_counter_metrics.json",
ExpectFixturePath: "testdata/fixtures/basic_counter_metrics_expect.json",
},
{
Name: "Basic Prometheus metrics",
OTLPInputFixturePath: "testdata/fixtures/basic_prometheus_metrics.json",
ExpectFixturePath: "testdata/fixtures/basic_prometheus_metrics_expect.json",
},
{
Name: "Modified prefix unknown domain",
OTLPInputFixturePath: "testdata/fixtures/basic_counter_metrics.json",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,311 @@
{
"resourceMetrics":[
{
"resource":{
"attributes":[
{
"key":"service.name",
"value":{
"stringValue":"demo"
}
},
{
"key":"service.instance.id",
"value":{
"stringValue":"localhost:2222"
}
},
{
"key":"net.host.port",
"value":{
"stringValue":"2222"
}
},
{
"key":"http.scheme",
"value":{
"stringValue":"http"
}
}
]
},
"instrumentationLibraryMetrics":[
{
"instrumentationLibrary":{},
"metrics":[
{
"name":"scrape_series_added",
"description":"The approximate number of new series in this scrape",
"gauge":{
"dataPoints":[
{
"timeUnixNano":"1649443516286000000",
"asDouble":22
}
]
}
},
{
"name":"ex_com_one",
"gauge":{
"dataPoints":[
{
"attributes":[
{
"key":"ex_com_lemons",
"value":{
"stringValue":"13"
}
},
{
"key":"telemetry_sdk_language",
"value":{
"stringValue":"go"
}
},
{
"key":"telemetry_sdk_name",
"value":{
"stringValue":"opentelemetry"
}
},
{
"key":"telemetry_sdk_version",
"value":{
"stringValue":"1.6.2"
}
}
],
"timeUnixNano":"1649443516286000000",
"asDouble":1
},
{
"attributes":[
{
"key":"A",
"value":{
"stringValue":"1"
}
},
{
"key":"B",
"value":{
"stringValue":"2"
}
},
{
"key":"C",
"value":{
"stringValue":"3"
}
},
{
"key":"ex_com_lemons",
"value":{
"stringValue":"10"
}
},
{
"key":"telemetry_sdk_language",
"value":{
"stringValue":"go"
}
},
{
"key":"telemetry_sdk_name",
"value":{
"stringValue":"opentelemetry"
}
},
{
"key":"telemetry_sdk_version",
"value":{
"stringValue":"1.6.2"
}
}
],
"timeUnixNano":"1649443516286000000",
"asDouble":13
}
]
}
},
{
"name":"ex_com_two",
"histogram":{
"dataPoints":[
{
"attributes":[
{
"key":"ex_com_lemons",
"value":{
"stringValue":"13"
}
},
{
"key":"telemetry_sdk_language",
"value":{
"stringValue":"go"
}
},
{
"key":"telemetry_sdk_name",
"value":{
"stringValue":"opentelemetry"
}
},
{
"key":"telemetry_sdk_version",
"value":{
"stringValue":"1.6.2"
}
}
],
"startTimeUnixNano":"1649443516286000000",
"timeUnixNano":"1649443516286000000",
"count":"1",
"sum":2,
"bucketCounts":[
"0",
"0",
"1",
"0",
"0",
"0",
"0"
],
"explicitBounds":[
1,
2,
5,
10,
20,
50
]
},
{
"attributes":[
{
"key":"A",
"value":{
"stringValue":"1"
}
},
{
"key":"B",
"value":{
"stringValue":"2"
}
},
{
"key":"C",
"value":{
"stringValue":"3"
}
},
{
"key":"ex_com_lemons",
"value":{
"stringValue":"10"
}
},
{
"key":"telemetry_sdk_language",
"value":{
"stringValue":"go"
}
},
{
"key":"telemetry_sdk_name",
"value":{
"stringValue":"opentelemetry"
}
},
{
"key":"telemetry_sdk_version",
"value":{
"stringValue":"1.6.2"
}
}
],
"startTimeUnixNano":"1649443516286000000",
"timeUnixNano":"1649443516286000000",
"count":"2",
"sum":14,
"bucketCounts":[
"0",
"0",
"1",
"0",
"1",
"0",
"0"
],
"explicitBounds":[
1,
2,
5,
10,
20,
50
]
}
],
"aggregationTemporality":"AGGREGATION_TEMPORALITY_CUMULATIVE"
}
},
{
"name":"up",
"description":"The scraping was successful",
"gauge":{
"dataPoints":[
{
"timeUnixNano":"1649443516286000000",
"asDouble":1
}
]
}
},
{
"name":"scrape_duration_seconds",
"description":"Duration of the scrape",
"unit":"seconds",
"gauge":{
"dataPoints":[
{
"timeUnixNano":"1649443516286000000",
"asDouble":0.00699415
}
]
}
},
{
"name":"scrape_samples_scraped",
"description":"The number of samples the target exposed",
"gauge":{
"dataPoints":[
{
"timeUnixNano":"1649443516286000000",
"asDouble":22
}
]
}
},
{
"name":"scrape_samples_post_metric_relabeling",
"description":"The number of samples remaining after metric relabeling was applied",
"gauge":{
"dataPoints":[
{
"timeUnixNano":"1649443516286000000",
"asDouble":22
}
]
}
}
]
}
]
}
]
}
Loading

0 comments on commit 9f31be1

Please sign in to comment.