|
37 | 37 | * otel.jmx.enabled and otel.jmx.exporter.metrics.endpoint or the environment variable |
38 | 38 | * OTEL_JMX_ENABLED_CONFIG and OTEL_JMX_ENDPOINT_CONFIG. These flags are disabled by default. |
39 | 39 | */ |
40 | | -public class OtelJMXMetricsCustomizerProvider implements AutoConfigurationCustomizerProvider { |
| 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 | | - Logger.getLogger(OtelJMXMetricsCustomizerProvider.class.getName()); |
| 43 | + Logger.getLogger(AWSJMXMetricsCustomizerProvider.class.getName()); |
44 | 44 |
|
45 | | - private static final String OTEL_JMX_ENABLED_CONFIG = "otel.jmx.enabled"; |
46 | | - private static final String OTEL_JMX_ENDPOINT_CONFIG = "otel.jmx.exporter.metrics.endpoint"; |
| 45 | + private static final String AWS_OTEL_JMX_ENABLED_CONFIG = "otel.aws.jmx.enabled"; |
| 46 | + private static final String AWS_OTEL_JMX_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 | | - return configProps.getBoolean(OTEL_JMX_ENABLED_CONFIG, false) |
54 | | - && configProps.getString(OTEL_JMX_ENDPOINT_CONFIG, "") != ""; |
| 54 | + return configProps.getBoolean(AWS_OTEL_JMX_ENABLED_CONFIG, false) |
| 55 | + && configProps.getString(AWS_OTEL_JMX_ENDPOINT_CONFIG, "") != ""; |
55 | 56 | } |
56 | 57 |
|
57 | 58 | private SdkMeterProviderBuilder customizeMeterProvider( |
@@ -89,15 +90,17 @@ public MetricExporter createExporter(ConfigProperties configProps) { |
89 | 90 |
|
90 | 91 | String otelJMXEndpoint; |
91 | 92 | if (protocol.equals(OtlpConfigUtil.PROTOCOL_HTTP_PROTOBUF)) { |
92 | | - otelJMXEndpoint = configProps.getString(OTEL_JMX_ENDPOINT_CONFIG, "http://localhost:4314"); |
| 93 | + otelJMXEndpoint = |
| 94 | + configProps.getString(AWS_OTEL_JMX_ENDPOINT_CONFIG, "http://localhost:4314"); |
93 | 95 | logger.log( |
94 | | - Level.FINE, String.format("Otel JMX metrics export endpoint: %s", otelJMXEndpoint)); |
| 96 | + Level.FINE, String.format("AWS Otel JMX metrics export endpoint: %s", otelJMXEndpoint)); |
95 | 97 | return OtlpHttpMetricExporter.builder() |
96 | 98 | .setEndpoint(otelJMXEndpoint) |
97 | 99 | .setDefaultAggregationSelector(this::getAggregation) |
98 | 100 | .build(); |
99 | 101 | } |
100 | | - throw new ConfigurationException("Unsupported Otel JMX metrics export protocol: " + protocol); |
| 102 | + throw new ConfigurationException( |
| 103 | + "Unsupported AWS Otel JMX metrics export protocol: " + protocol); |
101 | 104 | } |
102 | 105 |
|
103 | 106 | private Aggregation getAggregation(InstrumentType instrumentType) { |
|
0 commit comments