@@ -93,10 +93,7 @@ def __init__(
9393 def create_counter (
9494 self , name , unit = "" , description = "" , advisory = None
9595 ) -> APICounter :
96- (
97- instrument_id ,
98- status ,
99- ) = self ._register_instrument (
96+ status = self ._register_instrument (
10097 name , _Counter , unit , description , advisory
10198 )
10299
@@ -116,7 +113,7 @@ def create_counter(
116113 )
117114 if status .already_registered :
118115 with self ._instrument_id_instrument_lock :
119- return self ._instrument_id_instrument [instrument_id ]
116+ return self ._instrument_id_instrument [status . instrument_id ]
120117
121118 instrument = _Counter (
122119 name ,
@@ -127,16 +124,13 @@ def create_counter(
127124 )
128125
129126 with self ._instrument_id_instrument_lock :
130- self ._instrument_id_instrument [instrument_id ] = instrument
127+ self ._instrument_id_instrument [status . instrument_id ] = instrument
131128 return instrument
132129
133130 def create_up_down_counter (
134131 self , name , unit = "" , description = "" , advisory = None
135132 ) -> APIUpDownCounter :
136- (
137- instrument_id ,
138- status ,
139- ) = self ._register_instrument (
133+ status = self ._register_instrument (
140134 name , _UpDownCounter , unit , description , advisory
141135 )
142136
@@ -156,7 +150,7 @@ def create_up_down_counter(
156150 )
157151 if status .already_registered :
158152 with self ._instrument_id_instrument_lock :
159- return self ._instrument_id_instrument [instrument_id ]
153+ return self ._instrument_id_instrument [status . instrument_id ]
160154
161155 instrument = _UpDownCounter (
162156 name ,
@@ -167,16 +161,13 @@ def create_up_down_counter(
167161 )
168162
169163 with self ._instrument_id_instrument_lock :
170- self ._instrument_id_instrument [instrument_id ] = instrument
164+ self ._instrument_id_instrument [status . instrument_id ] = instrument
171165 return instrument
172166
173167 def create_observable_counter (
174168 self , name , callbacks = None , unit = "" , description = "" , advisory = None
175169 ) -> APIObservableCounter :
176- (
177- instrument_id ,
178- status ,
179- ) = self ._register_instrument (
170+ status = self ._register_instrument (
180171 name , _ObservableCounter , unit , description , advisory
181172 )
182173
@@ -196,7 +187,7 @@ def create_observable_counter(
196187 )
197188 if status .already_registered :
198189 with self ._instrument_id_instrument_lock :
199- return self ._instrument_id_instrument [instrument_id ]
190+ return self ._instrument_id_instrument [status . instrument_id ]
200191
201192 instrument = _ObservableCounter (
202193 name ,
@@ -210,7 +201,7 @@ def create_observable_counter(
210201 self ._measurement_consumer .register_asynchronous_instrument (instrument )
211202
212203 with self ._instrument_id_instrument_lock :
213- self ._instrument_id_instrument [instrument_id ] = instrument
204+ self ._instrument_id_instrument [status . instrument_id ] = instrument
214205 return instrument
215206
216207 def create_histogram (
@@ -237,10 +228,7 @@ def create_histogram(
237228 "Advisory must be a dict with explicit_bucket_boundaries key containing a sequence of numbers"
238229 )
239230
240- (
241- instrument_id ,
242- status ,
243- ) = self ._register_instrument (
231+ status = self ._register_instrument (
244232 name , _Histogram , unit , description , advisory
245233 )
246234
@@ -260,7 +248,7 @@ def create_histogram(
260248 )
261249 if status .already_registered :
262250 with self ._instrument_id_instrument_lock :
263- return self ._instrument_id_instrument [instrument_id ]
251+ return self ._instrument_id_instrument [status . instrument_id ]
264252
265253 instrument = _Histogram (
266254 name ,
@@ -271,16 +259,13 @@ def create_histogram(
271259 advisory ,
272260 )
273261 with self ._instrument_id_instrument_lock :
274- self ._instrument_id_instrument [instrument_id ] = instrument
262+ self ._instrument_id_instrument [status . instrument_id ] = instrument
275263 return instrument
276264
277265 def create_gauge (
278266 self , name , unit = "" , description = "" , advisory = None
279267 ) -> APIGauge :
280- (
281- instrument_id ,
282- status ,
283- ) = self ._register_instrument (
268+ status = self ._register_instrument (
284269 name , _Gauge , unit , description , advisory
285270 )
286271
@@ -300,7 +285,7 @@ def create_gauge(
300285 )
301286 if status .already_registered :
302287 with self ._instrument_id_instrument_lock :
303- return self ._instrument_id_instrument [instrument_id ]
288+ return self ._instrument_id_instrument [status . instrument_id ]
304289
305290 instrument = _Gauge (
306291 name ,
@@ -311,16 +296,13 @@ def create_gauge(
311296 )
312297
313298 with self ._instrument_id_instrument_lock :
314- self ._instrument_id_instrument [instrument_id ] = instrument
299+ self ._instrument_id_instrument [status . instrument_id ] = instrument
315300 return instrument
316301
317302 def create_observable_gauge (
318303 self , name , callbacks = None , unit = "" , description = "" , advisory = None
319304 ) -> APIObservableGauge :
320- (
321- instrument_id ,
322- status ,
323- ) = self ._register_instrument (
305+ status = self ._register_instrument (
324306 name , _ObservableGauge , unit , description , advisory
325307 )
326308
@@ -340,7 +322,7 @@ def create_observable_gauge(
340322 )
341323 if status .already_registered :
342324 with self ._instrument_id_instrument_lock :
343- return self ._instrument_id_instrument [instrument_id ]
325+ return self ._instrument_id_instrument [status . instrument_id ]
344326
345327 instrument = _ObservableGauge (
346328 name ,
@@ -354,16 +336,13 @@ def create_observable_gauge(
354336 self ._measurement_consumer .register_asynchronous_instrument (instrument )
355337
356338 with self ._instrument_id_instrument_lock :
357- self ._instrument_id_instrument [instrument_id ] = instrument
339+ self ._instrument_id_instrument [status . instrument_id ] = instrument
358340 return instrument
359341
360342 def create_observable_up_down_counter (
361343 self , name , callbacks = None , unit = "" , description = "" , advisory = None
362344 ) -> APIObservableUpDownCounter :
363- (
364- instrument_id ,
365- status ,
366- ) = self ._register_instrument (
345+ status = self ._register_instrument (
367346 name , _ObservableUpDownCounter , unit , description , advisory
368347 )
369348
@@ -383,7 +362,7 @@ def create_observable_up_down_counter(
383362 )
384363 if status .already_registered :
385364 with self ._instrument_id_instrument_lock :
386- return self ._instrument_id_instrument [instrument_id ]
365+ return self ._instrument_id_instrument [status . instrument_id ]
387366
388367 instrument = _ObservableUpDownCounter (
389368 name ,
@@ -397,7 +376,7 @@ def create_observable_up_down_counter(
397376 self ._measurement_consumer .register_asynchronous_instrument (instrument )
398377
399378 with self ._instrument_id_instrument_lock :
400- self ._instrument_id_instrument [instrument_id ] = instrument
379+ self ._instrument_id_instrument [status . instrument_id ] = instrument
401380 return instrument
402381
403382
0 commit comments