From e849e2b968573635ea6c26723f2f835287a1eaa3 Mon Sep 17 00:00:00 2001 From: Christian Kruse Date: Thu, 28 Sep 2023 08:14:34 -0700 Subject: [PATCH] remove featuregate Signed-off-by: Christian Kruse --- pkg/receiver/jobreceiver/README.md | 8 -------- pkg/receiver/jobreceiver/go.mod | 4 ++-- pkg/receiver/jobreceiver/receiver_test.go | 22 ---------------------- pkg/receiver/jobreceiver/runner.go | 21 --------------------- 4 files changed, 2 insertions(+), 53 deletions(-) diff --git a/pkg/receiver/jobreceiver/README.md b/pkg/receiver/jobreceiver/README.md index 0dbb9f91bc..db847a9db6 100644 --- a/pkg/receiver/jobreceiver/README.md +++ b/pkg/receiver/jobreceiver/README.md @@ -10,14 +10,6 @@ executable at defined intervals, and propagates the output from that process as log events. In addition, the monitoring job receiver simplifies the process of downloading runtime assets necessary to run a particular monitoring job. -## Feature Gate - -This receiver is currently gated behind a [featuregate][featuregate] -`receiver.monitoringjob.enabled`. To start the collector with monitoringjobs -enabled use the `--feature-gates=receiver.monitoringjob.enabled` flag. - -[featuregate]: https://github.com/open-telemetry/opentelemetry-collector/tree/main/featuregate - ## Configuration | Configuration | Default | Description diff --git a/pkg/receiver/jobreceiver/go.mod b/pkg/receiver/jobreceiver/go.mod index e7807c102f..50571cc256 100644 --- a/pkg/receiver/jobreceiver/go.mod +++ b/pkg/receiver/jobreceiver/go.mod @@ -7,7 +7,7 @@ require ( github.com/stretchr/testify v1.8.4 go.opentelemetry.io/collector/component v0.85.0 go.opentelemetry.io/collector/confmap v0.85.0 - go.opentelemetry.io/collector/featuregate v1.0.0-rcv0014 + go.opentelemetry.io/collector/consumer v0.85.0 go.opentelemetry.io/collector/receiver v0.85.0 go.uber.org/zap v1.25.0 ) @@ -36,9 +36,9 @@ require ( go.opencensus.io v0.24.0 // indirect go.opentelemetry.io/collector v0.85.0 // indirect go.opentelemetry.io/collector/config/configtelemetry v0.85.0 // indirect - go.opentelemetry.io/collector/consumer v0.85.0 // indirect go.opentelemetry.io/collector/exporter v0.85.0 // indirect go.opentelemetry.io/collector/extension v0.85.0 // indirect + go.opentelemetry.io/collector/featuregate v1.0.0-rcv0014 // indirect go.opentelemetry.io/collector/pdata v1.0.0-rcv0014 // indirect go.opentelemetry.io/collector/processor v0.85.0 // indirect go.opentelemetry.io/otel v1.17.0 // indirect diff --git a/pkg/receiver/jobreceiver/receiver_test.go b/pkg/receiver/jobreceiver/receiver_test.go index 713e6c8114..903d1403d3 100644 --- a/pkg/receiver/jobreceiver/receiver_test.go +++ b/pkg/receiver/jobreceiver/receiver_test.go @@ -11,7 +11,6 @@ import ( "github.com/stretchr/testify/require" "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/consumer/consumertest" - "go.opentelemetry.io/collector/featuregate" "go.opentelemetry.io/collector/receiver/receivertest" ) @@ -22,9 +21,6 @@ func TestMain(m *testing.M) { func TestMonitoringJob(t *testing.T) { // basic test - require.NoError(t, featuregate.GlobalRegistry().Set(featureEnabledId, true)) - t.Cleanup(func() { require.NoError(t, featuregate.GlobalRegistry().Set(featureEnabledId, false)) }) - f := NewFactory() cfg := testdataConfigSimple() @@ -43,24 +39,6 @@ func TestMonitoringJob(t *testing.T) { first := sink.AllLogs()[0] firstRecord := first.ResourceLogs().At(0).ScopeLogs().At(0).LogRecords().At(0) assert.Equal(t, "hello world", firstRecord.Body().AsString()) - - t.Run("disabled by feature gate", func(t *testing.T) { - require.NoError(t, featuregate.GlobalRegistry().Set(featureEnabledId, false)) - - f := NewFactory() - cfg := testdataConfigSimple() - - sink := new(consumertest.LogsSink) - - rec, err := f.CreateLogsReceiver(context.Background(), receivertest.NewNopCreateSettings(), cfg, sink) - require.NoError(t, err) - - require.NoError(t, rec.Start(context.Background(), componenttest.NewNopHost())) - // TODO(ck) bleh. - <-time.After(time.Millisecond * 1500) - - assert.Equal(t, 0, sink.LogRecordCount()) - }) } func testdataConfigSimple() *Config { diff --git a/pkg/receiver/jobreceiver/runner.go b/pkg/receiver/jobreceiver/runner.go index 2094265df4..363bcd1683 100644 --- a/pkg/receiver/jobreceiver/runner.go +++ b/pkg/receiver/jobreceiver/runner.go @@ -9,33 +9,12 @@ import ( "github.com/SumoLogic/sumologic-otel-collector/pkg/receiver/jobreceiver/command" "github.com/SumoLogic/sumologic-otel-collector/pkg/receiver/jobreceiver/output/consumer" "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/operator" - "go.opentelemetry.io/collector/featuregate" "go.uber.org/zap" ) -const ( - featureEnabledId = "receiver.monitoringjob.enabled" - featureEnabledStage = featuregate.StageAlpha - featureEnabledDescription = "When enabled, the collector will schedule monitoring jobs." -) - -var enabledGate *featuregate.Gate - -func init() { - enabledGate = featuregate.GlobalRegistry().MustRegister( - featureEnabledId, - featureEnabledStage, - featuregate.WithRegisterDescription(featureEnabledDescription), - ) -} - // Build returns the job runner, the process responsible for scheduling and // running commands and piping their output to the output consumer. func (c Config) Build(logger *zap.SugaredLogger, out consumer.Interface) (builder.JobRunner, error) { - if !enabledGate.IsEnabled() { - logger.Warn("monitoringjob feature is not enabled, will not run.") - return &nopRunner{}, nil - } return &runner{ exec: c.Exec, schedule: c.Schedule,