Repository navigation
[OpenTelemetry] Resolve inline Secret placeholders in openTelemetryProperties - #40579
stankiewicz wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
📋 Review Summary
This PR adds support for resolving Beam Secret placeholders (${type:<secret_type>;...}) in OpenTelemetry properties configured via SdkHarnessOptions. The implementation is clean, avoids mutating PipelineOptions (preventing secret leakage into serialized options), properly handles special regex characters and trailing whitespace, and includes comprehensive unit test coverage.
🔍 General Feedback
- The secret resolution logic in
SdkHarnessOptions.resolveOpenTelemetryPropertyValueis well-scoped to only match${type:...}placeholders, leaving other${...}expressions intact. - Good use of
Matcher.quoteReplacementand.trim()when substituting secret values into property strings. - Unit tests in
SdkHarnessOptionsTestthoroughly cover plain values, single and multiple secret placeholders, special characters, invalid secret types, and non-mutation ofPipelineOptions.
💡 Tip: Comment /gemini review on this pull request to trigger a new Gemini code review.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #40579 +/- ##
============================================
+ Coverage 56.16% 65.05% +8.88%
- Complexity 2288 13976 +11688
============================================
Files 1124 1729 +605
Lines 178336 108481 -69855
Branches 1489 11308 +9819
============================================
- Hits 100170 70575 -29595
+ Misses 75645 33691 -41954
- Partials 2521 4215 +1694
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
Allows referencing secrets managed by Beam's
Secretframework (e.g.,GcpSecret/GoogleCloudSecretManager) inline inside--openTelemetryPropertiesvalues so sensitive tokens (such as OTLP exporter authentication headers) do not need to be passed in plaintext inPipelineOptions.Details
SdkHarnessOptions.configureOpenTelemetry(PipelineOptions)to resolve inline${type:<secret_type>;<secret_param>:<value>}placeholders viaSecret.parseSecretOption(String)when populating JVM system properties on the worker.$and\).${ENV_VAR}) unchanged and preserves the unresolved placeholder inPipelineOptions.SdkHarnessOptionsTestcovering plain strings, non-secret placeholders, single and multiple${type:...}placeholders, whitespace/newline trimming,$and\escaping, invalid secret types, andconfigureOpenTelemetrysystem property initialization.