Sha256: e47569255e628a05c2fe6923d4836df4caabeb3d0fc35735565f940197c7d8b5
Contents?: true
Size: 1.57 KB
Versions: 2
Compression:
Stored size: 1.57 KB
Contents
module Prometheus module Client module Helper module MetricsProcessing def self.merge_metrics(metrics) metrics end def self.min(a, b) if a < b a else b end end def self.max(a, b) if a > b a else b end end def self.merge_samples(raw_samples, metric_type, multiprocess_mode) samples = {} raw_samples.each do |name, labels, value| key = { name: name, labels: labels } # without_pid = labels.delete(:pid) case metric_type when :gauge case multiprocess_mode when 'min' labels.delete(:pid) s = samples.fetch(key, value) samples[key] = min(s, value) when 'max' labels.delete(:pid) s = samples.fetch(key, value) samples[key] = max(s, value) when 'livesum' labels.delete(:pid) s = samples.fetch(key, 0.0) samples[key] = s + value else # all/liveall samples[key] = value end else labels.delete(:pid) # Counter, Histogram and Summary. s = samples.fetch(key, 0.0) samples[key] = s + value end end samples end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
prometheus-client-mmap-0.7.0.beta32 | lib/prometheus/client/helper/metrics_processing.rb |
prometheus-client-mmap-0.7.0.beta31 | lib/prometheus/client/helper/metrics_processing.rb |