Skip to content

Commit

Permalink
Remove stable gate component.UseLocalHostAsDefaultHost
Browse files Browse the repository at this point in the history
Signed-off-by: Bogdan Drutu <[email protected]>
  • Loading branch information
bogdandrutu committed Oct 10, 2024
1 parent 2b480f6 commit fa8584e
Showing 1 changed file with 0 additions and 31 deletions.
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 fa8584e

Please sign in to comment.