[service] fix: use ipv6-aware host and port concatenation function #10343
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
Fixing the bug: the latest version of otel-collector failed to start with ipv6 metrics endpoint service telemetry.
This problem began to occur after #9037 with the feature gate flag enabled was merged. This problem is probably an implementation omission because the enabled codepath, which was originally added by #7871, is marked as WIP.
You can reproduce the issue with the config and the environment variable (
MY_POD_IP=::1
).Link to tracking issue
Fixes #10011
Testing
Added unittests to ensure the collector service to work with ipv6 metrics endpoint service telemetry.
I wondered whether to add a
network
argument, which is used as switching flag, to theGetAvailableLocalAddress
function or create a new dedicated function for IPv6.Since the
GetAvailableLocalAddress
function is widely used and its usage is usually assumed to be for IPv4, I chose the latter, not wanting to add more arguments each time we call.Documentation