|
35 | 35 | /** |
36 | 36 | * You can control when these customizations are applied using both the properties - |
37 | 37 | * otel.aws.jmx.enabled and otel.aws.jmx.exporter.metrics.endpoint or the environment variable |
38 | | - * AWS_JMX_ENABLED_CONFIG and AWS_JMX_ENDPOINT_CONFIG. These flags are disabled by default. |
| 38 | + * AWS_JMX_ENABLED_CONFIG and AWS_JMX_EXPORTER_ENDPOINT_CONFIG. These flags are disabled by default. |
39 | 39 | */ |
40 | 40 | public class AwsJMXMetricsCustomizerProvider implements AutoConfigurationCustomizerProvider { |
41 | 41 | private static final Duration DEFAULT_METRIC_EXPORT_INTERVAL = Duration.ofMinutes(1); |
42 | 42 | private static final Logger logger = |
43 | 43 | Logger.getLogger(AwsJMXMetricsCustomizerProvider.class.getName()); |
44 | 44 |
|
45 | 45 | private static final String AWS_JMX_ENABLED_CONFIG = "otel.aws.jmx.enabled"; |
46 | | - private static final String AWS_JMX_ENDPOINT_CONFIG = "otel.aws.jmx.exporter.metrics.endpoint"; |
| 46 | + private static final String AWS_JMX_EXPORTER_ENDPOINT_CONFIG = |
| 47 | + "otel.aws.jmx.exporter.metrics.endpoint"; |
47 | 48 |
|
48 | 49 | public void customize(AutoConfigurationCustomizer autoConfiguration) { |
49 | 50 | autoConfiguration.addMeterProviderCustomizer(this::customizeMeterProvider); |
50 | 51 | } |
51 | 52 |
|
52 | 53 | private boolean isOtelJMXEnabled(ConfigProperties configProps) { |
53 | 54 | return configProps.getBoolean(AWS_JMX_ENABLED_CONFIG, false) |
54 | | - && configProps.getString(AWS_JMX_ENDPOINT_CONFIG, "") != ""; |
| 55 | + && configProps.getString(AWS_JMX_EXPORTER_ENDPOINT_CONFIG, "") != ""; |
55 | 56 | } |
56 | 57 |
|
57 | 58 | private SdkMeterProviderBuilder customizeMeterProvider( |
@@ -89,7 +90,8 @@ public MetricExporter createExporter(ConfigProperties configProps) { |
89 | 90 |
|
90 | 91 | String otelJMXEndpoint; |
91 | 92 | if (protocol.equals(OtlpConfigUtil.PROTOCOL_HTTP_PROTOBUF)) { |
92 | | - otelJMXEndpoint = configProps.getString(AWS_JMX_ENDPOINT_CONFIG, "http://localhost:4314"); |
| 93 | + otelJMXEndpoint = |
| 94 | + configProps.getString(AWS_JMX_EXPORTER_ENDPOINT_CONFIG, "http://localhost:4314"); |
93 | 95 | logger.log( |
94 | 96 | Level.FINE, String.format("AWS JMX metrics export endpoint: %s", otelJMXEndpoint)); |
95 | 97 | return OtlpHttpMetricExporter.builder() |
|
0 commit comments