Skip to content

Commit df0943b

Browse files
committed
Add TODO for instrument cleanup
1 parent 9dc65e5 commit df0943b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

opentelemetry-sdk/src/metrics/meter_provider.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -327,13 +327,18 @@ mod tests {
327327
.is_shutdown
328328
.load(std::sync::atomic::Ordering::Relaxed));
329329
assert!(!reader.is_shutdown());
330-
// create a meter
331-
let _meter = global::meter("test");
330+
// create a meter and an instrument
331+
let meter = global::meter("test");
332+
let counter = meter.u64_counter("test_counter").init();
332333
// no need to drop a meter for meter_provider shutdown
333334
global::shutdown_meter_provider();
334335
assert!(provider
335336
.is_shutdown
336337
.load(std::sync::atomic::Ordering::Relaxed));
337338
assert!(reader.is_shutdown());
339+
// TODO - assert that the instrument is no longer usable
340+
// As of now, even after shutdown, the instrument can still be used.
341+
// Even though reader is shutdown, and no collect will happen.
342+
assert!(counter.add(1, &[]) == ());
338343
}
339344
}

0 commit comments

Comments
 (0)