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

  1. Implement this interface, providing a unique getName() and a create(Properties) method that builds your MeterRegistry.
  2. Create a file META-INF/services/com.gigaspaces.metrics.micrometer.GsMeterRegistryProvider inside your JAR containing the fully-qualified class name of your implementation.
  3. Drop the JAR into $GS_HOME/lib/optional/metrics.
  4. 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 Type
    Method
    Description
    io.micrometer.core.instrument.MeterRegistry
    Creates and returns a configured MeterRegistry instance.
    Returns the name used to identify this registry in metrics.registries.
  • Method Details

    • getName

      String getName()
      Returns the name used to identify this registry in metrics.registries. Must be unique and lowercase (matching is case-insensitive).

      Example: "datadog", "graphite", "kafka"

    • create

      io.micrometer.core.instrument.MeterRegistry create(Properties config)
      Creates and returns a configured MeterRegistry instance.

      The config parameter contains all system properties at startup time, which includes everything loaded from metrics.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