From 2bb0c3aa06b3d3e3c70c9f7d88723a8430749164 Mon Sep 17 00:00:00 2001 From: Fredrik Ekre Date: Sun, 5 Nov 2023 22:02:48 +0100 Subject: [PATCH] GCCollector: user keyword arguments for construction. --- src/Prometheus.jl | 2 +- src/gc_collector.jl | 2 +- test/runtests.jl | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Prometheus.jl b/src/Prometheus.jl index 13fe169..5813b0a 100644 --- a/src/Prometheus.jl +++ b/src/Prometheus.jl @@ -630,7 +630,7 @@ include("process_collector.jl") # Default registry and collectors const DEFAULT_REGISTRY = CollectorRegistry() -const GC_COLLECTOR = GCCollector(DEFAULT_REGISTRY) +const GC_COLLECTOR = GCCollector(; registry=DEFAULT_REGISTRY) const PROCESS_COLLECTOR = ProcessCollector(DEFAULT_REGISTRY) end # module Prometheus diff --git a/src/gc_collector.jl b/src/gc_collector.jl index c49a744..aa3dda5 100644 --- a/src/gc_collector.jl +++ b/src/gc_collector.jl @@ -3,7 +3,7 @@ ############################ mutable struct GCCollector <: Collector - function GCCollector(registry::Union{CollectorRegistry, Nothing}=DEFAULT_REGISTRY) + function GCCollector(; registry::Union{CollectorRegistry, Nothing}=DEFAULT_REGISTRY) gcc = new() if registry !== nothing register(registry, gcc) diff --git a/test/runtests.jl b/test/runtests.jl index 32ed895..566cfa9 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -281,7 +281,7 @@ end @testset "Prometheus.GCCollector" begin r = Prometheus.CollectorRegistry() - c = Prometheus.GCCollector(r) + c = Prometheus.GCCollector(; registry=r) @test c in r.collectors # Record before and after stats and test that the metrics are in between old_stats = Base.gc_num()