Skip to content

Commit

Permalink
Remove stable gate component.UseLocalHostAsDefaultHost (#11412)
Browse files Browse the repository at this point in the history
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
  • Loading branch information
bogdandrutu authored Oct 10, 2024
1 parent 2b480f6 commit 13134b6
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 31 deletions.
25 changes: 25 additions & 0 deletions .chloggen/rm-stable-gate.yaml
Original file line number Diff line number Diff line change
@@ -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]
31 changes: 0 additions & 31 deletions internal/globalgates/globalgates.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
package globalgates // import "go.opentelemetry.io/collector/internal/globalgates"

import (
"errors"

"go.opentelemetry.io/collector/featuregate"
)

Expand All @@ -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
}

0 comments on commit 13134b6

Please sign in to comment.