diff --git a/component/otelcol/connector/host_info/host_info.go b/component/otelcol/connector/host_info/host_info.go index 7dfde78188..d20d0e30dc 100644 --- a/component/otelcol/connector/host_info/host_info.go +++ b/component/otelcol/connector/host_info/host_info.go @@ -17,7 +17,7 @@ import ( func init() { component.Register(component.Registration{ Name: "otelcol.connector.host_info", - Stability: featuregate.StabilityStable, + Stability: featuregate.StabilityExperimental, Args: Arguments{}, Exports: otelcol.ConsumerExports{}, diff --git a/component/otelcol/processor/resourcedetection/resourcedetection.go b/component/otelcol/processor/resourcedetection/resourcedetection.go index 1e648f766e..6878f45b87 100644 --- a/component/otelcol/processor/resourcedetection/resourcedetection.go +++ b/component/otelcol/processor/resourcedetection/resourcedetection.go @@ -33,7 +33,7 @@ import ( func init() { component.Register(component.Registration{ Name: "otelcol.processor.resourcedetection", - Stability: featuregate.StabilityStable, + Stability: featuregate.StabilityBeta, Args: Arguments{}, Exports: otelcol.ConsumerExports{}, diff --git a/component/pyroscope/java/java.go b/component/pyroscope/java/java.go index 809d28d93e..5e5c894745 100644 --- a/component/pyroscope/java/java.go +++ b/component/pyroscope/java/java.go @@ -23,7 +23,7 @@ const ( func init() { component.Register(component.Registration{ Name: "pyroscope.java", - Stability: featuregate.StabilityStable, + Stability: featuregate.StabilityBeta, Args: Arguments{}, Build: func(opts component.Options, args component.Arguments) (component.Component, error) { diff --git a/component/pyroscope/java/java_stub.go b/component/pyroscope/java/java_stub.go index 3804888551..e68081b3bb 100644 --- a/component/pyroscope/java/java_stub.go +++ b/component/pyroscope/java/java_stub.go @@ -13,7 +13,7 @@ import ( func init() { component.Register(component.Registration{ Name: "pyroscope.java", - Stability: featuregate.StabilityStable, + Stability: featuregate.StabilityBeta, Args: Arguments{}, Build: func(opts component.Options, args component.Arguments) (component.Component, error) { diff --git a/pkg/flow/internal/testcomponents/experimental.go b/pkg/flow/internal/testcomponents/experimental.go new file mode 100644 index 0000000000..29cd0d8da0 --- /dev/null +++ b/pkg/flow/internal/testcomponents/experimental.go @@ -0,0 +1,36 @@ +package testcomponents + +import ( + "context" + + "github.com/go-kit/log" + "github.com/grafana/agent/component" + "github.com/grafana/agent/internal/featuregate" +) + +func init() { + component.Register(component.Registration{ + Name: "testcomponents.experimental", + Stability: featuregate.StabilityExperimental, + + Build: func(opts component.Options, args component.Arguments) (component.Component, error) { + return &Experimental{log: opts.Logger}, nil + }, + }) +} + +// Experimental is a test component that is marked as experimental. Used to verify stability level checking. +type Experimental struct { + log log.Logger +} + +func (e *Experimental) Run(ctx context.Context) error { + e.log.Log("msg", "running experimental component") + <-ctx.Done() + return nil +} + +func (e *Experimental) Update(args component.Arguments) error { + e.log.Log("msg", "updating experimental component") + return nil +} diff --git a/pkg/flow/testdata/import_error/import_error_3.txtar b/pkg/flow/testdata/import_error/import_error_3.txtar new file mode 100644 index 0000000000..a68fcbd92d --- /dev/null +++ b/pkg/flow/testdata/import_error/import_error_3.txtar @@ -0,0 +1,14 @@ +Use of an imported component with too low stability level propagates the error + +-- main.river -- + +import.string "testImport" { + content = ` declare "a" { + testcomponents.experimental "unstable" {} + }` +} + +testImport.a "cc" {} + +-- error -- +component "testcomponents.experimental" is at stability level "experimental", which is below the minimum allowed stability level "beta" diff --git a/pkg/flow/testdata/import_error/import_error_4.txtar b/pkg/flow/testdata/import_error/import_error_4.txtar new file mode 100644 index 0000000000..04e1f9a8eb --- /dev/null +++ b/pkg/flow/testdata/import_error/import_error_4.txtar @@ -0,0 +1,18 @@ +Use of a nested declare component with too low stability level propagates the error + +-- main.river -- + +declare "a" { + + declare "b" { + testcomponents.experimental "unstable" {} + } + + b "cc" {} + +} + +a "cc" {} + +-- error -- +component "testcomponents.experimental" is at stability level "experimental", which is below the minimum allowed stability level "beta" diff --git a/pkg/flow/testdata/import_file/import_file_14.txtar b/pkg/flow/testdata/import_file/import_file_14.txtar new file mode 100644 index 0000000000..596d1b321e --- /dev/null +++ b/pkg/flow/testdata/import_file/import_file_14.txtar @@ -0,0 +1,38 @@ +Import module with an unused component that has too low stability level + +-- main.river -- +testcomponents.count "inc" { + frequency = "10ms" + max = 10 +} + +import.file "testImport" { + filename = "module.river" +} + +testImport.a "cc" { + input = testcomponents.count.inc.count +} + +testcomponents.summation "sum" { + input = testImport.a.cc.output +} + +-- module.river -- + +declare "unused" { + testcomponents.experimental "unused" {} +} + +declare "a" { + argument "input" {} + + testcomponents.passthrough "pt" { + input = argument.input.value + lag = "1ms" + } + + export "output" { + value = testcomponents.passthrough.pt.output + } +} diff --git a/pkg/flow/testdata/import_file/import_file_15.txtar b/pkg/flow/testdata/import_file/import_file_15.txtar new file mode 100644 index 0000000000..66e628ebe3 --- /dev/null +++ b/pkg/flow/testdata/import_file/import_file_15.txtar @@ -0,0 +1,84 @@ +Import nested module with an unused component with too low stability level + +-- main.river -- +testcomponents.count "inc" { + frequency = "10ms" + max = 10 +} + +import.file "testImport" { + filename = "module.river" +} + +testImport.a "cc" { + input = testcomponents.count.inc.count +} + +testcomponents.summation "sum" { + input = testImport.a.cc.output +} + +-- module.river -- +import.file "testImport" { + filename = "nested_module.river" +} + +declare "a" { + argument "input" {} + + testImport.a "cc" { + input = argument.input.value + } + + export "output" { + value = testImport.a.cc.output + } +} + +-- nested_module.river -- +declare "a" { + argument "input" {} + + testcomponents.passthrough "pt" { + input = argument.input.value + lag = "1ms" + } + + export "output" { + value = testcomponents.passthrough.pt.output + } +} + +-- other_nested_module.river -- +declare "unused" { + testcomponents.experimental "unused" {} +} + +declare "a" { + argument "input" {} + + export "output" { + value = -argument.input.value + } +} + +-- update/module.river -- +import.file "testImport" { + filename = "other_nested_module.river" +} + +declare "unused" { + testcomponents.experimental "unused" {} +} + +declare "a" { + argument "input" {} + + testImport.a "cc" { + input = argument.input.value + } + + export "output" { + value = testImport.a.cc.output + } +}