forget

fun forget(registry: PrometheusRegistry = PrometheusRegistry.defaultRegistry)

Forgets which metric sets initialize registered with registry, so the next call registers them again.

Call it after PrometheusRegistry.clear on a registry that is reused, as a test harness does between specs. Without it, the cleared metric sets are never registered with that registry again. It does not unregister anything, so calling it while the sets are still registered makes the next initialize skip them with a warning, since their names are taken. What was registered with other registries is kept.

Repeated clear and forget cycles leave nothing behind but one thing that is not per registry: the GC notification listener behind the allocation counter of enableMemoryPoolsExports, which is attached once per process and stays attached for the life of the JVM, however many registries use the counter.

Parameters

registry

the registry to forget. Defaults to PrometheusRegistry.defaultRegistry.