Method: Sentry::Metrics.gauge

Defined in:
lib/sentry/metrics.rb

.gauge(name, value, unit: nil, attributes: nil) ⇒ void

This method returns an undefined value.

Records a gauge metric

Parameters:

  • name (String)

    the metric name

  • value (Numeric)

    the gauge value

  • unit (String, nil) (defaults to: nil)

    the metric unit (optional)

  • attributes (Hash, nil) (defaults to: nil)

    additional attributes for the metric (optional)



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/sentry/metrics.rb', line 30

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