package scala
- Alphabetic
- Public
- All
Type Members
- trait BaseBuilder extends AnyRef
-
final
class
ByName
[+T] extends () ⇒ T
Provides a wrapper for by-name expressions with the intent that they can become eligible for implicit conversions and implicit resolution.
Provides a wrapper for by-name expressions with the intent that they can become eligible for implicit conversions and implicit resolution.
- T
Result type of the evaluated
expression
-
trait
CheckedBuilder
extends BaseBuilder
The mixin trait for creating a class which creates health checks.
-
class
Counter
extends AnyRef
A Scala facade class for DropwizardCounter.
-
trait
DefaultInstrumented
extends InstrumentedBuilder with CheckedBuilder
A mixin trait for creating a class that publishes metrics and health checks to the "default" registries.
A mixin trait for creating a class that publishes metrics and health checks to the "default" registries.
This follows the Dropwizard 1.0.0+ application convention of storing the metric registry to SharedMetricRegistries under the name
"default". This was extended with storing the health check registry to SharedHealthCheckRegistries under the same name.After mixing in this trait, metrics and health checks can be defined. For example:
class Example(db: Database) extends DefaultInstrumented { // Define a health check: healthCheck("alive") { workerThreadIsActive() } // Define a timer metric: private[this] val loading = metrics.timer("loading") // Use the timer metric: def loadStuff(): Seq[Row] = loading.time { db.fetchRows() } }
See InstrumentedBuilder for instruction on overriding the metric base name or using hdrhistograms. See CheckedBuilder for instructions on overriding the timeout for scala.concurrent.Future executions.
- trait DeprecatedMetricBuilder extends AnyRef
-
class
Gauge
[T] extends AnyRef
A Scala facade class for DropwizardGauge.
-
class
HdrMetricBuilder
extends MetricBuilder
An alternative metric builder that creates Histograms and Timers with Reservoirs from the HdrHistogram library.
An alternative metric builder that creates Histograms and Timers with Reservoirs from the HdrHistogram library.
See the the manual for more instructions on using hdrhistogram.
-
sealed
trait
HealthCheckMagnet
extends AnyRef
Magnet for the checker.
Magnet for the checker. See http://spray.io/blog/2012-12-13-the-magnet-pattern/.
-
class
Histogram
extends AnyRef
A Scala facade class for DropwizardHistogram.
-
trait
InstrumentedBuilder
extends BaseBuilder
The mixin trait for creating a class which is instrumented with metrics.
The mixin trait for creating a class which is instrumented with metrics.
Use it as follows:
object Application { // The application wide metrics registry. val metricRegistry = new com.codahale.metrics.MetricRegistry() } trait Instrumented extends InstrumentedBuilder { val metricRegistry = Application.metricRegistry } class Example(db: Database) extends Instrumented { private[this] val loading = metrics.timer("loading") def loadStuff(): Seq[Row] = loading.time { db.fetchRows() } }
As an alternative to your own
Instrumentedas above, it is possible to use DefaultInstrumented instead.By default metric names are prefixed with the name of the current class. You can override this metric base name. For example:
class Example(db: Database) extends Instrumented { override lazy val metricBaseName = MetricName("Overridden.Base.Name") private[this] val loading = metrics.timer("loading") def loadStuff(): Seq[Row] = loading.time { db.fetchRows() } }
If you want to use hdrhistograms, you can override the metric builder as follows:
trait Instrumented extends InstrumentedBuilder { override lazy protected val metricBuilder = new HdrMetricBuilder(metricBaseName, metricRegistry, false) val metricRegistry = Application.metricRegistry }
See the the manual for more instructions on using hdrhistogram.
-
class
Meter
extends AnyRef
A Scala facade class for DropwizardMeter.
A Scala facade class for DropwizardMeter.
Example usage:
class Example(val db: Db) extends Instrumented { private[this] val rowsLoadedMeter = metrics.meter("rowsLoaded") def load(id: Long): Seq[Row] = { val rows = db.load(id) rowsLoaded.mark(rows.size) rows } }
-
class
MetricBuilder
extends DeprecatedMetricBuilder
Builds and registering metrics.
-
class
MetricName
extends AnyRef
The (base)name of a metric.
The (base)name of a metric.
Constructed via the companion object, e.g.
MetricName(getClass, "requests"). -
class
Timer
extends AnyRef
A Scala facade class for DropwizardTimer.
A Scala facade class for DropwizardTimer.
Features: * measure the execution duration of a block of code with time() * measure the time until a future is completed with timeFuture() * add an execution duration measurement as a side effect to a partial function with timePF() * direct access to the underlying timer with update(), timerContext(), count, max, etc.
Example usage:
class Example(val db: Db) extends Instrumented { private[this] val loadTimer = metrics.timer("load") def load(id: Long) = loadTimer.time { db.load(id) } }
-
trait
FutureMetrics
extends AnyRef
- Annotations
- @deprecated
- Deprecated
(Since version 3.5.4) Please use Timer.time() or Timer.timeFuture()
Value Members
- object ByName
- object Gauge
- object HealthCheckMagnet
-
object
Implicits
Implicit conversions of Scala functions to Metric interfaces.
Implicit conversions of Scala functions to Metric interfaces.
NOTE: no longer needed in Scala 2.12 and later.
- object MetricName