55
55
* otel.aws.application.signals.enabled or the environment variable
56
56
* OTEL_AWS_APPLICATION_SIGNALS_ENABLED. This flag is disabled by default.
57
57
*/
58
- public class AwsAppSignalsCustomizerProvider implements AutoConfigurationCustomizerProvider {
58
+ public class AwsApplicationSignalsCustomizerProvider
59
+ implements AutoConfigurationCustomizerProvider {
59
60
private static final Duration DEFAULT_METRIC_EXPORT_INTERVAL = Duration .ofMinutes (1 );
60
61
private static final Logger logger =
61
- Logger .getLogger (AwsAppSignalsCustomizerProvider .class .getName ());
62
+ Logger .getLogger (AwsApplicationSignalsCustomizerProvider .class .getName ());
62
63
63
64
private static final String SMP_ENABLED_CONFIG = "otel.smp.enabled" ;
64
65
private static final String APP_SIGNALS_ENABLED_CONFIG = "otel.aws.app.signals.enabled" ;
@@ -76,42 +77,44 @@ public void customize(AutoConfigurationCustomizer autoConfiguration) {
76
77
autoConfiguration .addSpanExporterCustomizer (this ::customizeSpanExporter );
77
78
}
78
79
79
- private boolean isAppSignalsEnabled (ConfigProperties configProps ) {
80
+ private boolean isApplicationSignalsEnabled (ConfigProperties configProps ) {
80
81
return configProps .getBoolean (
81
82
APPLICATION_SIGNALS_ENABLED_CONFIG ,
82
83
configProps .getBoolean (
83
84
APP_SIGNALS_ENABLED_CONFIG , configProps .getBoolean (SMP_ENABLED_CONFIG , false )));
84
85
}
85
86
86
87
private Sampler customizeSampler (Sampler sampler , ConfigProperties configProps ) {
87
- if (isAppSignalsEnabled (configProps )) {
88
+ if (isApplicationSignalsEnabled (configProps )) {
88
89
return AlwaysRecordSampler .create (sampler );
89
90
}
90
91
return sampler ;
91
92
}
92
93
93
94
private SdkTracerProviderBuilder customizeTracerProviderBuilder (
94
95
SdkTracerProviderBuilder tracerProviderBuilder , ConfigProperties configProps ) {
95
- if (isAppSignalsEnabled (configProps )) {
96
- logger .info ("AWS AppSignals enabled" );
96
+ if (isApplicationSignalsEnabled (configProps )) {
97
+ logger .info ("AWS Application Signals enabled" );
97
98
Duration exportInterval =
98
99
configProps .getDuration ("otel.metric.export.interval" , DEFAULT_METRIC_EXPORT_INTERVAL );
99
100
logger .log (
100
- Level .FINE , String .format ("AppSignals Metrics export interval: %s" , exportInterval ));
101
+ Level .FINE ,
102
+ String .format ("AWS Application Signals Metrics export interval: %s" , exportInterval ));
101
103
// Cap export interval to 60 seconds. This is currently required for metrics-trace correlation
102
104
// to work correctly.
103
105
if (exportInterval .compareTo (DEFAULT_METRIC_EXPORT_INTERVAL ) > 0 ) {
104
106
exportInterval = DEFAULT_METRIC_EXPORT_INTERVAL ;
105
107
logger .log (
106
108
Level .INFO ,
107
- String .format ("AWS AppSignals metrics export interval capped to %s" , exportInterval ));
109
+ String .format (
110
+ "AWS Application Signals metrics export interval capped to %s" , exportInterval ));
108
111
}
109
112
// Construct and set local and remote attributes span processor
110
113
tracerProviderBuilder .addSpanProcessor (
111
114
AttributePropagatingSpanProcessorBuilder .create ().build ());
112
115
// Construct meterProvider
113
116
MetricExporter metricsExporter =
114
- AppSignalsExporterProvider .INSTANCE .createExporter (configProps );
117
+ ApplicationSignalsExporterProvider .INSTANCE .createExporter (configProps );
115
118
116
119
MetricReader metricReader =
117
120
PeriodicMetricReader .builder (metricsExporter ).setInterval (exportInterval ).build ();
@@ -121,7 +124,7 @@ private SdkTracerProviderBuilder customizeTracerProviderBuilder(
121
124
.setResource (ResourceHolder .getResource ())
122
125
.registerMetricReader (metricReader )
123
126
.build ();
124
- // Construct and set AppSignals metrics processor
127
+ // Construct and set application signals metrics processor
125
128
SpanProcessor spanMetricsProcessor =
126
129
AwsSpanMetricsProcessorBuilder .create (meterProvider , ResourceHolder .getResource ())
127
130
.build ();
@@ -132,7 +135,7 @@ private SdkTracerProviderBuilder customizeTracerProviderBuilder(
132
135
133
136
private SpanExporter customizeSpanExporter (
134
137
SpanExporter spanExporter , ConfigProperties configProps ) {
135
- if (isAppSignalsEnabled (configProps )) {
138
+ if (isApplicationSignalsEnabled (configProps )) {
136
139
return AwsMetricAttributesSpanExporterBuilder .create (
137
140
spanExporter , ResourceHolder .getResource ())
138
141
.build ();
@@ -141,43 +144,49 @@ private SpanExporter customizeSpanExporter(
141
144
return spanExporter ;
142
145
}
143
146
144
- private enum AppSignalsExporterProvider {
147
+ private enum ApplicationSignalsExporterProvider {
145
148
INSTANCE ;
146
149
147
150
public MetricExporter createExporter (ConfigProperties configProps ) {
148
151
String protocol =
149
152
OtlpConfigUtil .getOtlpProtocol (OtlpConfigUtil .DATA_TYPE_METRICS , configProps );
150
- logger .log (Level .FINE , String .format ("AppSignals export protocol: %s" , protocol ));
153
+ logger .log (
154
+ Level .FINE , String .format ("AWS Application Signals export protocol: %s" , protocol ));
151
155
152
- String appSignalsEndpoint ;
156
+ String applicationSignalsEndpoint ;
153
157
if (protocol .equals (OtlpConfigUtil .PROTOCOL_HTTP_PROTOBUF )) {
154
- appSignalsEndpoint =
158
+ applicationSignalsEndpoint =
155
159
configProps .getString (
156
160
APPLICATION_SIGNALS_EXPORTER_ENDPOINT_CONFIG ,
157
161
configProps .getString (
158
162
APP_SIGNALS_EXPORTER_ENDPOINT_CONFIG ,
159
163
configProps .getString (SMP_EXPORTER_ENDPOINT_CONFIG , "http://localhost:4316/v1/metrics" )));
160
- logger .log (Level .FINE , String .format ("AppSignals export endpoint: %s" , appSignalsEndpoint ));
164
+ logger .log (
165
+ Level .FINE ,
166
+ String .format ("AWS Application Signals export endpoint: %s" , applicationSignalsEndpoint ));
161
167
return OtlpHttpMetricExporter .builder ()
162
- .setEndpoint (appSignalsEndpoint )
168
+ .setEndpoint (applicationSignalsEndpoint )
163
169
.setDefaultAggregationSelector (this ::getAggregation )
164
170
.setAggregationTemporalitySelector (AggregationTemporalitySelector .deltaPreferred ())
165
171
.build ();
166
172
} else if (protocol .equals (OtlpConfigUtil .PROTOCOL_GRPC )) {
167
- appSignalsEndpoint =
173
+ applicationSignalsEndpoint =
168
174
configProps .getString (
169
175
APPLICATION_SIGNALS_EXPORTER_ENDPOINT_CONFIG ,
170
176
configProps .getString (
171
177
APP_SIGNALS_EXPORTER_ENDPOINT_CONFIG ,
172
178
configProps .getString (SMP_EXPORTER_ENDPOINT_CONFIG , "http://localhost:4315" )));
173
- logger .log (Level .FINE , String .format ("AppSignals export endpoint: %s" , appSignalsEndpoint ));
179
+ logger .log (
180
+ Level .FINE ,
181
+ String .format ("AWS Application Signals export endpoint: %s" , applicationSignalsEndpoint ));
174
182
return OtlpGrpcMetricExporter .builder ()
175
- .setEndpoint (appSignalsEndpoint )
183
+ .setEndpoint (applicationSignalsEndpoint )
176
184
.setDefaultAggregationSelector (this ::getAggregation )
177
185
.setAggregationTemporalitySelector (AggregationTemporalitySelector .deltaPreferred ())
178
186
.build ();
179
187
}
180
- throw new ConfigurationException ("Unsupported AppSignals export protocol: " + protocol );
188
+ throw new ConfigurationException (
189
+ "Unsupported AWS Application Signals export protocol: " + protocol );
181
190
}
182
191
183
192
private Aggregation getAggregation (InstrumentType instrumentType ) {
0 commit comments