Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[service] fix: use ipv6-aware host and port concatenation function #10343

Merged
merged 3 commits into from
Jun 28, 2024

Conversation

terakoya76
Copy link
Contributor

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

service:
  telemetry:
    logs:
      encoding: json
    metrics:
      address: '[${env:MY_POD_IP}]:8888'

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 the GetAvailableLocalAddress 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

@terakoya76 terakoya76 marked this pull request as ready for review June 6, 2024 02:10
@terakoya76 terakoya76 requested review from a team and TylerHelmuth June 6, 2024 02:10
Copy link

codecov bot commented Jun 6, 2024

Codecov Report

Attention: Patch coverage is 58.97436% with 16 lines in your changes missing coverage. Please review.

Project coverage is 92.34%. Comparing base (5309d60) to head (2141f8c).

Files Patch % Lines
internal/testutil/testutil.go 57.89% 14 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10343      +/-   ##
==========================================
- Coverage   92.40%   92.34%   -0.06%     
==========================================
  Files         393      393              
  Lines       18588    18620      +32     
==========================================
+ Hits        17176    17195      +19     
- Misses       1057     1068      +11     
- Partials      355      357       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@terakoya76
Copy link
Contributor Author

Is there anything else I have to do to get a review?

Note: I did not add a change log because I assumed that changes were made only to internal packages. If this is an incorrect understanding, please point it out.

@marcus-griep-simplisafe
Copy link

marcus-griep-simplisafe commented Jun 24, 2024

Tracking this, as without this fix, it's causing problems with being able to use an up-to-date OTel collector in some IPv6 applications.

Copy link
Member

@TylerHelmuth TylerHelmuth left a comment

Choose a reason for hiding this comment

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

@terakoya76 sorry that I missed this PR. Everything looks good to me. Please add a bug_fix changelog entry.

@terakoya76
Copy link
Contributor Author

@TylerHelmuth
Thanks. I added a change log entry.

@dmitryax dmitryax merged commit ee4eb85 into open-telemetry:main Jun 28, 2024
49 of 50 checks passed
@github-actions github-actions bot added this to the next release milestone Jun 28, 2024
@terakoya76 terakoya76 deleted the fix_ipv6_too_many_colon branch June 29, 2024 02:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Collector cannot export metrics telemetry in an ipv6-only environment
4 participants