Sha256: 4e16866d7b512e8d94c0e870123794c8c810abf286c0685fe093dee2949bc894
Contents?: true
Size: 723 Bytes
Versions: 1
Compression:
Stored size: 723 Bytes
Contents
# frozen_string_literal: true module Fluent module GcloudPubSub # Utilities for interacting with Prometheus metrics module Metrics def self.register_or_existing(metric_name) return ::Prometheus::Client.registry.get(metric_name) if ::Prometheus::Client.registry.exist?(metric_name) yield end # Time the elapsed execution of the provided block, return the duration # as the first element followed by the result of the block. def self.measure_duration start = Process.clock_gettime(Process::CLOCK_MONOTONIC) result = yield finish = Process.clock_gettime(Process::CLOCK_MONOTONIC) [finish - start, *result] end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fluent-plugin-gcloud-pubsub-custom-compress-batches-1.3.4 | lib/fluent/plugin/gcloud_pubsub/metrics.rb |