@@ -97,7 +97,8 @@ init_per_testcase(provider_test, Config) ->
97
97
application :load (opentelemetry_experimental ),
98
98
ok = application :set_env (opentelemetry_experimental , readers ,
99
99
[#{module => otel_metric_reader ,
100
- config => #{exporter => {otel_metric_exporter_pid , self ()}}}]),
100
+ config => #{exporter => {otel_metric_exporter_pid , self ()},
101
+ default_temporality_mapping => default_temporality_mapping ()}}]),
101
102
ok = application :set_env (opentelemetry_experimental , views ,
102
103
[#{selector => #{instrument_name => a_counter },
103
104
aggregation_module => otel_aggregation_sum },
@@ -117,9 +118,11 @@ init_per_testcase(multiple_readers, Config) ->
117
118
application :load (opentelemetry_experimental ),
118
119
ok = application :set_env (opentelemetry_experimental , readers ,
119
120
[#{module => otel_metric_reader ,
120
- config => #{exporter => {otel_metric_exporter_pid , self ()}}},
121
+ config => #{exporter => {otel_metric_exporter_pid , self ()},
122
+ default_temporality_mapping => default_temporality_mapping ()}},
121
123
#{module => otel_metric_reader ,
122
124
config => #{exporter => {otel_metric_exporter_pid , self ()},
125
+ default_temporality_mapping => default_temporality_mapping (),
123
126
default_aggregation_mapping =>
124
127
#{? KIND_COUNTER => otel_aggregation_drop }}}]),
125
128
@@ -132,13 +135,14 @@ init_per_testcase(delta_counter, Config) ->
132
135
% % delta is the default for a counter with sum aggregation
133
136
% % so no need to set any temporality mapping in the reader
134
137
ok = application :set_env (opentelemetry_experimental , readers , [#{module => otel_metric_reader ,
135
- config => #{exporter => {otel_metric_exporter_pid , self ()}}}]),
138
+ config => #{exporter => {otel_metric_exporter_pid , self ()},
139
+ default_temporality_mapping => default_temporality_mapping ()}}]),
136
140
137
141
{ok , _ } = application :ensure_all_started (opentelemetry_experimental ),
138
142
139
143
Config ;
140
144
init_per_testcase (cumulative_counter , Config ) ->
141
- CumulativeCounterTemporality = #{ ? KIND_COUNTER => ? TEMPORALITY_CUMULATIVE } ,
145
+ CumulativeCounterTemporality = maps : put ( ? KIND_COUNTER , ? TEMPORALITY_CUMULATIVE , default_temporality_mapping ()) ,
142
146
application :load (opentelemetry_experimental ),
143
147
ok = application :set_env (opentelemetry_experimental , readers , [#{module => otel_metric_reader ,
144
148
config => #{exporter => {otel_metric_exporter_pid , self ()},
@@ -149,7 +153,7 @@ init_per_testcase(cumulative_counter, Config) ->
149
153
150
154
Config ;
151
155
init_per_testcase (delta_explicit_histograms , Config ) ->
152
- DeltaHistogramTemporality = #{ ? KIND_HISTOGRAM => ? TEMPORALITY_DELTA } ,
156
+ DeltaHistogramTemporality = maps : put ( ? KIND_HISTOGRAM , ? TEMPORALITY_DELTA , default_temporality_mapping ()) ,
153
157
application :load (opentelemetry_experimental ),
154
158
ok = application :set_env (opentelemetry_experimental , readers , [#{module => otel_metric_reader ,
155
159
config => #{exporter => {otel_metric_exporter_pid , self ()},
@@ -160,7 +164,7 @@ init_per_testcase(delta_explicit_histograms, Config) ->
160
164
161
165
Config ;
162
166
init_per_testcase (delta_observable_counter , Config ) ->
163
- DeltaObservableCounterTemporality = #{ ? KIND_OBSERVABLE_COUNTER => ? TEMPORALITY_DELTA } ,
167
+ DeltaObservableCounterTemporality = maps : put ( ? KIND_OBSERVABLE_COUNTER , ? TEMPORALITY_DELTA , default_temporality_mapping ()) ,
164
168
application :load (opentelemetry_experimental ),
165
169
ok = application :set_env (opentelemetry_experimental , readers , [#{module => otel_metric_reader ,
166
170
config => #{exporter => {otel_metric_exporter_pid , self ()},
@@ -173,7 +177,8 @@ init_per_testcase(delta_observable_counter, Config) ->
173
177
init_per_testcase (_ , Config ) ->
174
178
application :load (opentelemetry_experimental ),
175
179
ok = application :set_env (opentelemetry_experimental , readers , [#{module => otel_metric_reader ,
176
- config => #{exporter => {otel_metric_exporter_pid , self ()}}}]),
180
+ config => #{exporter => {otel_metric_exporter_pid , self ()},
181
+ default_temporality_mapping => default_temporality_mapping ()}}]),
177
182
178
183
{ok , _ } = application :ensure_all_started (opentelemetry_experimental ),
179
184
@@ -193,6 +198,16 @@ default_resource(_Config) ->
193
198
194
199
ok .
195
200
201
+ default_temporality_mapping () ->
202
+ #{
203
+ ? KIND_COUNTER => ? TEMPORALITY_DELTA ,
204
+ ? KIND_OBSERVABLE_COUNTER => ? TEMPORALITY_CUMULATIVE ,
205
+ ? KIND_UPDOWN_COUNTER => ? TEMPORALITY_DELTA ,
206
+ ? KIND_OBSERVABLE_UPDOWNCOUNTER => ? TEMPORALITY_CUMULATIVE ,
207
+ ? KIND_HISTOGRAM => ? TEMPORALITY_DELTA ,
208
+ ? KIND_OBSERVABLE_GAUGE => ? TEMPORALITY_CUMULATIVE
209
+ }.
210
+
196
211
using_macros (_Config ) ->
197
212
DefaultMeter = otel_meter_default ,
198
213
0 commit comments