class Yabeda::Datadog::Unit

The logic of working with Datadog units

Constants

AVAILABLE

Datadog whitelist of units source: docs.datadoghq.com/developers/metrics/#units

IRREGULAR_PLURALS

Public Class Methods

find(unit) click to toggle source

Find an available unit of metric

# File lib/yabeda/datadog/units.rb, line 39
def self.find(unit)
  unit_key = unit.to_s.downcase
  AVAILABLE[unit_key] ||
    AVAILABLE[unit_key.gsub(/s\z/, "")] ||
    AVAILABLE[unit_key.gsub(/es\z/, "")] ||
    IRREGULAR_PLURALS[unit_key]
end