Sha256: 496d1276b8b3f2ec7a16d309baf80873dc2299a0205635ee953a22b2a1e521d8
Contents?: true
Size: 1.07 KB
Versions: 1
Compression:
Stored size: 1.07 KB
Contents
# frozen_string_literal: true # Copyright The OpenTelemetry Authors # # SPDX-License-Identifier: Apache-2.0 module OpenTelemetry module Internal # @api private class ProxyInstrument def initialize(kind, name, unit, desc, callable) @kind = kind @name = name @unit = unit @desc = desc @callable = callable @delegate = nil end def upgrade_with(meter) @delegate = case @kind when :counter, :histogram, :up_down_counter, :gauge meter.send("create_#{@kind}", @name, unit: @unit, description: @desc) when :observable_counter, :observable_gauge, :observable_up_down_counter meter.send("create_#{@kind}", @name, unit: @unit, description: @desc, callback: @callback) end end def add(amount, attributes: nil) @delegate&.add(amount, attributes: attributes) end def record(amount, attributes: nil) @delegate&.record(amount, attributes: attributes) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
opentelemetry-metrics-api-0.2.0 | lib/opentelemetry/internal/proxy_instrument.rb |