Skip to content

[chore] prometheusreceiver: Refactor and remove dead code#44742

Merged
songy23 merged 4 commits into
open-telemetry:mainfrom
aknuds1:arve/remove-dead-unmarshaler
Dec 10, 2025
Merged

[chore] prometheusreceiver: Refactor and remove dead code#44742
songy23 merged 4 commits into
open-telemetry:mainfrom
aknuds1:arve/remove-dead-unmarshaler

Conversation

@aknuds1

@aknuds1 aknuds1 commented Dec 4, 2025

Copy link
Copy Markdown
Contributor

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 :)

Link to tracking issue

Fixes

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.

Documentation

@aknuds1 aknuds1 changed the title targetallocator: Refactor and remove dead code [chore] targetallocator: Refactor and remove dead code Dec 4, 2025
@aknuds1 aknuds1 marked this pull request as ready for review December 4, 2025 21:37
@aknuds1 aknuds1 requested review from a team, ArthurSens and dashpole as code owners December 4, 2025 21:37
@github-actions github-actions Bot added the receiver/prometheus Prometheus receiver label Dec 4, 2025
@aknuds1 aknuds1 force-pushed the arve/remove-dead-unmarshaler branch from b719e23 to c4063df Compare December 4, 2025 21:44
@aknuds1 aknuds1 force-pushed the arve/remove-dead-unmarshaler branch from c4063df to 3e5d523 Compare December 5, 2025 07:46
@aknuds1 aknuds1 changed the title [chore] targetallocator: Refactor and remove dead code [chore] prometheusreceiver: Refactor and remove dead code Dec 5, 2025
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.

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
@aknuds1 aknuds1 force-pushed the arve/remove-dead-unmarshaler branch from 3e5d523 to 87cf432 Compare December 5, 2025 07:51

@ArthurSens ArthurSens left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't understand what part of the code you're removing was dead 🤔, but nonetheless LGTM because code looks simpler. Could you rebase your PR to solve conflicts?

…ead-unmarshaler

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

@ArthurSens ArthurSens left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll wait until Friday to add the Ready to Merge label, to give @dashpole and @krajorama the opportunity to review this as well.

@ArthurSens ArthurSens added the ready to merge Code review completed; ready to merge by maintainers label Dec 10, 2025
@songy23 songy23 merged commit 22ec825 into open-telemetry:main Dec 10, 2025
205 checks passed
@github-actions github-actions Bot added this to the next release milestone Dec 10, 2025
@otelbot

otelbot Bot commented Dec 10, 2025

Copy link
Copy Markdown
Contributor

Thank you for your contribution @aknuds1! 🎉 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.

@aknuds1 aknuds1 deleted the arve/remove-dead-unmarshaler branch February 2, 2026 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready to merge Code review completed; ready to merge by maintainers receiver/prometheus Prometheus receiver

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants