Method: Datadog::Statsd#decrement

Defined in:
lib/datadog/statsd.rb

#decrement(stat, opts = EMPTY_OPTIONS) ⇒ Object

Sends a decrement (count = -1) for the given stat to the statsd server.

Parameters:

  • stat name

  • (defaults to: EMPTY_OPTIONS)

    the options to create the metric with

Options Hash (opts):

  • :sample_rate (Numeric)

    sample rate, 1 for always

  • :pre_sampled (Boolean)

    If true, the client assumes the caller has already sampled metrics at :sample_rate, and doesn’t perform sampling.

  • :tags (Array<String>)

    An array of tags

  • :by (Numeric)

    decrement value, default 1

  • :cardinality (String)

    The tag cardinality to use

See Also:



205
206
207
208
209
# File 'lib/datadog/statsd.rb', line 205

def decrement(stat, opts = EMPTY_OPTIONS)
  opts = { sample_rate: opts } if opts.is_a?(Numeric)
  decr_value = - opts.fetch(:by, 1)
  count(stat, decr_value, opts)
end