class Stats extends AnyRef
A memory-efficient, concurrent-friendly metrics collection interface.
- Alphabetic
- By Inheritance
- Stats
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- 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
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- 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.
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- 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"}
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def gauge(labels: (String, Any)*)(implicit name: Name): Gauge
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def histogram(labels: (String, Any)*)(implicit name: Name): Histogram
- def histogram(buckets: BucketDistribution, labels: (String, Any)*)(implicit name: Name): Histogram
- 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.
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- 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.
- 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.
- def namedGauge(name: String, labels: (String, Any)*): Gauge
- def namedHistogram(name: String, labels: (String, Any)*): Histogram
- def namedHistogram(name: String, buckets: BucketDistribution, labels: (String, Any)*): Histogram
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- val prefix: String
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- 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
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated