Class SimpleCollector.Builder<B extends SimpleCollector.Builder<B,C>,C extends SimpleCollector>

java.lang.Object
io.prometheus.client.SimpleCollector.Builder<B,C>
Direct Known Subclasses:
Counter.Builder, Gauge.Builder, Histogram.Builder, Summary.Builder
Enclosing class:
SimpleCollector<Child>

public abstract static class SimpleCollector.Builder<B extends SimpleCollector.Builder<B,C>,C extends SimpleCollector> extends Object
Builders let you configure and then create collectors.
  • Field Details

    • namespace

      String namespace
    • subsystem

      String subsystem
    • name

      String name
    • fullname

      String fullname
    • help

      String help
    • labelNames

      String[] labelNames
    • dontInitializeNoLabelsChild

      boolean dontInitializeNoLabelsChild
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • name

      public B name(String name)
      Set the name of the metric. Required.
    • subsystem

      public B subsystem(String subsystem)
      Set the subsystem of the metric. Optional.
    • namespace

      public B namespace(String namespace)
      Set the namespace of the metric. Optional.
    • help

      public B help(String help)
      Set the help string of the metric. Required.
    • labelNames

      public B labelNames(String... labelNames)
      Set the labelNames of the metric. Optional, defaults to no labels.
    • create

      public abstract C create()
      Return the constructed collector.

      Abstract due to generics limitations.

    • register

      public C register()
      Create and register the Collector with the default registry.
    • register

      public C register(CollectorRegistry registry)
      Create and register the Collector with the given registry.