Browse Source

Use begin-end block with at-lock macro to help coverage

pull/12/head
Fredrik Ekre 2 years ago
parent
commit
8ebae4f592
  1. 4
      src/Prometheus.jl

4
src/Prometheus.jl

@ -1042,9 +1042,11 @@ end
function expose_io(io::IO, reg::CollectorRegistry) function expose_io(io::IO, reg::CollectorRegistry)
# Collect all metrics # Collect all metrics
metrics = Metric[] metrics = Metric[]
@lock reg.lock for collector in reg.collectors @lock reg.lock begin
for collector in reg.collectors
collect!(metrics, collector) collect!(metrics, collector)
end end
end
sort!(metrics; by = metric -> metric.metric_name) sort!(metrics; by = metric -> metric.metric_name)
# Write to IO # Write to IO
buf = IOBuffer(; maxsize=1024^2) # 1 MB buf = IOBuffer(; maxsize=1024^2) # 1 MB

Loading…
Cancel
Save