All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.lyranthe.prometheus.client.counter.Counter0.scala Maven / Gradle / Ivy

There is a newer version: 0.9.0-M5
Show newest version
package org.lyranthe.prometheus.client.counter

import org.lyranthe.prometheus.client._
import org.lyranthe.prometheus.client.internal._
import org.lyranthe.prometheus.client.registry._

/** This represents a Prometheus counter metric with 0 labels.
  *
  * A counter contains a value that can only be incremented.
  *
  * @param name The name of the counter.
  * @param help The help text for the counter.
  */
final case class Counter0 private[client] (name: MetricName, help: String)
    extends LabelledCounter(name, List.empty, new UnsynchronizedDoubleAdder)
    with MetricFamily {
  override val metricType = MetricType.Counter

  override final val escapedHelp = help.replace("\\", "\\\\").replace("\n", "\\n")

  override def collect(): List[Metric] =
    CounterMetric(List.empty, adder.sum) :: Nil
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy