Skip to content

Commit

Permalink
Dependabot prs/2023 11 15 t162321 (#2488)
Browse files Browse the repository at this point in the history
* Update deps

* Update for factories breaking change

* Bump terraform

* Remove feature gates
  • Loading branch information
bryan-aguilar committed Nov 17, 2023
1 parent c46e130 commit 6822a43
Show file tree
Hide file tree
Showing 19 changed files with 1,384 additions and 1,825 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ jobs:
java-version: '11'

- name: Set up terraform
uses: hashicorp/setup-terraform@v2
uses: hashicorp/setup-terraform@v3
with:
terraform_version: "~1.5"

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/PR-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ jobs:

- name: Set up terraform
if: ${{ needs.changes.outputs.changed == 'true' }}
uses: hashicorp/setup-terraform@v2
uses: hashicorp/setup-terraform@v3
with:
terraform_version: "~1.5"

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/canary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ jobs:
java-version: '11'

- name: Set up terraform
uses: hashicorp/setup-terraform@v2
uses: hashicorp/setup-terraform@v3
with:
terraform_version: "~1.5"

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/perf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ jobs:
java-version: '11'

- name: Set up terraform
uses: hashicorp/setup-terraform@v2
uses: hashicorp/setup-terraform@v3
with:
terraform_version: "~1.5"

Expand Down
8 changes: 1 addition & 7 deletions cmd/awscollector/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,8 @@ func main() {
logFatal(err)
}

factories, err := defaultcomponents.Components()

if err != nil {
logFatal(fmt.Errorf("failed to build components: %w", err))
}

params := otelcol.CollectorSettings{
Factories: factories,
Factories: defaultcomponents.Components,
BuildInfo: info,
LoggingOptions: []zap.Option{logger.WrapCoreOpt()},
ConfigProvider: config.GetConfigProvider(flagSet),
Expand Down
3 changes: 1 addition & 2 deletions cmd/awscollector/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ import (

func TestNewCommandFlagSet(t *testing.T) {
var flagSet *flag.FlagSet
factories, _ := defaultcomponents.Components()
params := otelcol.CollectorSettings{
Factories: factories,
Factories: defaultcomponents.Components,
}

validFlags := []string{"config", "set", "feature-gates"}
Expand Down
386 changes: 190 additions & 196 deletions go.mod

Large diffs are not rendered by default.

950 changes: 387 additions & 563 deletions go.sum

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions pkg/config/config_factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@ func getValidTestConfigPath() string {
return filepath.Join("testdata", "config.yaml")
}
func TestGetCfgFactoryConfig(t *testing.T) {
factories, _ := defaultcomponents.Components()
params := otelcol.CollectorSettings{
Factories: factories,
Factories: defaultcomponents.Components,
}
factories, err := params.Factories()
require.NoError(t, err)

t.Run("test_invalid_path", func(t *testing.T) {
cmd := &cobra.Command{
Expand Down
28 changes: 6 additions & 22 deletions pkg/defaultcomponents/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ import (
"go.opentelemetry.io/collector/extension"
"go.opentelemetry.io/collector/extension/ballastextension"
"go.opentelemetry.io/collector/extension/zpagesextension"
"go.opentelemetry.io/collector/featuregate"
"go.opentelemetry.io/collector/otelcol"
"go.opentelemetry.io/collector/processor"
"go.opentelemetry.io/collector/processor/batchprocessor"
Expand All @@ -74,18 +73,6 @@ import (
"go.uber.org/multierr"
)

var fileLogReceiverFeatureGate = featuregate.GlobalRegistry().MustRegister("adot.receiver.filelog",
featuregate.StageBeta,
featuregate.WithRegisterDescription("Allows for the ADOT Collector to be configured and started with the File Log Receiver"))

var cwlExporterFeatureGate = featuregate.GlobalRegistry().MustRegister("adot.exporter.awscloudwatchlogs",
featuregate.StageBeta,
featuregate.WithRegisterDescription("Allows for the ADOT Collector to be configured and started with the AWS CloudWatch Logs Exporter"))

var fileStorageExtensionFeatureGate = featuregate.GlobalRegistry().MustRegister("adot.extension.file_storage",
featuregate.StageBeta,
featuregate.WithRegisterDescription("Allows for the ADOT Collector to be configured and started with the File Storage Extension"))

// Components register OTel components for ADOT-collector distribution
func Components() (otelcol.Factories, error) {
var errs error
Expand All @@ -97,10 +84,9 @@ func Components() (otelcol.Factories, error) {
sigv4authextension.NewFactory(),
zpagesextension.NewFactory(),
ballastextension.NewFactory(),
filestorage.NewFactory(),
}
if fileStorageExtensionFeatureGate.IsEnabled() {
extensionsList = append(extensionsList, filestorage.NewFactory())
}

extensions, err := extension.MakeFactoryMap(extensionsList...)

if err != nil {
Expand All @@ -117,10 +103,9 @@ func Components() (otelcol.Factories, error) {
jaegerreceiver.NewFactory(),
zipkinreceiver.NewFactory(),
otlpreceiver.NewFactory(),
filelogreceiver.NewFactory(),
}
if fileLogReceiverFeatureGate.IsEnabled() {
receiverList = append(receiverList, filelogreceiver.NewFactory())
}

receivers, err := receiver.MakeFactoryMap(receiverList...)

if err != nil {
Expand Down Expand Up @@ -167,10 +152,9 @@ func Components() (otelcol.Factories, error) {
otlphttpexporter.NewFactory(),
awsxrayexporter.NewFactory(),
loadbalancingexporter.NewFactory(),
awscloudwatchlogsexporter.NewFactory(),
}
if cwlExporterFeatureGate.IsEnabled() {
exporterList = append(exporterList, awscloudwatchlogsexporter.NewFactory())
}

exporters, err := exporter.MakeFactoryMap(exporterList...)

if err != nil {
Expand Down
47 changes: 3 additions & 44 deletions pkg/defaultcomponents/defaults_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
package defaultcomponents

import (
"go.opentelemetry.io/collector/featuregate"
"testing"

"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -61,6 +60,7 @@ func TestComponents(t *testing.T) {
assert.NotNil(t, receivers["awscontainerinsightreceiver"])
assert.NotNil(t, receivers["awsxray"])
assert.NotNil(t, receivers["statsd"])
assert.NotNil(t, exporters["awscloudwatchlogs"])

// core receivers
assert.NotNil(t, receivers["otlp"])
Expand All @@ -69,6 +69,7 @@ func TestComponents(t *testing.T) {
assert.NotNil(t, receivers["zipkin"])
assert.NotNil(t, receivers["jaeger"])
assert.NotNil(t, receivers["kafka"])
assert.NotNil(t, receivers["filelog"])

extensions := factories.Extensions
assert.Len(t, extensions, extensionsCount)
Expand All @@ -82,6 +83,7 @@ func TestComponents(t *testing.T) {
// other extensions
assert.NotNil(t, extensions["pprof"])
assert.NotNil(t, extensions["health_check"])
assert.NotNil(t, extensions["file_storage"])

processors := factories.Processors
assert.Len(t, processors, processorCount)
Expand All @@ -104,47 +106,4 @@ func TestComponents(t *testing.T) {
assert.NotNil(t, processors["tail_sampling"])
assert.NotNil(t, processors["k8sattributes"])

// Ensure that the components behind feature gates are included in stageBeta by default
assert.NotNil(t, receivers["filelog"])
assert.NotNil(t, exporters["awscloudwatchlogs"])
assert.NotNil(t, extensions["file_storage"])
}

// TODO : Modify this test to check the `error` is received when featuregate is in StageStable state.
func TestDisableFeatureGate(t *testing.T) {
testCases := []struct {
featureName string
expectedLen int
}{
{"adot.receiver.filelog", receiversCount - 1},
{"adot.exporter.awscloudwatchlogs", exportersCount - 1},
{"adot.extension.file_storage", extensionsCount - 1},
}

for _, tc := range testCases {
t.Run(tc.featureName, func(t *testing.T) {
err := featuregate.GlobalRegistry().Set(tc.featureName, false)
assert.NoError(t, err)

factories, err := Components()
assert.NoError(t, err)

switch tc.featureName {
case "adot.receiver.filelog":
receivers := factories.Receivers
assert.Len(t, receivers, tc.expectedLen)
assert.Nil(t, receivers["filelog"])

case "adot.exporter.awscloudwatchlogs":
exporters := factories.Exporters
assert.Len(t, exporters, tc.expectedLen)
assert.Nil(t, exporters["awscloudwatchlogs"])

case "adot.extension.file_storage":
extensions := factories.Extensions
assert.Len(t, extensions, tc.expectedLen)
assert.Nil(t, extensions["file_storage"])
}
})
}
}
Loading

0 comments on commit 6822a43

Please sign in to comment.