com.netaporter.salad.metrics.spray.metrics

MetricsDirectiveFactory

trait MetricsDirectiveFactory extends AnyRef

Provides an entry point to creating metric accumulators specific to the Coda Hale Metrics library (http://metrics.codahale.com).

Overview

This trait is intended to be used to construct objects that provide spray.routing.Directives, which can then be used to instrument your spray.routing.Routes with metrics accumulators. You would create these instances, and then join them together however you like in order to ease how your code is instrumented.

Usage

import com.codahale.metrics.MetricRegistry

class MyApp extends Directives {
  val metricRegistry = new MetricRegistry()
  val metricFactory = CodaHaleMetricsDirectiveFactory(metricRegistry)

  // Creates a counter that measures failures only under the name of the
  // path to the current route
  val counter = metricFactory.counter.failures.noSuccesses.count

  // Creates a timer that measures everything under the name of the
  // path to the current route
  val timer = metricFactory.timer.time

  // Joins the two metrics into a single directive
  val measure = counter | timer

  val apiRoute =
    path("something") {
      measure {
        get {
          // do the thing
        }
      }
    }
}
Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. MetricsDirectiveFactory
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract val defaultMetricsActorFactory: MetricsActorFactory

  2. abstract val metricsEventActor: ActorRef

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  4. def allCounter(counterPrefix: String): CounterMetric

    Creates an instance of a CounterMetric with a specific prefix name that counts all types of events.

    Creates an instance of a CounterMetric with a specific prefix name that counts all types of events.

    counterPrefix

    The prefix of the counter's identifier.

    returns

    The instance of the CounterMetric you can use to count events.

  5. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  6. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. def counter: CounterMetricByUri

    Creates an instance of a CounterMetric that counts successes by default under an identifier unique to the path to the current route..

    Creates an instance of a CounterMetric that counts successes by default under an identifier unique to the path to the current route..

    returns

    The instance of the CounterMetric you can use to count events.

  8. def counter(counterPrefix: String): CounterMetric

    Creates an instance of a CounterMetric with a specific prefix name that counts successes by default.

    Creates an instance of a CounterMetric with a specific prefix name that counts successes by default.

    counterPrefix

    The prefix of the counter's identifier.

    returns

    The instance of the CounterMetric you can use to count events.

  9. def counterWithMethod(counterPrefix: String): CounterMetric

  10. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  11. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  12. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  13. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  14. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  15. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  16. def meter: MeterMetricByUri

    Creates an instance of a MeterMetric that measures events with a name specific to the path to the current route.

    Creates an instance of a MeterMetric that measures events with a name specific to the path to the current route.

    returns

    The instance of the MeterMetric you can use to measure events.

  17. def meter(meterName: String): MeterMetric

    Creates an instance of a MeterMetric that measures events with a specific name.

    Creates an instance of a MeterMetric that measures events with a specific name.

    meterName

    The name of the meter in which measured events should be recorded.

    returns

    The instance of the MeterMetric you can use to measure events.

  18. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  19. final def notify(): Unit

    Definition Classes
    AnyRef
  20. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  21. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  22. def timer: TimerMetricByUri

    Creates an instance of a TimerMetric that measures events with a name specific to the path to the current route.

    Creates an instance of a TimerMetric that measures events with a name specific to the path to the current route.

    returns

    The instance of the TimerMetric you can use to measure events.

  23. def timer(timerName: String): TimerMetric

    Creates an instance of a TimerMetric that measures events with a specific name.

    Creates an instance of a TimerMetric that measures events with a specific name.

    timerName

    The name of the timer in which measured events should be recorded.

    returns

    The instance of the TimerMetric you can use to measure events.

  24. def toString(): String

    Definition Classes
    AnyRef → Any
  25. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  26. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  27. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped