com.netaporter.salad.metrics.spray

metrics

package metrics

Visibility
  1. Public
  2. All

Type Members

  1. sealed trait BaseMeterMetric extends AnyRef

  2. sealed trait CounterBase extends AnyRef

    The CounterBase trait provides helpers for derivations that implement specific types of Counter metrics.

  3. case class CounterMetric(prefix: String, metricsEventActor: ActorRef, includeMethod: Boolean = false, handleFailures: CountIncrementer = CounterMetric.nilIncrementer, handleRejections: CountIncrementer = CounterMetric.nilIncrementer, handleExceptions: CountIncrementer = CounterMetric.nilIncrementer, handleSuccesses: CountIncrementer = CounterMetric.incSuccesses) extends CounterBase with Product with Serializable

    Provides a builder that can provide a new spray.routing.Directive, which

    Provides a builder that can provide a new spray.routing.Directive, which

    will count successful, failed, rejected or excepted operations in a given spray.routing.Route

    The actual identifiers for this counter will be, given a specific prefix:

    - {prefix}.successes - {prefix}.failures - {prefix}.rejections - {prefix}.exceptions

    prefix

    The user-specific designation for this counter's Id.

    metricsEventActor

    The instance of the actor that is recieveing the IncCounter message requests

    handleFailures

    A function that will increment {prefix}.failures. Defaults to com.netaporter.salad.metrics.spray.metrics.CounterMetric.CountIncrementer#nilIncrementer.

    handleRejections

    A function that will increment {prefix}.rejections. Defaults to com.netaporter.salad.metrics.spray.metrics.CounterMetric.CountIncrementer#nilIncrementer.

    handleExceptions

    A function that will increment {prefix}.exceptions. Defaults to com.netaporter.salad.metrics.spray.metrics.CounterMetric.CountIncrementer#nilIncrementer.

    handleSuccesses

    A function that will increment {prefix}.successes. Defaults to com.netaporter.salad.metrics.spray.metrics.CounterMetric.CountIncrementer#incSuccesses.

  4. case class CounterMetricByUri(metricsEventActor: ActorRef, handleFailures: CountIncrementer = CounterMetric.nilIncrementer, handleRejections: CountIncrementer = CounterMetric.nilIncrementer, handleExceptions: CountIncrementer = CounterMetric.nilIncrementer, handleSuccesses: CountIncrementer = CounterMetric.incSuccesses) extends CounterBase with Product with Serializable

    Provides a builder that can provide a new spray.routing.Directive, which will count successful, failed, rejected or excepted operations in a given spray.routing.Route.

    Provides a builder that can provide a new spray.routing.Directive, which will count successful, failed, rejected or excepted operations in a given spray.routing.Route.

    The actual identifiers for this counter will be, depending on the incoming URL (e.g. /path/to/route translates to path.to.route):

    - {path.to.route}.successes - {path.to.route}.failures - {path.to.route}.rejections - {path.to.route}.exceptions

    metricsEventActor

    The instance of the MetricRegistry that holds the counter metric.

    handleFailures

    A function that will increment {prefix}.failures. Defaults to com.netaporter.salad.metrics.spray.metrics.CounterMetric.CountIncrementer#nilIncrementer.

    handleRejections

    A function that will increment {prefix}.rejections. Defaults to com.netaporter.salad.metrics.spray.metrics.CounterMetric.CountIncrementer#nilIncrementer.

    handleExceptions

    A function that will increment {prefix}.exceptions. Defaults to com.netaporter.salad.metrics.spray.metrics.CounterMetric.CountIncrementer#nilIncrementer.

    handleSuccesses

    A function that will increment {prefix}.successes. Defaults to com.netaporter.salad.metrics.spray.metrics.CounterMetric.CountIncrementer#incSuccesses.

  5. case class MeterMetric(meterName: String, metricsEventActor: ActorRef) extends Product with Serializable

    Provides a Meter metric that will mark a specific event under a Meter of a specific name.

    Provides a Meter metric that will mark a specific event under a Meter of a specific name.

    meterName

    The name under which the meter exists.

    metricsEventActor

    The instance of the Actor to which a Meter event should be sent

  6. case class MeterMetricByUri(metricsEventActor: ActorRef) extends BaseMeterMetric with Product with Serializable

  7. case class MeterMetricOut(meterName: String, metricsEventActor: ActorRef) extends BaseMeterMetric with Product with Serializable

    Provides a Meter metric that will mark a specific event under a Meter of a specific name, when the request has completed and is being sent to the user

    Provides a Meter metric that will mark a specific event under a Meter of a specific name, when the request has completed and is being sent to the user

    meterName

    The name under which the meter exists.

    metricsEventActor

    The instance of the Actor to which a Meter event should be sent

  8. trait MetricsDirectiveFactory extends AnyRef

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

    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
            }
          }
        }
    }
  9. sealed trait TimerBase extends AnyRef

    The TimerBase trait provides helpers for derivations that implement specific types of Timer metrics.

  10. case class TimerMetric(timerName: String, metricsEventActor: ActorRef) extends TimerBase with Product with Serializable

    Provides a Timer metric that will record times on the timer under the name given.

    Provides a Timer metric that will record times on the timer under the name given.

    timerName

    The name for this particular timer.

    metricsEventActor

    The instance of an ActorRef to whcih we send the elapsed time of a event (nanos)

  11. case class TimerMetricByUri(metricsEventActor: ActorRef) extends TimerBase with Product with Serializable

    Provides a Timer metric that will record times on the timer under the name given.

    Provides a Timer metric that will record times on the timer under the name given.

    metricsEventActor

    The instance of an ActorRef to whcih we send the elapsed time of a event (nanos)

Value Members

  1. object CounterMetric extends Serializable

    The CounterMetric object holds helpers for code that implements Counters.

  2. object MetricHelpers

    Provides helper methods for metrics.

  3. object MetricsDirectiveFactory

    Provides construction for an instance of the CodaHaleMetricsDirectiveFactory.

Ungrouped