Module: Simple::Metrics

Includes:
Timer
Included in:
Healthchecks, Meter
Defined in:
lib/simple/metrics.rb,
lib/simple/version.rb,
lib/simple/metrics/meter.rb,
lib/simple/metrics/timer.rb,
lib/simple/metrics/health.rb,
lib/simple/metrics/graphite.rb,
lib/simple/metrics/healthcheck.rb,
lib/simple/metrics/rack_metrics.rb

Defined Under Namespace

Modules: Graphite, Healthchecks, Meter, Timer Classes: Check, HEALTHY, Health, RackMetrics, UNHEALTHY, WARNING

Constant Summary collapse

DEFAULT_DURATION_UNIT =
TimeUnit::MILLISECONDS
DEFAULT_RATE_UNIT =
TimeUnit::SECONDS
DEFAULT_TIMING_UNIT =
TimeUnit::NANOSECONDS
VERSION =
'0.0.13'

Instance Method Summary collapse

Methods included from Timer

#timer

Instance Method Details

#metrics_registryJava::ComYammerMetrics::Metrics

The default metrics registry

Returns:

  • (Java::ComYammerMetrics::Metrics)

    the default metrics registry



37
38
39
# File 'lib/simple/metrics.rb', line 37

def metrics_registry
  Java::ComYammerMetrics::Metrics.defaultRegistry
end

#new_metric_name(klass_name, name, type) ⇒ MetricName

Create a new metric name

Parameters:

  • klass_name (String)

    The name of the class, usually the application name

  • name (String)

    The name of the metric

  • type (String)

    The type of metric

Returns:

  • (MetricName)

    the newly created metric name



47
48
49
# File 'lib/simple/metrics.rb', line 47

def new_metric_name(klass_name, name, type)
  MetricName.new(klass_name.downcase, type, name.to_s)
end

#sanitize_classname(klass_name) ⇒ String

Sanitize classnames for graphite

Parameters:

  • klass_name (Object)

    The request object

Returns:

  • (String)

    The class name without colons



30
31
32
# File 'lib/simple/metrics.rb', line 30

def sanitize_classname(klass_name)
  klass_name.gsub(":","")
end