Limit targeting of exporters in GCP Auth Extension to GCP endpoints#2899
Open
stankiewicz wants to merge 2 commits into
Open
Limit targeting of exporters in GCP Auth Extension to GCP endpoints#2899stankiewicz wants to merge 2 commits into
stankiewicz wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates GCP auth auto-configuration to only treat signals as “targeted” when the OTLP endpoint is a Google Cloud Telemetry endpoint, and adjusts tests to match the new targeting behavior.
Changes:
- Add endpoint-based eligibility check in
isSignalTargeted(onlytelemetry.googleapis.com/telemetry.mtls.googleapis.com). - Refactor test cases to reuse a shared OTel properties map and update expected outcomes for non-Google endpoints.
- Add/adjust parameterized test coverage for mixed/invalid configured target signals.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
gcp-auth-extension/src/main/java/io/opentelemetry/contrib/gcp/auth/GcpAuthAutoConfigurationCustomizerProvider.java |
Adds endpoint gating so auth customization only applies when exporting to Google telemetry endpoints. |
gcp-auth-extension/src/test/java/io/opentelemetry/contrib/gcp/auth/GcpAuthAutoConfigurationCustomizerProviderTest.java |
Updates/extends test cases to reflect the new endpoint-based targeting behavior and reuses shared OTel properties. |
Comment on lines
+125
to
+138
| private static final ImmutableMap<String, String> defaultOtelPropertiesBothExporters = | ||
| ImmutableMap.of( | ||
| "otel.exporter.otlp.metrics.endpoint", | ||
| "https://telemetry.googleapis.com/v1/metrics", | ||
| "otel.exporter.otlp.traces.endpoint", | ||
| "https://telemetry.googleapis.com/v1/traces", | ||
| "otel.traces.exporter", | ||
| "otlp", | ||
| "otel.metrics.exporter", | ||
| "otlp", | ||
| "otel.logs.exporter", | ||
| "none", | ||
| "otel.resource.attributes", | ||
| "foo=bar"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Modified GcpAuthAutoConfigurationCustomizerProvider.java :
• Updated isSignalTargeted to verify if the configured endpoint starts with https://telemetry.googleapis.com or https://telemetry.mtls.googleapis.com before targeting it for authentication.
Updated and verified tests:
• Modified GcpAuthAutoConfigurationCustomizerProviderTest.java to use GCP endpoints for positive test cases.
• Added a test case to explicitly verify that localhost endpoints are not targeted for authentication.
• Ran the Gradle checks using Java 21, and all tests passed successfully.
this is breaking change, happy to discuss.