From 13134b6017fb7174e5bdc414636405d0b36d3579 Mon Sep 17 00:00:00 2001 From: Bogdan Drutu Date: Thu, 10 Oct 2024 16:05:39 -0700 Subject: [PATCH] Remove stable gate component.UseLocalHostAsDefaultHost (#11412) Signed-off-by: Bogdan Drutu --- .chloggen/rm-stable-gate.yaml | 25 +++++++++++++++++++++++ internal/globalgates/globalgates.go | 31 ----------------------------- 2 files changed, 25 insertions(+), 31 deletions(-) create mode 100644 .chloggen/rm-stable-gate.yaml diff --git a/.chloggen/rm-stable-gate.yaml b/.chloggen/rm-stable-gate.yaml new file mode 100644 index 00000000000..18cab1bdffd --- /dev/null +++ b/.chloggen/rm-stable-gate.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: breaking + +# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) +component: service + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Remove stable gate component.UseLocalHostAsDefaultHost + +# One or more tracking issues or pull requests related to the change +issues: [11412] + +# (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: [user] diff --git a/internal/globalgates/globalgates.go b/internal/globalgates/globalgates.go index b7e8a6ce698..440b04f7fb6 100644 --- a/internal/globalgates/globalgates.go +++ b/internal/globalgates/globalgates.go @@ -4,8 +4,6 @@ package globalgates // import "go.opentelemetry.io/collector/internal/globalgates" import ( - "errors" - "go.opentelemetry.io/collector/featuregate" ) @@ -14,32 +12,3 @@ var NoopTracerProvider = featuregate.GlobalRegistry().MustRegister("service.noop featuregate.WithRegisterFromVersion("v0.107.0"), featuregate.WithRegisterToVersion("v0.109.0"), featuregate.WithRegisterDescription("Sets a Noop OpenTelemetry TracerProvider to reduce memory allocations. This featuregate is incompatible with the zPages extension.")) - -var _ = mustRegisterOrLoad( - featuregate.GlobalRegistry(), - "component.UseLocalHostAsDefaultHost", - featuregate.StageStable, - featuregate.WithRegisterToVersion("v0.110.0"), - featuregate.WithRegisterDescription("controls whether server-like receivers and extensions such as the OTLP receiver use localhost as the default host for their endpoints"), -) - -// mustRegisterOrLoad tries to register the feature gate and loads it if it already exists. -// It panics on any other error. -func mustRegisterOrLoad(reg *featuregate.Registry, id string, stage featuregate.Stage, opts ...featuregate.RegisterOption) *featuregate.Gate { - gate, err := reg.Register(id, stage, opts...) - - if errors.Is(err, featuregate.ErrAlreadyRegistered) { - // Gate is already registered; find it. - // Only a handful of feature gates are registered, so it's fine to iterate over all of them. - reg.VisitAll(func(g *featuregate.Gate) { - if g.ID() == id { - gate = g - return - } - }) - } else if err != nil { - panic(err) - } - - return gate -}