@Experimental(value="Micrometer metrics is a new addition to Geode and the API may change") public interface MetricsPublishingService
MetricsSession
.
Geode discovers MetricsPublishingService
s during system creation, using the standard Java
ServiceLoader
mechanism:
package com.application; public class MyMetricsPublishingService implements MetricsPublishingService { private volatile MeterRegistry registry; private volatile MetricsSession session; @Override public void start(MetricsSession session) { this.session = session; registry = ... // configure your meter registry and start publishing // add your registry as a sub-registry to the session session.addSubregistry(registry); } @Override public void stop() { ... // clean up any resources used by your meter registry ... session.removeSubregistry(registry); } }
To make your service available for loading, add the following provider-configuration file in the resource directory of your application Jar:
META-INF/services/org.apache.geode.metrics.MetricsPublishingService
Add a line inside the file indicating the fully qualified class name of your implementation:
com.application.MyMetricsPublishingService
Experimental: Micrometer metrics is a new addition to Geode and the API may change.
Modifier and Type | Method and Description |
---|---|
void |
start(MetricsSession session)
Invoked when a metrics session starts.
|
void |
stop(MetricsSession session)
Invoked when a metrics session stops.
|
void start(MetricsSession session)
MetricsSession.addSubregistry(MeterRegistry)
to add that registry to the session.session
- the metrics session whose metrics this publishing service will publishvoid stop(MetricsSession session)
MetricsSession.removeSubregistry(MeterRegistry)
to remove each meter registry it added
to the session. The implementation should also clean up any other resources it allocated duringsession
- the metrics session whose metrics this publishing service was publishing
start(MetricsSession)
.