Interface GsMeterRegistryProvider
public interface GsMeterRegistryProvider
Plugin interface for registering custom Micrometer backends (registries).
Allows clients to plug in any Micrometer-supported registry (Datadog, Graphite, etc.) without modifying GigaSpaces source code.
How to use
- Implement this interface, providing a unique
getName()and acreate(Properties)method that builds yourMeterRegistry. - Create a file
META-INF/services/com.gigaspaces.metrics.micrometer.GsMeterRegistryProviderinside your JAR containing the fully-qualified class name of your implementation. - Drop the JAR into
$GS_HOME/lib/optional/metrics. - Set
metrics.registries=<your-name>in$GS_HOME/config/metrics/metrics.properties.
Example implementation
public class DatadogRegistryProvider implements GsMeterRegistryProvider {
@Override
public String getName() {
return "datadog";
}
@Override
public MeterRegistry create(Properties config) {
DatadogConfig datadogConfig = key -> config.getProperty("metrics.datadog." + key);
return new DatadogMeterRegistry(datadogConfig, Clock.SYSTEM);
}
}
With the JAR in place, activating is just:
metrics.registries=datadog metrics.datadog.apiKey=abc123 metrics.datadog.applicationKey=xyz456
- Since:
- 17.1.4
-
Method Summary
Modifier and TypeMethodDescriptionio.micrometer.core.instrument.MeterRegistrycreate(Properties config) Creates and returns a configuredMeterRegistryinstance.getName()Returns the name used to identify this registry inmetrics.registries.
-
Method Details
-
getName
String getName()Returns the name used to identify this registry inmetrics.registries. Must be unique and lowercase (matching is case-insensitive).Example:
"datadog","graphite","kafka" -
create
Creates and returns a configuredMeterRegistryinstance.The
configparameter contains all system properties at startup time, which includes everything loaded frommetrics.properties. Use it to read your registry-specific settings:String apiKey = config.getProperty("metrics.datadog.apiKey");- Parameters:
config- system properties merged with metrics.properties content- Returns:
- a fully configured
MeterRegistry
-