Packages

class Stats extends AnyRef

A memory-efficient, concurrent-friendly metrics collection interface.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Stats
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new Stats(prefix: String = "", BlockSize: Int = 32)

    prefix

    A string that is prepended to all automatically generated metrics.

    BlockSize

    Metrics are stored in a linked list of arrays ahich are allocated on demand. The size of the arrays in each block is controlled by this parameter. It does not need to be changed for regular use, but can be tuned to a larger value, should you have many metrics.

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 addMetric(name: String): DoubleAdder

    Add a metric manually.

    Add a metric manually.

    This is a low-level escape hatch that should be used only when no other functions apply.

  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
  7. def counter(labels: (String, Any)*)(implicit name: Name): Counter

    Create and register a counter whose name is automatically derived from the val it is assigned to (plus a global prefix, if set).

    Create and register a counter whose name is automatically derived from the val it is assigned to (plus a global prefix, if set).

    E.g.

    val myFirstStatistic: stats.Counter = stats.counter("foo" -> "bar")

    will create a new counter whose metrics will be exposed as my_first_statistic{foo="bar"}

  8. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  9. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  10. def gauge(labels: (String, Any)*)(implicit name: Name): Gauge
  11. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  12. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  13. def histogram(labels: (String, Any)*)(implicit name: Name): Histogram
  14. def histogram(buckets: BucketDistribution, labels: (String, Any)*)(implicit name: Name): Histogram
  15. def info(properties: (String, Any)*): Unit

    A pseudo-metric used to expose application information in labels.

    A pseudo-metric used to expose application information in labels.

    E.g.

    info("version" -> "0.1.0", "commit" -> "deadbeef")

    will create the metric

    build_info{version="0.1.0", commit="deadbeef"} 1.0

    Note that the actual value will always be 1.

  16. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  17. def metrics: String

    Show metrics as they are right now.

    Show metrics as they are right now.

    See also writeMetricsTo() for a note on consistency.

  18. def namedCounter(name: String, labels: (String, Any)*): Counter

    Create and register counter with a given name and labels.

    Create and register counter with a given name and labels.

    The final metrics name will be composed of the passed name plus any labels, according to the prometheus syntax.

  19. def namedGauge(name: String, labels: (String, Any)*): Gauge
  20. def namedHistogram(name: String, labels: (String, Any)*): Histogram
  21. def namedHistogram(name: String, buckets: BucketDistribution, labels: (String, Any)*): Histogram
  22. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  23. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  24. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  25. val prefix: String
  26. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  27. def toString(): String
    Definition Classes
    AnyRef → Any
  28. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  29. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  30. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  31. def writeMetricsTo(out: OutputStream): Unit

    Write metrics as they are right now to the given output stream.

    Write metrics as they are right now to the given output stream.

    Concurrency note: this method does not block updating metrics while it is called. This can lead to inconsistent reads where, while printing metrics to the output stream, latter metrics are updated to a new value while an old value from a previous metric has already been printed. Nevertheless, these inconsistent reads offer increased performance and are acceptable for two reasons: 1) metrics may only ever be added; they can never be removed 2) atomic reads are not important for the purpose of metrics collection

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

Inherited from AnyRef

Inherited from Any

Ungrouped