Package io.prometheus.client
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 java.lang.Object
Builders let you configure and then create collectors.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) boolean
dontInitializeNoLabelsChild
(package private) java.lang.String
fullname
(package private) java.lang.String
help
(package private) java.lang.String[]
labelNames
(package private) java.lang.String
name
(package private) java.lang.String
namespace
(package private) java.lang.String
subsystem
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract C
create()
Return the constructed collector.B
help(java.lang.String help)
Set the help string of the metric.B
labelNames(java.lang.String... labelNames)
Set the labelNames of the metric.B
name(java.lang.String name)
Set the name of the metric.B
namespace(java.lang.String namespace)
Set the namespace of the metric.C
register()
Create and register the Collector with the default registry.C
register(CollectorRegistry registry)
Create and register the Collector with the given registry.B
subsystem(java.lang.String subsystem)
Set the subsystem of the metric.
-
-
-
Method Detail
-
name
public B name(java.lang.String name)
Set the name of the metric. Required.
-
subsystem
public B subsystem(java.lang.String subsystem)
Set the subsystem of the metric. Optional.
-
namespace
public B namespace(java.lang.String namespace)
Set the namespace of the metric. Optional.
-
help
public B help(java.lang.String help)
Set the help string of the metric. Required.
-
labelNames
public B labelNames(java.lang.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.
-
-