Skip to content

Commit a03ad59

Browse files
committed
cleanup
1 parent 5ef0811 commit a03ad59

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

gcp-auth-extension/src/main/java/io/opentelemetry/contrib/gcp/auth/GcpAuthCustomizerProvider.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
@AutoService(DeclarativeConfigurationCustomizerProvider.class)
3838
public class GcpAuthCustomizerProvider implements DeclarativeConfigurationCustomizerProvider {
3939

40-
static final String SIGNAL_TARGET_WARNING_FIX_SUGGESTION =
40+
static final String SIGNAL_TARGET_WARNING_YAML_FIX_SUGGESTION =
4141
String.format(
4242
"You may safely ignore this warning if it is intentional, otherwise please configure the '%s' by setting %s in the configuration file.",
4343
ConfigurableOption.GOOGLE_OTEL_AUTH_TARGET_SIGNALS.getUserReadableName(),
@@ -48,10 +48,8 @@ public class GcpAuthCustomizerProvider implements DeclarativeConfigurationCustom
4848
public void customize(DeclarativeConfigurationCustomizer customizer) {
4949
customizer.addModelCustomizer(
5050
model -> {
51-
ConfigProperties configProperties = ConfigPropertiesUtil.resolveModel(model);
52-
GoogleCredentials credentials =
53-
GcpAuthAutoConfigurationCustomizerProvider.getCredentials();
54-
customize(model, credentials, configProperties);
51+
customize(model, GcpAuthAutoConfigurationCustomizerProvider.getCredentials(),
52+
ConfigPropertiesUtil.resolveModel(model));
5553

5654
return model;
5755
});
@@ -78,7 +76,7 @@ private static void customizeMeter(
7876
}
7977

8078
if (shouldConfigureExporter(
81-
SIGNAL_TYPE_METRICS, SIGNAL_TARGET_WARNING_FIX_SUGGESTION, configProperties)) {
79+
SIGNAL_TYPE_METRICS, SIGNAL_TARGET_WARNING_YAML_FIX_SUGGESTION, configProperties)) {
8280
for (MetricReaderModel reader : meterProvider.getReaders()) {
8381
if (reader.getPeriodic() != null) {
8482
addAuth(meterModelHeaders(reader.getPeriodic().getExporter()), headerMap);
@@ -114,7 +112,7 @@ private static void customizeTracer(
114112
}
115113

116114
if (shouldConfigureExporter(
117-
SIGNAL_TYPE_TRACES, SIGNAL_TARGET_WARNING_FIX_SUGGESTION, configProperties)) {
115+
SIGNAL_TYPE_TRACES, SIGNAL_TARGET_WARNING_YAML_FIX_SUGGESTION, configProperties)) {
118116
for (SpanProcessorModel processor : tracerProvider.getProcessors()) {
119117
BatchSpanProcessorModel batch = processor.getBatch();
120118
if (batch != null) {

gcp-auth-extension/src/test/java/io/opentelemetry/contrib/gcp/auth/GcpAuthCustomizerProviderTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
package io.opentelemetry.contrib.gcp.auth;
77

8-
import static io.opentelemetry.contrib.gcp.auth.GcpAuthCustomizerProvider.SIGNAL_TARGET_WARNING_FIX_SUGGESTION;
8+
import static io.opentelemetry.contrib.gcp.auth.GcpAuthCustomizerProvider.SIGNAL_TARGET_WARNING_YAML_FIX_SUGGESTION;
99
import static org.assertj.core.api.Assertions.assertThat;
1010
import static org.mockito.Mockito.mock;
1111
import static org.mockito.Mockito.when;
@@ -75,7 +75,7 @@ void declarativeConfig() throws IOException {
7575

7676
@Test
7777
void fixSuggestion() {
78-
assertThat(SIGNAL_TARGET_WARNING_FIX_SUGGESTION)
78+
assertThat(SIGNAL_TARGET_WARNING_YAML_FIX_SUGGESTION)
7979
.isEqualTo(
8080
"You may safely ignore this warning if it is intentional, "
8181
+ "otherwise please configure the 'Target Signals for Google Authentication Extension' "

0 commit comments

Comments
 (0)