@@ -386,8 +386,13 @@ public final class PrometheusCollectorRegistry: Sendable {
386
386
}
387
387
388
388
// MARK: Destroying Metrics
389
-
390
- public func destroyCounter( _ counter: Counter ) {
389
+
390
+ /// Unregisters a ``Counter`` from the ``PrometheusCollectorRegistry``. This means that the provided ``Counter``
391
+ /// will not be included in future ``emit(into:)`` calls.
392
+ ///
393
+ /// - Note: If the provided ``Counter`` is unknown to the registry this function call will be ignored
394
+ /// - Parameter counter: The ``Counter`` that shall be removed from the registry
395
+ public func unregisterCounter( _ counter: Counter ) {
391
396
self . box. withLockedValue { store in
392
397
switch store [ counter. name] {
393
398
case . counter( let storedCounter) :
@@ -404,7 +409,12 @@ public final class PrometheusCollectorRegistry: Sendable {
404
409
}
405
410
}
406
411
407
- public func destroyGauge( _ gauge: Gauge ) {
412
+ /// Unregisters a ``Gauge`` from the ``PrometheusCollectorRegistry``. This means that the provided ``Gauge``
413
+ /// will not be included in future ``emit(into:)`` calls.
414
+ ///
415
+ /// - Note: If the provided ``Gauge`` is unknown to the registry this function call will be ignored
416
+ /// - Parameter gauge: The ``Gauge`` that shall be removed from the registry
417
+ public func unregisterGauge( _ gauge: Gauge ) {
408
418
self . box. withLockedValue { store in
409
419
switch store [ gauge. name] {
410
420
case . gauge( let storedGauge) :
@@ -421,7 +431,12 @@ public final class PrometheusCollectorRegistry: Sendable {
421
431
}
422
432
}
423
433
424
- public func destroyTimeHistogram( _ histogram: DurationHistogram ) {
434
+ /// Unregisters a ``DurationHistogram`` from the ``PrometheusCollectorRegistry``. This means that this ``DurationHistogram``
435
+ /// will not be included in future ``emit(into:)`` calls.
436
+ ///
437
+ /// - Note: If the provided ``DurationHistogram`` is unknown to the registry this function call will be ignored
438
+ /// - Parameter histogram: The ``DurationHistogram`` that shall be removed from the registry
439
+ public func unregisterTimeHistogram( _ histogram: DurationHistogram ) {
425
440
self . box. withLockedValue { store in
426
441
switch store [ histogram. name] {
427
442
case . durationHistogram( let storedHistogram) :
@@ -438,7 +453,12 @@ public final class PrometheusCollectorRegistry: Sendable {
438
453
}
439
454
}
440
455
441
- public func destroyValueHistogram( _ histogram: ValueHistogram ) {
456
+ /// Unregisters a ``ValueHistogram`` from the ``PrometheusCollectorRegistry``. This means that this ``ValueHistogram``
457
+ /// will not be included in future ``emit(into:)`` calls.
458
+ ///
459
+ /// - Note: If the provided ``ValueHistogram`` is unknown to the registry this function call will be ignored
460
+ /// - Parameter histogram: The ``ValueHistogram`` that shall be removed from the registry
461
+ public func unregisterValueHistogram( _ histogram: ValueHistogram ) {
442
462
self . box. withLockedValue { store in
443
463
switch store [ histogram. name] {
444
464
case . valueHistogram( let storedHistogram) :
0 commit comments