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

org.lyranthe.prometheus.client.gauge.Gauge0.scala Maven / Gradle / Ivy

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

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

/** This represents a Prometheus internal.gauge with no labels.
  *
  * A Prometheus internal.gauge should be used for values which go up and down.
  *
  * @param name The name of the internal.gauge
  */
final case class Gauge0 private[client] (name: MetricName,
                                         help: String,
                                         initialValue: Option[Double] = None)
    extends LabelledGauge(name, List.empty, new SynchronizedDoubleAdder)
    with MetricFamily {
  override val metricType = MetricType.Gauge

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy