Sha256: 091487ddfcb03c0fe89f0ac9721112e1ea61b2cfb84d31a314013a880b62ed3b
Contents?: true
Size: 1.41 KB
Versions: 4
Compression:
Stored size: 1.41 KB
Contents
# frozen_string_literal: true # Copyright The OpenTelemetry Authors # # SPDX-License-Identifier: Apache-2.0 module OpenTelemetry module SDK module Metrics module Instrument # {UpDownCounter} is the SDK implementation of {OpenTelemetry::Metrics::UpDownCounter}. class UpDownCounter < OpenTelemetry::SDK::Metrics::Instrument::SynchronousInstrument # Returns the instrument kind as a Symbol # # @return [Symbol] def instrument_kind :up_down_counter end # Increment or decrement the UpDownCounter by a fixed amount. # # @param [Numeric] amount The amount to be added, can be positive, negative or zero. # @param [Hash{String => String, Numeric, Boolean, Array<String, Numeric, Boolean>}] attributes # Values must be non-nil and (array of) string, boolean or numeric type. # Array values must not contain nil elements and all elements must be of # the same basic type (string, numeric, boolean). def add(amount, attributes: {}) update(amount, attributes) nil rescue StandardError => e OpenTelemetry.handle_error(exception: e) nil end private def default_aggregation OpenTelemetry::SDK::Metrics::Aggregation::Sum.new end end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems