Skip to content

Commit aeda53f

Browse files
committed
Do not enable GCP resource detector by default
1 parent eef7cb7 commit aeda53f

File tree

3 files changed

+3
-9
lines changed

3 files changed

+3
-9
lines changed

javaagent-extensions/gcp-auth/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,11 @@ application {
5959
// Configure the GCP Auth extension using system properties.
6060
// This can also be configured using environment variables.
6161
"-Dgoogle.cloud.project=${googleCloudProjectId}",
62-
"-Dgoogle.cloud.region=${googleCloudRegion}",
6362
// Configure auto instrumentation.
6463
"-Dotel.exporter.otlp.traces.endpoint=${googleOtlpEndpoint}",
6564
'-Dotel.java.global-autoconfigure.enabled=true',
65+
// Optionally enable the built-in GCP resource detector
66+
'-Dotel.resource.providers.gcp.enabled=true'
6667
'-Dotel.traces.exporter=otlp',
6768
'-Dotel.metrics.exporter=logging',
6869
}

javaagent-extensions/gcp-auth/src/main/java/com/google/cloud/opentelemetry/extension/auth/GcpAuthAutoConfigurationCustomizerProvider.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ public void customize(AutoConfigurationCustomizer autoConfiguration) {
7474
autoConfiguration
7575
.addSpanExporterCustomizer(
7676
(exporter, configProperties) -> addAuthorizationHeaders(exporter, credentials))
77-
.addPropertiesSupplier(this::getRequiredProperties)
7877
.addResourceCustomizer(this::customizeResource);
7978
} catch (IOException e) {
8079
throw new GoogleAuthException(Reason.FAILED_ADC_RETRIEVAL, e);
@@ -116,13 +115,6 @@ private Map<String, String> getRequiredHeaderMap(GoogleCredentials credentials)
116115
return gcpHeaders;
117116
}
118117

119-
// Sets the required properties that are essential for exporting OTLP data to GCP.
120-
private Map<String, String> getRequiredProperties() {
121-
Map<String, String> properties = new HashMap<>();
122-
properties.put("otel.resource.providers.gcp.enabled", "true");
123-
return properties;
124-
}
125-
126118
// Updates the current resource with the attributes required for ingesting OTLP data on GCP.
127119
private Resource customizeResource(Resource resource, ConfigProperties configProperties) {
128120
Resource res =

javaagent-extensions/gcp-auth/src/test/java/com/google/cloud/opentelemetry/extension/auth/ExtensionIntegrationTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public void smokeTest() throws IOException, InterruptedException {
5656
"-Dotel.javaagent.logging=none",
5757
"-Dotel.exporter.otlp.endpoint=http://localhost:" + backendServerPort,
5858
"-Dotel.exporter.otlp.insecure=true",
59+
"-Dotel.resource.providers.gcp.enabled=true",
5960
"-Dotel.traces.exporter=otlp",
6061
"-Dotel.metrics.exporter=none",
6162
"-Dotel.logs.exporter=none",

0 commit comments

Comments
 (0)