use of io.micronaut.configuration.metrics.micrometer.ExportConfigurationProperties in project micronaut-micrometer by micronaut-projects.
the class CloudWatchMeterRegistryFactory method cloudWatchMeterRegistry.
/**
* Create a CloudWatchMeterRegistry bean if global metrics are enables
* and the cloudwatch is enabled. Will be true by default when this
* configuration is included in project.
*
* @param exportConfigurationProperties The export configuration
* @param cloudWatchAsyncClient The cloud watch async client
* @return A CloudWatchMeterRegistry
*/
@Singleton
CloudWatchMeterRegistry cloudWatchMeterRegistry(ExportConfigurationProperties exportConfigurationProperties, CloudWatchAsyncClient cloudWatchAsyncClient) {
Properties exportConfig = exportConfigurationProperties.getExport();
String cloudwatchNamespace = "cloudwatch.namespace";
if (!exportConfig.containsKey(cloudwatchNamespace)) {
exportConfig.setProperty(cloudwatchNamespace, CLOUDWATCH_DEFAULT_NAMESPACE);
}
return new CloudWatchMeterRegistry(exportConfig::getProperty, Clock.SYSTEM, cloudWatchAsyncClient);
}
Aggregations