@@ -386,8 +386,13 @@ public final class PrometheusCollectorRegistry: Sendable {
386386 }
387387
388388 // 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 ) {
391396 self . box. withLockedValue { store in
392397 switch store [ counter. name] {
393398 case . counter( let storedCounter) :
@@ -404,7 +409,12 @@ public final class PrometheusCollectorRegistry: Sendable {
404409 }
405410 }
406411
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 ) {
408418 self . box. withLockedValue { store in
409419 switch store [ gauge. name] {
410420 case . gauge( let storedGauge) :
@@ -421,7 +431,12 @@ public final class PrometheusCollectorRegistry: Sendable {
421431 }
422432 }
423433
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 ) {
425440 self . box. withLockedValue { store in
426441 switch store [ histogram. name] {
427442 case . durationHistogram( let storedHistogram) :
@@ -438,7 +453,12 @@ public final class PrometheusCollectorRegistry: Sendable {
438453 }
439454 }
440455
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 ) {
442462 self . box. withLockedValue { store in
443463 switch store [ histogram. name] {
444464 case . valueHistogram( let storedHistogram) :
0 commit comments