Package io.prometheus.client
Class Info
- All Implemented Interfaces:
Collector.Describable
Info metric, key-value pairs.
Examples of Info include build information, version information, and potential target metadata.
The string "_info" will be appended to the sample name.
Example Info:
class YourClass {
static final Info buildInfo = Info.build()
.name("your_build").help("Build information.")
.register();
void func() {
// Your code here.
buildInfo.info("branch", "HEAD", "version", "1.2.3", "revision", "e0704b");
}
}
- Since:
- 0.10.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static class
The value of a single Info.Nested classes/interfaces inherited from class io.prometheus.client.Collector
Collector.Describable, Collector.MetricFamilySamples, Collector.Type
-
Field Summary
Fields inherited from class io.prometheus.client.SimpleCollector
children, fullname, help, labelNames, noLabelsChild, unit
Fields inherited from class io.prometheus.client.Collector
MILLISECONDS_PER_SECOND, NANOSECONDS_PER_SECOND
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Info.Builder
build()
Return a Builder to allow configuration of a new Info.static Info.Builder
Return a Builder to allow configuration of a new Info.collect()
Return all metrics of this Collector.describe()
Provide a list of metric families this Collector is expected to return.get()
Get the the info.void
Set the info on the info with no labels.void
Set the info on the info with no labels.protected Info.Child
newChild()
Return a new child, workaround for Java generics limitations.Methods inherited from class io.prometheus.client.SimpleCollector
clear, familySamplesList, initializeNoLabelsChild, labels, remove, setChild
Methods inherited from class io.prometheus.client.Collector
checkMetricLabelName, checkMetricName, collect, doubleToGoString, register, register, sanitizeMetricName
-
Constructor Details
-
Info
Info(Info.Builder b)
-
-
Method Details
-
build
Return a Builder to allow configuration of a new Info. Ensures required fields are provided.- Parameters:
name
- The name of the metrichelp
- The help string of the metric
-
build
Return a Builder to allow configuration of a new Info. -
newChild
Description copied from class:SimpleCollector
Return a new child, workaround for Java generics limitations.- Specified by:
newChild
in classSimpleCollector<Info.Child>
-
info
Set the info on the info with no labels. -
info
Set the info on the info with no labels.- Parameters:
v
- labels as pairs of key values
-
get
Get the the info. -
collect
Description copied from class:Collector
Return all metrics of this Collector. -
describe
Description copied from interface:Collector.Describable
Provide a list of metric families this Collector is expected to return. These should exclude the samples. This is used by the registry to detect collisions and duplicate registrations. Usually custom collectors do not have to implement Describable. If Describable is not implemented and the CollectorRegistry was created with auto describe enabled (which is the case for the default registry) thenCollector.collect()
will be called at registration time instead of describe. If this could cause problems, either implement a proper describe, or if that's not practical have describe return an empty list.- Specified by:
describe
in interfaceCollector.Describable
-