55
66package io .opentelemetry .contrib .jmxscraper .config ;
77
8+ import static io .opentelemetry .contrib .jmxscraper .config .JmxScraperConfig .JMX_INTERVAL_LEGACY ;
9+ import static io .opentelemetry .contrib .jmxscraper .config .JmxScraperConfig .METRIC_EXPORT_INTERVAL ;
10+
811import io .opentelemetry .sdk .autoconfigure .spi .ConfigProperties ;
912import java .util .HashMap ;
1013import java .util .Map ;
1114import java .util .function .Function ;
15+ import java .util .logging .Logger ;
1216import javax .annotation .Nullable ;
1317
14- import static io .opentelemetry .contrib .jmxscraper .config .JmxScraperConfig .JMX_INTERVAL_LEGACY ;
15- import static io .opentelemetry .contrib .jmxscraper .config .JmxScraperConfig .METRIC_EXPORT_INTERVAL ;
16-
1718/** Customizer of default SDK configuration and provider of effective scraper config */
1819public class PropertiesCustomizer implements Function <ConfigProperties , Map <String , String >> {
1920
21+ private static final Logger logger = Logger .getLogger (PropertiesCustomizer .class .getName ());
22+
2023 private static final String METRICS_EXPORTER = "otel.metrics.exporter" ;
2124
2225 @ Nullable private JmxScraperConfig scraperConfig ;
@@ -27,14 +30,15 @@ public Map<String, String> apply(ConfigProperties config) {
2730
2831 // set default exporter to logging when not explicitly set
2932 if (config .getList (METRICS_EXPORTER ).isEmpty ()) {
30- // TODO: log (info) this
33+ logger . info ( METRICS_EXPORTER + " is not set, default of 'logging' will be used" );
3134 result .put (METRICS_EXPORTER , "logging" );
3235 }
3336
3437 // providing compatibility with the existing 'otel.jmx.interval.milliseconds' config option
3538 long intervalLegacy = config .getLong (JMX_INTERVAL_LEGACY , -1 );
3639 if (config .getDuration (METRIC_EXPORT_INTERVAL ) == null && intervalLegacy > 0 ) {
37- // TODO: log (warn) this
40+ logger .warning (METRIC_EXPORT_INTERVAL + " deprecated option is used, replacing with '"
41+ + METRIC_EXPORT_INTERVAL + "' metric sdk configuration is recommended" );
3842 result .put (METRIC_EXPORT_INTERVAL , intervalLegacy + "ms" );
3943 }
4044
0 commit comments