Skip to content

Commit

Permalink
Send exponential histograms to GMP
Browse files Browse the repository at this point in the history
  • Loading branch information
aabmass committed Jun 28, 2023
1 parent f778f24 commit add3dff
Show file tree
Hide file tree
Showing 4 changed files with 340 additions and 6 deletions.
2 changes: 1 addition & 1 deletion exporter/collector/googlemanagedprometheus/naming.go
Expand Up @@ -43,7 +43,7 @@ func GetMetricName(baseName string, metric pmetric.Metric) (string, error) {
return compliantName + "_count/summary", nil
}
return compliantName + "/summary", nil
case pmetric.MetricTypeHistogram:
case pmetric.MetricTypeHistogram, pmetric.MetricTypeExponentialHistogram:
return compliantName + "/histogram", nil
default:
return "", fmt.Errorf("unsupported metric datatype: %v", metric.Type())
Expand Down
8 changes: 4 additions & 4 deletions exporter/collector/googlemanagedprometheus/naming_test.go
Expand Up @@ -122,13 +122,13 @@ func TestGetMetricName(t *testing.T) {
expected: "hello/histogram",
},
{
desc: "other",
baseName: "other",
desc: "exponential histogram",
baseName: "hello",
metric: func(m pmetric.Metric) {
m.SetName("other")
m.SetName("hello")
m.SetEmptyExponentialHistogram()
},
expectErr: true,
expected: "hello/histogram",
},
} {
t.Run(tc.desc, func(t *testing.T) {
Expand Down
Expand Up @@ -472,6 +472,149 @@
}
}
]
},
{
"scope": {
"name": "exponentialhistscope"
},
"metrics": [
{
"name": "exp_hist",
"description": "The request latency in seconds",
"unit": "s",
"exponentialHistogram": {
"dataPoints": [
{
"startTimeUnixNano": "1640104132003289220",
"timeUnixNano": "1640104132005463582",
"count": "10000",
"sum": 1984636.3282113941,
"scale": 4,
"positive": {
"offset": 106,
"bucketCounts": [
"646",
"736",
"733",
"639",
"606",
"585",
"480",
"481",
"411",
"436",
"366",
"304",
"309",
"270",
"226",
"210",
"238",
"169",
"181",
"178",
"149",
"132",
"131",
"117",
"109",
"89",
"107",
"80",
"78",
"75",
"56",
"73",
"59",
"51",
"46",
"53",
"22",
"31",
"35",
"24",
"23",
"31",
"18",
"8",
"16",
"12",
"15",
"13",
"12",
"12",
"12",
"7",
"7",
"7",
"9",
"5",
"4",
"4",
"8",
"6",
"3",
"1",
"4",
"2",
"2",
"4",
"5",
"1",
"2",
"2",
"1",
"0",
"1",
"2",
"2",
"1",
"0",
"0",
"2",
"1",
"2",
"1",
"0",
"2",
"0",
"0",
"2",
"0",
"1",
"1",
"0",
"0",
"0",
"0",
"1",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"1",
"0",
"0",
"0",
"0",
"1",
"1",
"0",
"1"
]
},
"negative": {}
}
],
"aggregationTemporality": "AGGREGATION_TEMPORALITY_CUMULATIVE"
}
}
]
}
]
}
Expand Down
Expand Up @@ -900,6 +900,197 @@
],
"unit": "seconds"
},
{
"metric": {
"type": "prometheus.googleapis.com/exp_hist_seconds/histogram",
"labels": {
"otel_scope_name": "exponentialhistscope",
"otel_scope_version": ""
}
},
"resource": {
"type": "prometheus_target",
"labels": {
"cluster": "rabbitmq-test-dev",
"instance": "10.92.5.2:15692",
"job": "demo",
"location": "us-central1-c",
"namespace": "default"
}
},
"metricKind": "CUMULATIVE",
"valueType": "DISTRIBUTION",
"points": [
{
"interval": {
"endTime": "1970-01-01T00:00:00Z",
"startTime": "1970-01-01T00:00:00Z"
},
"value": {
"distributionValue": {
"count": "10000",
"mean": 198.4636328211394,
"bucketOptions": {
"exponentialBuckets": {
"numFiniteBuckets": 113,
"growthFactor": 1.0442737824274138,
"scale": 98.70149282610706
}
},
"bucketCounts": [
"0",
"646",
"736",
"733",
"639",
"606",
"585",
"480",
"481",
"411",
"436",
"366",
"304",
"309",
"270",
"226",
"210",
"238",
"169",
"181",
"178",
"149",
"132",
"131",
"117",
"109",
"89",
"107",
"80",
"78",
"75",
"56",
"73",
"59",
"51",
"46",
"53",
"22",
"31",
"35",
"24",
"23",
"31",
"18",
"8",
"16",
"12",
"15",
"13",
"12",
"12",
"12",
"7",
"7",
"7",
"9",
"5",
"4",
"4",
"8",
"6",
"3",
"1",
"4",
"2",
"2",
"4",
"5",
"1",
"2",
"2",
"1",
"0",
"1",
"2",
"2",
"1",
"0",
"0",
"2",
"1",
"2",
"1",
"0",
"2",
"0",
"0",
"2",
"0",
"1",
"1",
"0",
"0",
"0",
"0",
"1",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"1",
"0",
"0",
"0",
"0",
"1",
"1",
"0",
"1",
"0"
]
}
}
}
],
"unit": "s"
},
{
"metric": {
"type": "prometheus.googleapis.com/otel_scope_info/gauge",
"labels": {
"otel_scope_name": "exponentialhistscope",
"otel_scope_version": ""
}
},
"resource": {
"type": "prometheus_target",
"labels": {
"cluster": "rabbitmq-test-dev",
"instance": "10.92.5.2:15692",
"job": "demo",
"location": "us-central1-c",
"namespace": "default"
}
},
"metricKind": "GAUGE",
"valueType": "INT64",
"points": [
{
"interval": {
"endTime": "1970-01-01T00:00:00Z"
},
"value": {
"int64Value": "1"
}
}
]
},
{
"metric": {
"type": "prometheus.googleapis.com/target_info/gauge",
Expand Down Expand Up @@ -961,7 +1152,7 @@
"startTime": "1970-01-01T00:00:00Z"
},
"value": {
"int64Value": "29"
"int64Value": "31"
}
}
]
Expand Down

0 comments on commit add3dff

Please sign in to comment.