Interface MultiCollector
- All Known Implementing Classes:
CacheMetricsCollector
,CacheMetricsCollector
,DropwizardExports
,SimpleclientCollector
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Like
Collector
, but collecting multiple Snapshots at once.-
Method Summary
Modifier and TypeMethodDescriptioncollect()
Called when the Prometheus server scrapes metrics.default MetricSnapshots
collect
(PrometheusScrapeRequest scrapeRequest) Provides Collector with the details of the request issued by Prometheus to allow multi-target pattern implementation Override to implement request dependent logic to provide MetricSnapshotdefault MetricSnapshots
default MetricSnapshots
collect
(Predicate<String> includedNames, PrometheusScrapeRequest scrapeRequest) Likecollect(Predicate)
, but with support for multi-target pattern.This is called in two places: During registration to check if a metric with that name already exists.
-
Method Details
-
collect
Called when the Prometheus server scrapes metrics. -
collect
Provides Collector with the details of the request issued by Prometheus to allow multi-target pattern implementation Override to implement request dependent logic to provide MetricSnapshot -
collect
Likecollect()
, but returns only the snapshots whereincludedNames.test(name)
istrue
.Override this if there is a more efficient way than first collecting all snapshot and then discarding the excluded ones.
-
collect
default MetricSnapshots collect(Predicate<String> includedNames, PrometheusScrapeRequest scrapeRequest) Likecollect(Predicate)
, but with support for multi-target pattern.Override this if there is a more efficient way than first collecting the snapshot and then discarding it.
-
getPrometheusNames
This is called in two places:- During registration to check if a metric with that name already exists.
- During scrape to check if the collector can be skipped because a name filter is present and all names are excluded.
If your collector returns a constant list of metrics that have names that do not change at runtime it is a good idea to overwrite this and return the names.
-