module SSO::Meter

Public Instance Methods

caller_name() click to toggle source
# File lib/sso/meter.rb, line 23
def caller_name
  self.class.name
end
metric() click to toggle source
# File lib/sso/meter.rb, line 27
def metric
  ::SSO.config.metric
end
timing(key:, value:, tags: nil, data: {}) click to toggle source
# File lib/sso/meter.rb, line 14
def timing(key:, value:, tags: nil, data: {})
  data[:caller] = caller_name
  debug { "Measuring timing #{key.inspect} with value #{value.inspect} and tags #{tags.inspect} and data #{data.inspect}" }
  metric.call type: :timing, key: "sso.#{key}", value: value, tags: tags, data: data

rescue => exception
  ::SSO.config.exception_handler.call exception
end
track(key:, value: 1, tags: nil, data: {}) click to toggle source
# File lib/sso/meter.rb, line 5
def track(key:, value: 1, tags: nil, data: {})
  data[:caller] = caller_name
  debug { "Measuring increment #{key.inspect} with value #{value.inspect} and tags #{tags.inspect} and data #{data.inspect}" }
  metric.call type: :increment, key: "sso.#{key}", value: value, tags: tags, data: data

rescue => exception
  ::SSO.config.exception_handler.call exception
end