Sha256: f60f87ba3cb1badefa506e693e3f2266bb0b9d654ee5a646630a091b2323bf7c

Contents?: true

Size: 609 Bytes

Versions: 1

Compression:

Stored size: 609 Bytes

Contents

module Vitals
  module Utils
    BAD_METRICS_CHARS = Regexp.compile('[\/\-:\s]').freeze
    SEPARATOR = '.'.freeze
    def self.normalize_metric(m)
      m.gsub(BAD_METRICS_CHARS, '_')
    end
    def self.hostname
      `hostname -s`.chomp
    end
    def self.sec_to_ms(sec)
      (1000.0 * sec).round
    end
    # XXX grape specific, move this away some day?
    def self.grape_path(route)
      version = route.route_version
      path = route.route_path.dup[1..-1]
      path.sub!(/\(\..*\)$/, '')
      path.sub!(":version", version) if version
      path.gsub!(/\//, ".")
      path
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vitals-0.4.0 lib/vitals/utils.rb