Package org.apache.geode.metrics
Interface MetricsPublishingService
@Experimental("Micrometer metrics is a new addition to Geode and the API may change")
public interface MetricsPublishingService
Publishes metrics managed by a
MetricsSession.
Geode discovers MetricsPublishingServices 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.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidstart(MetricsSession session) Invoked when a metrics session starts.voidstop(MetricsSession session) Invoked when a metrics session stops.
-
Method Details
-
start
Invoked when a metrics session starts. A typical implementation will create a meter registry that can publish to an external monitoring system, and callMetricsSession.addSubregistry(MeterRegistry)to add that registry to the session.- Parameters:
session- the metrics session whose metrics this publishing service will publish
-
stop
Invoked when a metrics session stops. The implementation should callMetricsSession.removeSubregistry(MeterRegistry)to remove each meter registry it added to the session. The implementation should also clean up any other resources it allocated during- Parameters:
session- the metrics session whose metrics this publishing service was publishingstart(MetricsSession).
-