Skip to content

Commit

Permalink
internal: migrate to standard Grafana stability definitions (#92)
Browse files Browse the repository at this point in the history
* internal: migrate to standard Grafana stability definitions

This commit changes the stability levels to align with [Grafana's
standard set][1]:

* Experimental / `experimental` (unchanged)
* Public preview / `public-preview` (previously "beta")
* Generally available / `generally-available` (previously "stable")

[1]: https://grafana.com/docs/release-life-cycle/

* internal/featuregate: explain why Private preview is not included
  • Loading branch information
rfratto authored Mar 27, 2024
1 parent 2c40e0a commit 0a388b9
Show file tree
Hide file tree
Showing 168 changed files with 213 additions and 203 deletions.
14 changes: 7 additions & 7 deletions internal/alloy/alloy_services_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func TestServices_Configurable(t *testing.T) {
return service.Definition{
Name: "fake",
ConfigType: ServiceOptions{},
Stability: featuregate.StabilityBeta,
Stability: featuregate.StabilityPublicPreview,
}
},

Expand Down Expand Up @@ -118,7 +118,7 @@ func TestServices_Configurable_Optional(t *testing.T) {
return service.Definition{
Name: "fake",
ConfigType: ServiceOptions{},
Stability: featuregate.StabilityBeta,
Stability: featuregate.StabilityPublicPreview,
}
},

Expand Down Expand Up @@ -212,11 +212,11 @@ func TestComponents_Using_Services(t *testing.T) {
}

registry = controller.NewRegistryMap(
featuregate.StabilityStable,
featuregate.StabilityGenerallyAvailable,
map[string]component.Registration{
"service_consumer": {
Name: "service_consumer",
Stability: featuregate.StabilityStable,
Stability: featuregate.StabilityGenerallyAvailable,
Args: struct{}{},
Build: func(opts component.Options, args component.Arguments) (component.Component, error) {
// Call Trigger in a defer so we can make some extra assertions before
Expand Down Expand Up @@ -274,12 +274,12 @@ func TestComponents_Using_Services_In_Modules(t *testing.T) {
}

registry = controller.NewRegistryMap(
featuregate.StabilityStable,
featuregate.StabilityGenerallyAvailable,
map[string]component.Registration{
"module_loader": {
Name: "module_loader",
Args: struct{}{},
Stability: featuregate.StabilityStable,
Stability: featuregate.StabilityGenerallyAvailable,
Build: func(opts component.Options, _ component.Arguments) (component.Component, error) {
mod, err := opts.ModuleController.NewModule("", nil)
require.NoError(t, err, "Failed to create module")
Expand All @@ -300,7 +300,7 @@ func TestComponents_Using_Services_In_Modules(t *testing.T) {
"service_consumer": {
Name: "service_consumer",
Args: struct{}{},
Stability: featuregate.StabilityStable,
Stability: featuregate.StabilityGenerallyAvailable,
Build: func(opts component.Options, _ component.Arguments) (component.Component, error) {
// Call Trigger in a defer so we can make some extra assertions before
// the test exits.
Expand Down
2 changes: 1 addition & 1 deletion internal/alloy/alloy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func testOptions(t *testing.T) Options {
return Options{
Logger: s,
DataPath: t.TempDir(),
MinStability: featuregate.StabilityBeta,
MinStability: featuregate.StabilityPublicPreview,
Reg: nil,
}
}
Expand Down
2 changes: 1 addition & 1 deletion internal/alloy/componenttest/testfailmodule.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
func init() {
component.Register(component.Registration{
Name: "test.fail.module",
Stability: featuregate.StabilityStable,
Stability: featuregate.StabilityGenerallyAvailable,
Args: TestFailArguments{},
Exports: mod.Exports{},

Expand Down
2 changes: 1 addition & 1 deletion internal/alloy/declare_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ func TestDeclareError(t *testing.T) {
ctrl := alloy.New(alloy.Options{
Logger: s,
DataPath: t.TempDir(),
MinStability: featuregate.StabilityBeta,
MinStability: featuregate.StabilityPublicPreview,
Reg: nil,
Services: []service.Service{},
})
Expand Down
2 changes: 1 addition & 1 deletion internal/alloy/import_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ func setup(t *testing.T, config string) (*alloy.Alloy, *alloy.Source) {
ctrl := alloy.New(alloy.Options{
Logger: s,
DataPath: t.TempDir(),
MinStability: featuregate.StabilityBeta,
MinStability: featuregate.StabilityPublicPreview,
Reg: nil,
Services: []service.Service{},
})
Expand Down
22 changes: 11 additions & 11 deletions internal/alloy/internal/controller/loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func TestLoader(t *testing.T) {
}

newLoaderOptions := func() controller.LoaderOptions {
return newLoaderOptionsWithStability(featuregate.StabilityBeta)
return newLoaderOptionsWithStability(featuregate.StabilityPublicPreview)
}

t.Run("New Graph", func(t *testing.T) {
Expand Down Expand Up @@ -168,21 +168,21 @@ func TestLoader(t *testing.T) {
})

t.Run("Load with correct stability level", func(t *testing.T) {
l := controller.NewLoader(newLoaderOptionsWithStability(featuregate.StabilityBeta))
l := controller.NewLoader(newLoaderOptionsWithStability(featuregate.StabilityPublicPreview))
diags := applyFromContent(t, l, []byte(testFile), nil, nil)
require.NoError(t, diags.ErrorOrNil())
})

t.Run("Load with below minimum stability level", func(t *testing.T) {
l := controller.NewLoader(newLoaderOptionsWithStability(featuregate.StabilityStable))
l := controller.NewLoader(newLoaderOptionsWithStability(featuregate.StabilityGenerallyAvailable))
diags := applyFromContent(t, l, []byte(testFile), nil, nil)
require.ErrorContains(t, diags.ErrorOrNil(), "component \"testcomponents.tick\" is at stability level \"beta\", which is below the minimum allowed stability level \"stable\"")
require.ErrorContains(t, diags.ErrorOrNil(), "component \"testcomponents.tick\" is at stability level \"public-preview\", which is below the minimum allowed stability level \"generally-available\"")
})

t.Run("Load with undefined minimum stability level", func(t *testing.T) {
l := controller.NewLoader(newLoaderOptionsWithStability(featuregate.StabilityUndefined))
diags := applyFromContent(t, l, []byte(testFile), nil, nil)
require.ErrorContains(t, diags.ErrorOrNil(), "stability levels must be defined: got \"beta\" as stability of component \"testcomponents.tick\" and <invalid_stability_level> as the minimum stability level")
require.ErrorContains(t, diags.ErrorOrNil(), "stability levels must be defined: got \"public-preview\" as stability of component \"testcomponents.tick\" and <invalid_stability_level> as the minimum stability level")
})

t.Run("Partial load with invalid reference", func(t *testing.T) {
Expand Down Expand Up @@ -330,7 +330,7 @@ func TestLoader_Services(t *testing.T) {
ConfigType: struct {
Name string `alloy:"name,attr,optional"`
}{},
Stability: featuregate.StabilityBeta,
Stability: featuregate.StabilityPublicPreview,
}
},
}
Expand All @@ -354,21 +354,21 @@ func TestLoader_Services(t *testing.T) {
}

t.Run("Load with service at correct stability level", func(t *testing.T) {
l := controller.NewLoader(newLoaderOptionsWithStability(featuregate.StabilityBeta))
l := controller.NewLoader(newLoaderOptionsWithStability(featuregate.StabilityPublicPreview))
diags := applyFromContent(t, l, []byte(testFile), nil, nil)
require.NoError(t, diags.ErrorOrNil())
})

t.Run("Load with service below minimum stabilty level", func(t *testing.T) {
l := controller.NewLoader(newLoaderOptionsWithStability(featuregate.StabilityStable))
l := controller.NewLoader(newLoaderOptionsWithStability(featuregate.StabilityGenerallyAvailable))
diags := applyFromContent(t, l, []byte(testFile), nil, nil)
require.ErrorContains(t, diags.ErrorOrNil(), `block "testsvc" is at stability level "beta", which is below the minimum allowed stability level "stable"`)
require.ErrorContains(t, diags.ErrorOrNil(), `block "testsvc" is at stability level "public-preview", which is below the minimum allowed stability level "generally-available"`)
})

t.Run("Load with undefined minimum stability level", func(t *testing.T) {
l := controller.NewLoader(newLoaderOptionsWithStability(featuregate.StabilityUndefined))
diags := applyFromContent(t, l, []byte(testFile), nil, nil)
require.ErrorContains(t, diags.ErrorOrNil(), `stability levels must be defined: got "beta" as stability of block "testsvc" and <invalid_stability_level> as the minimum stability level`)
require.ErrorContains(t, diags.ErrorOrNil(), `stability levels must be defined: got "public-preview" as stability of block "testsvc" and <invalid_stability_level> as the minimum stability level`)
})
}

Expand Down Expand Up @@ -399,7 +399,7 @@ func TestScopeWithFailingComponent(t *testing.T) {
Logger: l,
TraceProvider: noop.NewTracerProvider(),
DataPath: t.TempDir(),
MinStability: featuregate.StabilityBeta,
MinStability: featuregate.StabilityPublicPreview,
OnBlockNodeUpdate: func(cn controller.BlockNode) { /* no-op */ },
Registerer: prometheus.NewRegistry(),
NewModuleController: func(id string) controller.ModuleController {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
func TestGlobalID(t *testing.T) {
mo := getManagedOptions(ComponentGlobals{
DataPath: "/data/",
MinStability: featuregate.StabilityBeta,
MinStability: featuregate.StabilityPublicPreview,
ControllerID: "module.file",
NewModuleController: func(id string) ModuleController {
return nil
Expand All @@ -26,7 +26,7 @@ func TestGlobalID(t *testing.T) {
func TestLocalID(t *testing.T) {
mo := getManagedOptions(ComponentGlobals{
DataPath: "/data/",
MinStability: featuregate.StabilityBeta,
MinStability: featuregate.StabilityPublicPreview,
ControllerID: "",
NewModuleController: func(id string) ModuleController {
return nil
Expand Down
2 changes: 1 addition & 1 deletion internal/alloy/internal/testcomponents/count.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
func init() {
component.Register(component.Registration{
Name: "testcomponents.count",
Stability: featuregate.StabilityBeta,
Stability: featuregate.StabilityPublicPreview,
Args: CountConfig{},
Exports: CountExports{},

Expand Down
2 changes: 1 addition & 1 deletion internal/alloy/internal/testcomponents/module/file/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
func init() {
component.Register(component.Registration{
Name: "module.file",
Stability: featuregate.StabilityBeta,
Stability: featuregate.StabilityPublicPreview,
Args: Arguments{},
Exports: module.Exports{},

Expand Down
2 changes: 1 addition & 1 deletion internal/alloy/internal/testcomponents/module/git/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
func init() {
component.Register(component.Registration{
Name: "module.git",
Stability: featuregate.StabilityBeta,
Stability: featuregate.StabilityPublicPreview,
Args: Arguments{},
Exports: module.Exports{},

Expand Down
2 changes: 1 addition & 1 deletion internal/alloy/internal/testcomponents/module/http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
func init() {
component.Register(component.Registration{
Name: "module.http",
Stability: featuregate.StabilityBeta,
Stability: featuregate.StabilityPublicPreview,
Args: Arguments{},
Exports: module.Exports{},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
func init() {
component.Register(component.Registration{
Name: "module.string",
Stability: featuregate.StabilityBeta,
Stability: featuregate.StabilityPublicPreview,
Args: Arguments{},
Exports: module.Exports{},

Expand Down
2 changes: 1 addition & 1 deletion internal/alloy/internal/testcomponents/passthrough.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
func init() {
component.Register(component.Registration{
Name: "testcomponents.passthrough",
Stability: featuregate.StabilityBeta,
Stability: featuregate.StabilityPublicPreview,
Args: PassthroughConfig{},
Exports: PassthroughExports{},

Expand Down
2 changes: 1 addition & 1 deletion internal/alloy/internal/testcomponents/sumation.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
func init() {
component.Register(component.Registration{
Name: "testcomponents.summation",
Stability: featuregate.StabilityBeta,
Stability: featuregate.StabilityPublicPreview,
Args: SummationConfig{},
Exports: SummationExports{},

Expand Down
2 changes: 1 addition & 1 deletion internal/alloy/internal/testcomponents/tick.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
func init() {
component.Register(component.Registration{
Name: "testcomponents.tick",
Stability: featuregate.StabilityBeta,
Stability: featuregate.StabilityPublicPreview,
Args: TickConfig{},
Exports: TickExports{},

Expand Down
2 changes: 1 addition & 1 deletion internal/alloy/module_eval_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ func testOptions(t *testing.T) alloy.Options {
return alloy.Options{
Logger: s,
DataPath: t.TempDir(),
MinStability: featuregate.StabilityBeta,
MinStability: featuregate.StabilityPublicPreview,
Reg: nil,
Services: []service.Service{
http_service.New(http_service.Options{}),
Expand Down
4 changes: 2 additions & 2 deletions internal/alloy/module_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ func testModuleControllerOptions(t *testing.T) *moduleControllerOptions {
return &moduleControllerOptions{
Logger: s,
DataPath: t.TempDir(),
MinStability: featuregate.StabilityBeta,
MinStability: featuregate.StabilityPublicPreview,
Reg: prometheus.NewRegistry(),
ModuleRegistry: newModuleRegistry(),
WorkerPool: worker.NewFixedWorkerPool(1, 100),
Expand All @@ -277,7 +277,7 @@ func testModuleControllerOptions(t *testing.T) *moduleControllerOptions {
func init() {
component.Register(component.Registration{
Name: "test.module",
Stability: featuregate.StabilityBeta,
Stability: featuregate.StabilityPublicPreview,
Args: TestArguments{},
Exports: TestExports{},

Expand Down
2 changes: 1 addition & 1 deletion internal/alloy/testdata/import_error/import_error_3.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ import.string "testImport" {
testImport.a "cc" {}

-- error --
component "testcomponents.experimental" is at stability level "experimental", which is below the minimum allowed stability level "beta"
component "testcomponents.experimental" is at stability level "experimental", which is below the minimum allowed stability level "public-preview"
2 changes: 1 addition & 1 deletion internal/alloy/testdata/import_error/import_error_4.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ declare "a" {
a "cc" {}

-- error --
component "testcomponents.experimental" is at stability level "experimental", which is below the minimum allowed stability level "beta"
component "testcomponents.experimental" is at stability level "experimental", which is below the minimum allowed stability level "public-preview"
2 changes: 1 addition & 1 deletion internal/alloycli/cmd_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func runCommand() *cobra.Command {
inMemoryAddr: "alloy.internal:12345",
httpListenAddr: "127.0.0.1:12345",
storagePath: "data-alloy/",
minStability: featuregate.StabilityStable,
minStability: featuregate.StabilityGenerallyAvailable,
uiPrefix: "/",
disableReporting: false,
enablePprof: true,
Expand Down
2 changes: 1 addition & 1 deletion internal/component/discovery/aws/ec2.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
func init() {
component.Register(component.Registration{
Name: "discovery.ec2",
Stability: featuregate.StabilityStable,
Stability: featuregate.StabilityGenerallyAvailable,
Args: EC2Arguments{},
Exports: discovery.Exports{},
Build: func(opts component.Options, args component.Arguments) (component.Component, error) {
Expand Down
2 changes: 1 addition & 1 deletion internal/component/discovery/aws/lightsail.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
func init() {
component.Register(component.Registration{
Name: "discovery.lightsail",
Stability: featuregate.StabilityStable,
Stability: featuregate.StabilityGenerallyAvailable,
Args: LightsailArguments{},
Exports: discovery.Exports{},
Build: func(opts component.Options, args component.Arguments) (component.Component, error) {
Expand Down
2 changes: 1 addition & 1 deletion internal/component/discovery/azure/azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
func init() {
component.Register(component.Registration{
Name: "discovery.azure",
Stability: featuregate.StabilityStable,
Stability: featuregate.StabilityGenerallyAvailable,
Args: Arguments{},
Exports: discovery.Exports{},

Expand Down
2 changes: 1 addition & 1 deletion internal/component/discovery/consul/consul.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
func init() {
component.Register(component.Registration{
Name: "discovery.consul",
Stability: featuregate.StabilityStable,
Stability: featuregate.StabilityGenerallyAvailable,
Args: Arguments{},
Exports: discovery.Exports{},

Expand Down
2 changes: 1 addition & 1 deletion internal/component/discovery/consulagent/consulagent.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
func init() {
component.Register(component.Registration{
Name: "discovery.consulagent",
Stability: featuregate.StabilityStable,
Stability: featuregate.StabilityGenerallyAvailable,
Args: Arguments{},
Exports: discovery.Exports{},

Expand Down
2 changes: 1 addition & 1 deletion internal/component/discovery/digitalocean/digitalocean.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
func init() {
component.Register(component.Registration{
Name: "discovery.digitalocean",
Stability: featuregate.StabilityStable,
Stability: featuregate.StabilityGenerallyAvailable,
Args: Arguments{},
Exports: discovery.Exports{},

Expand Down
2 changes: 1 addition & 1 deletion internal/component/discovery/dns/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
func init() {
component.Register(component.Registration{
Name: "discovery.dns",
Stability: featuregate.StabilityStable,
Stability: featuregate.StabilityGenerallyAvailable,
Args: Arguments{},
Exports: discovery.Exports{},

Expand Down
2 changes: 1 addition & 1 deletion internal/component/discovery/docker/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
func init() {
component.Register(component.Registration{
Name: "discovery.docker",
Stability: featuregate.StabilityStable,
Stability: featuregate.StabilityGenerallyAvailable,
Args: Arguments{},
Exports: discovery.Exports{},

Expand Down
2 changes: 1 addition & 1 deletion internal/component/discovery/dockerswarm/dockerswarm.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
func init() {
component.Register(component.Registration{
Name: "discovery.dockerswarm",
Stability: featuregate.StabilityStable,
Stability: featuregate.StabilityGenerallyAvailable,
Args: Arguments{},
Exports: discovery.Exports{},

Expand Down
2 changes: 1 addition & 1 deletion internal/component/discovery/eureka/eureka.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
func init() {
component.Register(component.Registration{
Name: "discovery.eureka",
Stability: featuregate.StabilityStable,
Stability: featuregate.StabilityGenerallyAvailable,
Args: Arguments{},
Exports: discovery.Exports{},

Expand Down
Loading

0 comments on commit 0a388b9

Please sign in to comment.