public class Info extends SimpleCollector<Info.Child> implements Collector.Describable
Example enumeration:
class YourClass {
static final Info buildInfo = Info.build()
.name("your_build_info").help("Build information.")
.register();
void func() {
// Your code here.
buildInfo.info("branch", "HEAD", "version", "1.2.3", "revision", "e0704b");
}
}
| Modifier and Type | Class and Description |
|---|---|
static class |
Info.Builder |
static class |
Info.Child
The value of a single Info.
|
Collector.Describable, Collector.MetricFamilySamples, Collector.Typechildren, fullname, help, labelNames, noLabelsChild, unitMILLISECONDS_PER_SECOND, NANOSECONDS_PER_SECOND| Modifier and Type | Method and Description |
|---|---|
static Info.Builder |
build()
Return a Builder to allow configuration of a new Info.
|
static Info.Builder |
build(String name,
String help)
Return a Builder to allow configuration of a new Info.
|
List<Collector.MetricFamilySamples> |
collect()
Return all of the metrics of this Collector.
|
List<Collector.MetricFamilySamples> |
describe()
Provide a list of metric families this Collector is expected to return.
|
Map<String,String> |
get()
Get the the info.
|
void |
info(Map<String,String> v)
Set the info on the info with no labels.
|
void |
info(String... v)
Set the info on the info with no labels.
|
protected Info.Child |
newChild()
Return a new child, workaround for Java generics limitations.
|
clear, familySamplesList, initializeNoLabelsChild, labels, remove, setChildcheckMetricLabelName, checkMetricName, doubleToGoString, register, register, sanitizeMetricNamepublic static Info.Builder build(String name, String help)
name - The name of the metrichelp - The help string of the metricpublic static Info.Builder build()
protected Info.Child newChild()
SimpleCollectornewChild in class SimpleCollector<Info.Child>public void info(Map<String,String> v)
v - labels as pairs of key valuespublic List<Collector.MetricFamilySamples> collect()
Collectorpublic List<Collector.MetricFamilySamples> describe()
Collector.Describablecollect 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.describe in interface Collector.DescribableCopyright © 2021. All rights reserved.