Class PrometheusPushGatewayManager
java.lang.Object
org.springframework.boot.actuate.metrics.export.prometheus.PrometheusPushGatewayManager
Class that can be used to manage the pushing of metrics to a
Prometheus PushGateway
. Handles the scheduling of push operations, error handling and
shutdown operations.- Since:
- 2.1.0
- Author:
- David J. M. Karlsen, Phillip Webb
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
The operation that should be performed on shutdown. -
Constructor Summary
ConstructorDescriptionPrometheusPushGatewayManager
(io.prometheus.client.exporter.PushGateway pushGateway, io.prometheus.client.CollectorRegistry registry, Duration pushRate, String job, Map<String, String> groupingKeys, PrometheusPushGatewayManager.ShutdownOperation shutdownOperation) Create a newPrometheusPushGatewayManager
instance using a single threadedTaskScheduler
.PrometheusPushGatewayManager
(io.prometheus.client.exporter.PushGateway pushGateway, io.prometheus.client.CollectorRegistry registry, TaskScheduler scheduler, Duration pushRate, String job, Map<String, String> groupingKey, PrometheusPushGatewayManager.ShutdownOperation shutdownOperation) Create a newPrometheusPushGatewayManager
instance. -
Method Summary
Modifier and TypeMethodDescriptionvoid
shutdown()
Shutdown the manager, running anyPrometheusPushGatewayManager.ShutdownOperation
.
-
Constructor Details
-
PrometheusPushGatewayManager
public PrometheusPushGatewayManager(io.prometheus.client.exporter.PushGateway pushGateway, io.prometheus.client.CollectorRegistry registry, Duration pushRate, String job, Map<String, String> groupingKeys, PrometheusPushGatewayManager.ShutdownOperation shutdownOperation) Create a newPrometheusPushGatewayManager
instance using a single threadedTaskScheduler
.- Parameters:
pushGateway
- the source push gatewayregistry
- the collector registry to pushpushRate
- the rate at which push operations occurjob
- the job ID for the operationgroupingKeys
- an optional set of grouping keys for the operationshutdownOperation
- the shutdown operation that should be performed when context is closed.
-
PrometheusPushGatewayManager
public PrometheusPushGatewayManager(io.prometheus.client.exporter.PushGateway pushGateway, io.prometheus.client.CollectorRegistry registry, TaskScheduler scheduler, Duration pushRate, String job, Map<String, String> groupingKey, PrometheusPushGatewayManager.ShutdownOperation shutdownOperation) Create a newPrometheusPushGatewayManager
instance.- Parameters:
pushGateway
- the source push gatewayregistry
- the collector registry to pushscheduler
- the scheduler used for operationspushRate
- the rate at which push operations occurjob
- the job ID for the operationgroupingKey
- an optional set of grouping keys for the operationshutdownOperation
- the shutdown operation that should be performed when context is closed.
-
-
Method Details
-
shutdown
public void shutdown()Shutdown the manager, running anyPrometheusPushGatewayManager.ShutdownOperation
.
-