Skip to content

Commit df0e9ac

Browse files
authored
Add snapshot tests for synchronous instruments with int and float types (#209)
1 parent afe9810 commit df0e9ac

File tree

9 files changed

+481
-24
lines changed

9 files changed

+481
-24
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{
2+
"/google.monitoring.v3.MetricService/CreateMetricDescriptor": [
3+
{
4+
"metricDescriptor": {
5+
"description": "foo",
6+
"displayName": "mycounter",
7+
"labels": [
8+
{
9+
"key": "string"
10+
},
11+
{
12+
"key": "int"
13+
},
14+
{
15+
"key": "float"
16+
}
17+
],
18+
"metricKind": "CUMULATIVE",
19+
"type": "workload.googleapis.com/mycounter",
20+
"valueType": "DOUBLE"
21+
},
22+
"name": "projects/fakeproject"
23+
}
24+
],
25+
"/google.monitoring.v3.MetricService/CreateTimeSeries": [
26+
{
27+
"name": "projects/fakeproject",
28+
"timeSeries": [
29+
{
30+
"metric": {
31+
"labels": {
32+
"float": "123.4",
33+
"int": "123",
34+
"string": "string"
35+
},
36+
"type": "workload.googleapis.com/mycounter"
37+
},
38+
"metricKind": "CUMULATIVE",
39+
"points": [
40+
{
41+
"interval": {
42+
"endTime": "str",
43+
"startTime": "str"
44+
},
45+
"value": {
46+
"doubleValue": 45.6
47+
}
48+
}
49+
],
50+
"resource": {
51+
"labels": {
52+
"location": "global",
53+
"namespace": "",
54+
"node_id": ""
55+
},
56+
"type": "generic_node"
57+
}
58+
}
59+
]
60+
}
61+
]
62+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
{
2+
"/google.monitoring.v3.MetricService/CreateMetricDescriptor": [
3+
{
4+
"metricDescriptor": {
5+
"description": "foo",
6+
"displayName": "myhistogram",
7+
"labels": [
8+
{
9+
"key": "string"
10+
},
11+
{
12+
"key": "int"
13+
},
14+
{
15+
"key": "float"
16+
}
17+
],
18+
"metricKind": "CUMULATIVE",
19+
"type": "workload.googleapis.com/myhistogram",
20+
"valueType": "DISTRIBUTION"
21+
},
22+
"name": "projects/fakeproject"
23+
}
24+
],
25+
"/google.monitoring.v3.MetricService/CreateTimeSeries": [
26+
{
27+
"name": "projects/fakeproject",
28+
"timeSeries": [
29+
{
30+
"metric": {
31+
"labels": {
32+
"float": "123.4",
33+
"int": "123",
34+
"string": "string"
35+
},
36+
"type": "workload.googleapis.com/myhistogram"
37+
},
38+
"metricKind": "CUMULATIVE",
39+
"points": [
40+
{
41+
"interval": {
42+
"endTime": "str",
43+
"startTime": "str"
44+
},
45+
"value": {
46+
"distributionValue": {
47+
"bucketCounts": [
48+
"1",
49+
"5",
50+
"5",
51+
"15",
52+
"25",
53+
"25",
54+
"25",
55+
"150",
56+
"250",
57+
"250",
58+
"250",
59+
"1500",
60+
"2500",
61+
"2500",
62+
"2499",
63+
"0"
64+
],
65+
"bucketOptions": {
66+
"explicitBuckets": {
67+
"bounds": [
68+
0.0,
69+
5.0,
70+
10.0,
71+
25.0,
72+
50.0,
73+
75.0,
74+
100.0,
75+
250.0,
76+
500.0,
77+
750.0,
78+
1000.0,
79+
2500.0,
80+
5000.0,
81+
7500.0,
82+
10000.0
83+
]
84+
}
85+
},
86+
"count": "10000",
87+
"mean": 4999.5
88+
}
89+
}
90+
}
91+
],
92+
"resource": {
93+
"labels": {
94+
"location": "global",
95+
"namespace": "",
96+
"node_id": ""
97+
},
98+
"type": "generic_node"
99+
}
100+
}
101+
]
102+
}
103+
]
104+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
{
2+
"/google.monitoring.v3.MetricService/CreateMetricDescriptor": [
3+
{
4+
"metricDescriptor": {
5+
"description": "foo",
6+
"displayName": "myhistogram",
7+
"labels": [
8+
{
9+
"key": "string"
10+
},
11+
{
12+
"key": "int"
13+
},
14+
{
15+
"key": "float"
16+
}
17+
],
18+
"metricKind": "CUMULATIVE",
19+
"type": "workload.googleapis.com/myhistogram",
20+
"valueType": "DISTRIBUTION"
21+
},
22+
"name": "projects/fakeproject"
23+
}
24+
],
25+
"/google.monitoring.v3.MetricService/CreateTimeSeries": [
26+
{
27+
"name": "projects/fakeproject",
28+
"timeSeries": [
29+
{
30+
"metric": {
31+
"labels": {
32+
"float": "123.4",
33+
"int": "123",
34+
"string": "string"
35+
},
36+
"type": "workload.googleapis.com/myhistogram"
37+
},
38+
"metricKind": "CUMULATIVE",
39+
"points": [
40+
{
41+
"interval": {
42+
"endTime": "str",
43+
"startTime": "str"
44+
},
45+
"value": {
46+
"distributionValue": {
47+
"bucketCounts": [
48+
"6",
49+
"9994"
50+
],
51+
"bucketOptions": {
52+
"explicitBuckets": {
53+
"bounds": [
54+
5.5
55+
]
56+
}
57+
},
58+
"count": "10000",
59+
"mean": 4999.5
60+
}
61+
}
62+
}
63+
],
64+
"resource": {
65+
"labels": {
66+
"location": "global",
67+
"namespace": "",
68+
"node_id": ""
69+
},
70+
"type": "generic_node"
71+
}
72+
}
73+
]
74+
}
75+
]
76+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{
2+
"/google.monitoring.v3.MetricService/CreateMetricDescriptor": [
3+
{
4+
"metricDescriptor": {
5+
"description": "foo",
6+
"displayName": "myupdowncounter",
7+
"labels": [
8+
{
9+
"key": "string"
10+
},
11+
{
12+
"key": "int"
13+
},
14+
{
15+
"key": "float"
16+
}
17+
],
18+
"metricKind": "GAUGE",
19+
"type": "workload.googleapis.com/myupdowncounter",
20+
"valueType": "DOUBLE"
21+
},
22+
"name": "projects/fakeproject"
23+
}
24+
],
25+
"/google.monitoring.v3.MetricService/CreateTimeSeries": [
26+
{
27+
"name": "projects/fakeproject",
28+
"timeSeries": [
29+
{
30+
"metric": {
31+
"labels": {
32+
"float": "123.4",
33+
"int": "123",
34+
"string": "string"
35+
},
36+
"type": "workload.googleapis.com/myupdowncounter"
37+
},
38+
"metricKind": "GAUGE",
39+
"points": [
40+
{
41+
"interval": {
42+
"endTime": "str"
43+
},
44+
"value": {
45+
"doubleValue": 45.6
46+
}
47+
}
48+
],
49+
"resource": {
50+
"labels": {
51+
"location": "global",
52+
"namespace": "",
53+
"node_id": ""
54+
},
55+
"type": "generic_node"
56+
}
57+
}
58+
]
59+
}
60+
]
61+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{
2+
"/google.monitoring.v3.MetricService/CreateMetricDescriptor": [
3+
{
4+
"metricDescriptor": {
5+
"description": "foo",
6+
"displayName": "myupdowncounter",
7+
"labels": [
8+
{
9+
"key": "string"
10+
},
11+
{
12+
"key": "int"
13+
},
14+
{
15+
"key": "float"
16+
}
17+
],
18+
"metricKind": "GAUGE",
19+
"type": "workload.googleapis.com/myupdowncounter",
20+
"valueType": "INT64"
21+
},
22+
"name": "projects/fakeproject"
23+
}
24+
],
25+
"/google.monitoring.v3.MetricService/CreateTimeSeries": [
26+
{
27+
"name": "projects/fakeproject",
28+
"timeSeries": [
29+
{
30+
"metric": {
31+
"labels": {
32+
"float": "123.4",
33+
"int": "123",
34+
"string": "string"
35+
},
36+
"type": "workload.googleapis.com/myupdowncounter"
37+
},
38+
"metricKind": "GAUGE",
39+
"points": [
40+
{
41+
"interval": {
42+
"endTime": "str"
43+
},
44+
"value": {
45+
"int64Value": "123"
46+
}
47+
}
48+
],
49+
"resource": {
50+
"labels": {
51+
"location": "global",
52+
"namespace": "",
53+
"node_id": ""
54+
},
55+
"type": "generic_node"
56+
}
57+
}
58+
]
59+
}
60+
]
61+
}

opentelemetry-exporter-gcp-monitoring/tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
# pylint: disable=unused-import
1616

1717
# import fixtures to be made available to other tests
18-
from fixtures.gcmfake import fixture_gcmfake
18+
from fixtures.gcmfake import fixture_gcmfake, fixture_make_meter_provider
1919
from fixtures.snapshot_gcmcalls import fixture_snapshot_gcmcalls

0 commit comments

Comments
 (0)