2626)
2727from opentelemetry .proto .metrics .v1 .metrics_pb2 import (
2828 InstrumentationLibraryMetrics ,
29- Int64DataPoint ,
29+ IntDataPoint ,
3030)
3131from opentelemetry .proto .metrics .v1 .metrics_pb2 import (
32- Metric as CollectorMetric ,
32+ Metric as OTLPMetric ,
3333)
3434from opentelemetry .proto .metrics .v1 .metrics_pb2 import (
35- MetricDescriptor ,
3635 ResourceMetrics ,
36+ IntSum ,
37+ AggregationTemporality ,
3738)
3839from opentelemetry .proto .resource .v1 .resource_pb2 import (
39- Resource as CollectorResource ,
40+ Resource as OTLPResource ,
4041)
4142from opentelemetry .sdk .metrics import Counter , MeterProvider
4243from opentelemetry .sdk .metrics .export import MetricRecord
@@ -71,7 +72,7 @@ def test_translate_metrics(self):
7172 expected = ExportMetricsServiceRequest (
7273 resource_metrics = [
7374 ResourceMetrics (
74- resource = CollectorResource (
75+ resource = OTLPResource (
7576 attributes = [
7677 KeyValue (key = "a" , value = AnyValue (int_value = 1 )),
7778 KeyValue (
@@ -82,26 +83,27 @@ def test_translate_metrics(self):
8283 instrumentation_library_metrics = [
8384 InstrumentationLibraryMetrics (
8485 metrics = [
85- CollectorMetric (
86- metric_descriptor = MetricDescriptor (
87- name = "a" ,
88- description = "b" ,
89- unit = "c" ,
90- type = MetricDescriptor .Type .INT64 ,
91- temporality = (
92- MetricDescriptor .Temporality .DELTA
86+ OTLPMetric (
87+ name = "a" ,
88+ description = "b" ,
89+ unit = "c" ,
90+ data = IntSum (
91+ data_points = [
92+ IntDataPoint (
93+ labels = [
94+ StringKeyValue (
95+ key = "a" , value = "b"
96+ )
97+ ],
98+ value = 1 ,
99+ )
100+ ],
101+ aggregation_temporality = (
102+ AggregationTemporality .
103+ AGGREGATION_TEMPORALITY_CUMULATIVE
93104 ),
94- ),
95- int64_data_points = [
96- Int64DataPoint (
97- labels = [
98- StringKeyValue (
99- key = "a" , value = "b"
100- )
101- ],
102- value = 1 ,
103- )
104- ],
105+ is_monotonic = False ,
106+ )
105107 )
106108 ]
107109 )
0 commit comments