module Sentry::Metrics

def count(name, value: 1, attributes: nil)

Returns:
  • (void) -

Parameters:
  • attributes (Hash, nil) -- additional attributes for the metric (optional)
  • value (Numeric) -- the value to increment by (default: 1)
  • name (String) -- the metric name
def count(name, value: 1, attributes: nil)
  return unless Sentry.initialized?
  Sentry.get_current_hub.capture_metric(
    name: name,
    type: :counter,
    value: value,
    attributes: attributes
  )
end

def distribution(name, value, unit: nil, attributes: nil)

Returns:
  • (void) -

Parameters:
  • attributes (Hash, nil) -- additional attributes for the metric (optional)
  • unit (String, nil) -- the metric unit (optional)
  • value (Numeric) -- the distribution value
  • name (String) -- the metric name
def distribution(name, value, unit: nil, attributes: nil)
  return unless Sentry.initialized?
  Sentry.get_current_hub.capture_metric(
    name: name,
    type: :distribution,
    value: value,
    unit: unit,
    attributes: attributes
  )
end

def gauge(name, value, unit: nil, attributes: nil)

Returns:
  • (void) -

Parameters:
  • attributes (Hash, nil) -- additional attributes for the metric (optional)
  • unit (String, nil) -- the metric unit (optional)
  • value (Numeric) -- the gauge value
  • name (String) -- the metric name
def gauge(name, value, unit: nil, attributes: nil)
  return unless Sentry.initialized?
  Sentry.get_current_hub.capture_metric(
    name: name,
    type: :gauge,
    value: value,
    unit: unit,
    attributes: attributes
  )
end