Open vladak opened 4 years ago
That should probably be similar to what SpringBoot does (https://micrometer.io/docs/ref/spring/1.5):
Spring Boot auto-configures a composite meter registry and adds a registry to the composite for each of the supported implementations that it finds on the classpath. Having a dependency on micrometer-registry-{system} in your runtime classpath is enough for Spring Boot to configure the registry.
The configuration is then stored as a properties, e.g. for StatsD:
management.metrics.export.statsd.enabled=true # default is true
management.metrics.export.statsd.flavor=etsy # or datadog, telegraf
management.metrics.export.statsd.host=localhost
management.metrics.export.statsd.port=8125
that would obviate the need of those BaseStatsdConfig
/BaseGraphiteConfig
classes.
So even with similar functionality we would still need to change Maven configuration to include the registry (or ship those most used).
The MeterRegistryConfig
interface has
String prefix();
@Nullable
String get(String var1);
and e.g. StatsdConfig
is interface that extends MeterRegistryConfig
with bunch of default method implementations, e.g.:
default String host() {
return (String)PropertyValidator.getString(this, "host").orElse("localhost");
}
The getString()
then eventually calls config.get()
with prefix
ed name of the property.
As noted in #3284 Micrometer supports many meter registries. Ideally no source code changes should be needed to make each available.