[receiver/prometheus] fix yaml marshaling for prometheus secrets#44602
Merged
codeboten merged 1 commit intoDec 4, 2025
Merged
Conversation
…nfig.Secret types
b6a0bc1 to
29be32f
Compare
paulojmdias
approved these changes
Nov 28, 2025
aknuds1
reviewed
Dec 1, 2025
aknuds1
left a comment
Contributor
There was a problem hiding this comment.
LGTM, except for my chloggen concern.
dashpole
approved these changes
Dec 2, 2025
codeboten
approved these changes
Dec 4, 2025
Contributor
|
Thank you for your contribution @erikburt! 🎉 We would like to hear from you about your experience contributing to OpenTelemetry by taking a few minutes to fill out this survey. If you are getting started contributing, you can also join the CNCF Slack channel #opentelemetry-new-contributors to ask for guidance and get help. |
songy23
pushed a commit
that referenced
this pull request
Dec 10, 2025
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description Refactor `PromHTTPSDConfig.Unmarshal` and `PromHTTPClientConfig.Unmarshal` so they call a more specific function `unmarshalConf`, that knows it won't have to YAML marshal `commonconfig.Secret` instances. This allows me to remove the custom YAML marshalling of `commonconfig.Secret`, which is actually buggy as evidenced by #44602 fixing the same logic in another location. Good thing it isn't needed :) <!-- Issue number (e.g. #1234) or full URL to issue, if applicable. --> #### Link to tracking issue Fixes <!--Describe what testing was performed and which tests were added.--> #### Testing I'm adding `TestUnmarshalConf`, with a set of sub-tests for relevant cases. The `targetallocator` coverage improves from 77.7% to 83.6% versus main. Additionally, I'm adding `TestLoadTargetAllocatorConfig/special_characters_in_password`, which fully verifies that loading a `confmap.Conf` from a YAML file with special password characters and then unmarshalling into `targetallocator.Config` works. The old, and non-functioning, code was supposed to ensure the same. <!--Describe the documentation added.--> #### Documentation <!--Please delete paragraphs that you did not use before submitting.--> --------- Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
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.
Description
This fixes a bug where the custom marshaler for
prometheus/common/config.Secrettypes was interpreting the value as a yaml document.%to be treated as a YAML directive.Instead of returning the raw bytes, we let the yaml library marshal it as a string, rather than of type
Secret.Link to tracking issue
Fixes #44445
Testing
Documentation
N/A