From 8d3c19d55fb63d4ff4bd5181d3a0f4bb0483acf5 Mon Sep 17 00:00:00 2001 From: Pablo Baeyens Date: Wed, 3 Jul 2024 17:12:52 +0200 Subject: [PATCH] [internal/localhostgate] Correctly log message about local host gate (#10529) Fixes log intended to be logged when the feature gate is enabled, not disabled. #### Link to tracking issue Relates to #8510, updates #10352 --------- Co-authored-by: Yang Song --- .chloggen/localhostgate-info-log.yaml | 25 +++++++++++++++++++++++++ internal/localhostgate/featuregate.go | 4 ++-- 2 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 .chloggen/localhostgate-info-log.yaml diff --git a/.chloggen/localhostgate-info-log.yaml b/.chloggen/localhostgate-info-log.yaml new file mode 100644 index 00000000000..e366d2a2e97 --- /dev/null +++ b/.chloggen/localhostgate-info-log.yaml @@ -0,0 +1,25 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: bug_fix + +# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) +component: internal/localhostgate + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Correctly log info message when `component.UseLocalHostAsDefaultHost` is enabled + +# One or more tracking issues or pull requests related to the change +issues: [8510] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: + +# Optional: The change log or logs in which this entry should be included. +# e.g. '[user]' or '[user, api]' +# Include 'user' if the change is relevant to end users. +# Include 'api' if there is a change to a library API. +# Default: '[user]' +change_logs: [] diff --git a/internal/localhostgate/featuregate.go b/internal/localhostgate/featuregate.go index 7c8ee7aeb49..568bbcdd786 100644 --- a/internal/localhostgate/featuregate.go +++ b/internal/localhostgate/featuregate.go @@ -59,9 +59,9 @@ func EndpointForPort(port int) string { // LogAboutUseLocalHostAsDefault logs about the upcoming change from 0.0.0.0 to localhost on server-like components. func LogAboutUseLocalHostAsDefault(logger *zap.Logger) { - if !UseLocalHostAsDefaultHostfeatureGate.IsEnabled() { + if UseLocalHostAsDefaultHostfeatureGate.IsEnabled() { logger.Info( - "The default endpoints for all servers in components have changed to use localhost instead of 0.0.0.0. Use the feature gate to temporarily revert to the previous default.", + "The default endpoints for all servers in components have changed to use localhost instead of 0.0.0.0. Disable the feature gate to temporarily revert to the previous default.", zap.String("feature gate ID", UseLocalHostAsDefaultHostID), ) }