Skip to content

Commit

Permalink
[Release/v0.39.x] - Add third Party components behind featuregate (#2735
Browse files Browse the repository at this point in the history
)

* Initial commit to feature gate

* Default tests for feature gate Beta, changes for splunk_hec exporter

* Remove deprecated configProvider setting

* Add github issue link

* Vendor file changes

* Revert vendor changes and splunkhec, Modify featuregate to alpha

* Bump version in workflows to 1.22.3 go

* modify description
  • Loading branch information
vasireddy99 authored May 9, 2024
1 parent aba0925 commit fb02e65
Show file tree
Hide file tree
Showing 13 changed files with 123 additions and 42 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ env:
DDB_TABLE_NAME: BatchTestCache
MAX_JOBS: 110
BATCH_INCLUDED_SERVICES: EKS,ECS,EC2,EKS_ARM64,EKS_FARGATE
GO_VERSION: ~1.22.2
GO_VERSION: ~1.22.3


concurrency:
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 @@ -25,7 +25,7 @@ env:
IMAGE_NAME: aws-otel-collector
PACKAGING_ROOT: build/packages
TESTING_FRAMEWORK_REPO: aws-observability/aws-otel-test-framework
GO_VERSION: ~1.22.2
GO_VERSION: ~1.22.3

concurrency:
group: pr-build-${{ github.event.pull_request.number }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/aws-resources-clean.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ on:
default: "3"
env:
DAYS_TO_KEEP: 3
GO_VERSION: ~1.22.2
GO_VERSION: ~1.22.3

permissions:
id-token: write
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/canary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v5
with:
go-version: '~1.22.2'
go-version: '~1.22.3'
cache-dependency-path: testing-framework/cmd/aotutil/go.sum
- name: Build aotutil
run: cd testing-framework/cmd/aotutil && make build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/perf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ env:
COMMIT_USER: Github Actions
COMMIT_EMAIL: [email protected]
TESTING_FRAMEWORK_REPO: aws-observability/aws-otel-test-framework
GO_VERSION: ~1.22.2
GO_VERSION: ~1.22.3

permissions:
id-token: write
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/prod-image-mirror.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v5
with:
go-version: ~1.22.2
go-version: ~1.22.3

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
Expand Down
11 changes: 3 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,9 @@ Use the community resources below for getting help with the ADOT Collector.
* If you think you may have found a bug, open a [bug report](https://github.com/aws-observability/aws-otel-collector/issues/new?template=bug_report.md).
* For contributing guidelines, refer to [CONTRIBUTING.md](CONTRIBUTING.md).

### Notice: ADOT Collector v0.35.0 Breaking Change
Users of the `statsd` receiver, please refer to GitHub Issue - [Warning: StatsD Receiver → EMF Exporter Metric Pipeline Breaking Change](https://github.com/aws-observability/aws-otel-collector/issues/2249)
for information on a breaking change.

### Notices: ADOT Collector v0.35.0 Breaking Changes
* Users of the 'awscontainerinsightreceiver', please refer to the GitHub Issue - [Warning: Container Image Default User Change → Important consideration for AWSContainerInsightReceiver](https://github.com/aws-observability/aws-otel-collector/issues/2317) for more information on an upcoming breaking change.
* Users of the `prometheus` or `prometheusremotewrite` exporters please refer to the GitHub Issue [Warning: ADOT Collector v0.35.0 breaking change](https://github.com/aws-observability/aws-otel-collector/issues/2367)
for information on an upcoming breaking change.
### Notice: ADOT Collector v0.41.0 Breaking Changes
* Users of the `datadog`, `logzio`, `sapm`, `signalfx` exporter components. please refer to [Attention: ADOT Collector v0.41.0 breaking changes - third party exporters deprecation](https://github.com/aws-observability/aws-otel-collector/issues/2734)
for more information on an upcoming breaking change .

#### ADOT Collector Built-in Components

Expand Down
13 changes: 9 additions & 4 deletions cmd/awscollector/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ func main() {
log.Printf("found no extra config, skip it, err: %v", err)
}

// TODO : Remove after v0.41.0 release
log.Printf("attn: users of the `datadog`, `logzio`, `sapm`, `signalfx` exporter components. please refer to " +
"https://github.com/aws-observability/aws-otel-collector/issues/2734 in regards to an ADOT Collector v0.41.0 " +
"breaking change")

logger.SetupErrorLogger()

// set the collector config from extracfg file
Expand All @@ -71,10 +76,10 @@ func main() {
}

params := otelcol.CollectorSettings{
Factories: defaultcomponents.Components,
BuildInfo: info,
LoggingOptions: []zap.Option{logger.WrapCoreOpt()},
ConfigProvider: config.GetConfigProvider(flagSet),
Factories: defaultcomponents.Components,
BuildInfo: info,
LoggingOptions: []zap.Option{logger.WrapCoreOpt()},
ConfigProviderSettings: config.GetConfigProviderSettings(flagSet),
}

if err = run(params, flagSet); err != nil {
Expand Down
3 changes: 2 additions & 1 deletion docs/releases/v0.39.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
**Merged pull requests:**

- Bump OTel collector to `v0.98.0` [\#2724](https://github.com/aws-observability/aws-otel-collector/pull/2724) ([vasireddy99](https://github.com/vasireddy99))

- Revert Signalfx exporter commit for send_otlp_histograms [\#2729](https://github.com/aws-observability/aws-otel-collector/pull/2729) ([vasireddy99](https://github.com/vasireddy99))
- Add third Party components behind featuregate [\#2735](https://github.com/aws-observability/aws-otel-collector/pull/2735) ([vasireddy99](https://github.com/vasireddy99))

\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
14 changes: 3 additions & 11 deletions pkg/config/config_factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ package config

import (
"flag"
"log"
"os"

"github.com/open-telemetry/opentelemetry-collector-contrib/confmap/provider/s3provider"
Expand All @@ -35,7 +34,7 @@ const (
envKey = "AOT_CONFIG_CONTENT"
)

func GetConfigProvider(flags *flag.FlagSet) otelcol.ConfigProvider {
func GetConfigProviderSettings(flags *flag.FlagSet) otelcol.ConfigProviderSettings {
// aws-otel-collector supports loading yaml config from Env Var
// including SSM parameter store for ECS use case
loc := getConfigFlag(flags)
Expand All @@ -59,20 +58,13 @@ func GetConfigProvider(flags *flag.FlagSet) otelcol.ConfigProvider {
}

// create Config Provider Settings
settings := otelcol.ConfigProviderSettings{
configProviderSettings := otelcol.ConfigProviderSettings{
ResolverSettings: confmap.ResolverSettings{
URIs: loc,
Providers: mapProviders,
Converters: []confmap.Converter{expandconverter.New(confmap.ConverterSettings{})},
},
}

// get New config Provider
config_provider, err := otelcol.NewConfigProvider(settings)

if err != nil {
log.Panicf("Err on creating Config Provider: %v\n", err)
}

return config_provider
return configProviderSettings
}
22 changes: 18 additions & 4 deletions pkg/config/config_factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package config
import (
"context"
"fmt"
"log"
"os"
"path/filepath"
"testing"
Expand Down Expand Up @@ -55,7 +56,11 @@ func TestGetCfgFactoryConfig(t *testing.T) {
"--config=invalid-path/otelcol-config.yaml",
})
require.NoError(t, err)
provider := GetConfigProvider(flagSet)

provider, err := otelcol.NewConfigProvider(GetConfigProviderSettings(flagSet))
if err != nil {
log.Panicf("Err on creating Config Provider: %v\n", err)
}
_, err = provider.Get(context.Background(), factories)
require.Error(t, err)
})
Expand All @@ -76,7 +81,10 @@ func TestGetCfgFactoryConfig(t *testing.T) {
fmt.Sprintf("--config=%s", getValidTestConfigPath()),
})
require.NoError(t, err)
provider := GetConfigProvider(flagSet)
provider, err := otelcol.NewConfigProvider(GetConfigProviderSettings(flagSet))
if err != nil {
log.Panicf("Err on creating Config Provider: %v\n", err)
}
cfg, err := provider.Get(context.Background(), factories)
require.NoError(t, err)
require.NotNil(t, cfg)
Expand All @@ -97,7 +105,10 @@ func TestGetCfgFactoryConfig(t *testing.T) {
fmt.Sprintf("--config=%s", getValidTestConfigPath()),
})
require.NoError(t, err)
provider := GetConfigProvider(flagSet)
provider, err := otelcol.NewConfigProvider(GetConfigProviderSettings(flagSet))
if err != nil {
log.Panicf("Err on creating Config Provider: %v\n", err)
}
cfg, err := provider.Get(context.Background(), factories)
require.NoError(t, err)
require.NotNil(t, cfg)
Expand All @@ -114,7 +125,10 @@ func TestGetMapProviderContainer(t *testing.T) {
t.Setenv(envKey, "extensions:\n health_check:\n pprof:\n endpoint: '${PPROF_ENDPOINT}'\nreceivers:\n otlp:\n protocols:\n grpc:\n endpoint: 0.0.0.0:4317\nprocessors:\n batch:\nexporters:\n logging:\n loglevel: debug\n awsxray:\n local_mode: true\n region: 'us-west-2'\n awsemf:\n region: 'us-west-2'\nservice:\n pipelines:\n traces:\n receivers: [otlp]\n exporters: [logging,awsxray]\n metrics:\n receivers: [otlp]\n exporters: [awsemf]\n extensions: [pprof]")

factories, _ := defaultcomponents.Components()
provider := GetConfigProvider(Flags(featuregate.NewRegistry()))
provider, err := otelcol.NewConfigProvider(GetConfigProviderSettings(Flags(featuregate.NewRegistry())))
if err != nil {
log.Panicf("Err on creating Config Provider: %v\n", err)
}
cfg, err := provider.Get(context.Background(), factories)
require.NoError(t, err)
require.NotNil(t, cfg)
Expand Down
33 changes: 29 additions & 4 deletions pkg/defaultcomponents/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ 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 @@ -72,6 +73,22 @@ import (
"go.uber.org/multierr"
)

var datadogExporterFeatureGateDeprecation = featuregate.GlobalRegistry().MustRegister("adot.exporter.datadogexporter.deprecation",
featuregate.StageAlpha,
featuregate.WithRegisterDescription("Removes the Datadog exporter from the set of configurable exporters "))

var logzioExporterFeatureGateDeprecation = featuregate.GlobalRegistry().MustRegister("adot.exporter.logzioexporter.deprecation",
featuregate.StageAlpha,
featuregate.WithRegisterDescription("Removes the Logzio Exporter from the set of configurable exporters "))

var sapmExporterFeatureGateDeprecation = featuregate.GlobalRegistry().MustRegister("adot.exporter.sapmexporter.deprecation",
featuregate.StageAlpha,
featuregate.WithRegisterDescription("Removes the SAPM Exporter from the set of configurable exporters"))

var signalfxExporterFeatureGateDeprecation = featuregate.GlobalRegistry().MustRegister("adot.exporter.signalfxexporter.deprecation",
featuregate.StageAlpha,
featuregate.WithRegisterDescription("Removes the SignalFx Metrics Exporter from the set of configurable exporters"))

// Components register OTel components for ADOT-collector distribution
func Components() (otelcol.Factories, error) {
var errs error
Expand Down Expand Up @@ -141,17 +158,25 @@ func Components() (otelcol.Factories, error) {
prometheusexporter.NewFactory(),
fileexporter.NewFactory(),
kafkaexporter.NewFactory(),
sapmexporter.NewFactory(),
signalfxexporter.NewFactory(),
datadogexporter.NewFactory(),
logzioexporter.NewFactory(),
loggingexporter.NewFactory(),
otlpexporter.NewFactory(),
otlphttpexporter.NewFactory(),
awsxrayexporter.NewFactory(),
loadbalancingexporter.NewFactory(),
awscloudwatchlogsexporter.NewFactory(),
}
if !datadogExporterFeatureGateDeprecation.IsEnabled() {
exporterList = append(exporterList, datadogexporter.NewFactory())
}
if !logzioExporterFeatureGateDeprecation.IsEnabled() {
exporterList = append(exporterList, logzioexporter.NewFactory())
}
if !sapmExporterFeatureGateDeprecation.IsEnabled() {
exporterList = append(exporterList, sapmexporter.NewFactory())
}
if !signalfxExporterFeatureGateDeprecation.IsEnabled() {
exporterList = append(exporterList, signalfxexporter.NewFactory())
}

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

Expand Down
57 changes: 53 additions & 4 deletions pkg/defaultcomponents/defaults_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package defaultcomponents

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

"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -44,11 +45,7 @@ func TestComponents(t *testing.T) {
assert.NotNil(t, exporters[component.MustNewType("otlphttp")])
// other exporters
assert.NotNil(t, exporters[component.MustNewType("file")])
assert.NotNil(t, exporters[component.MustNewType("datadog")])
assert.NotNil(t, exporters[component.MustNewType("prometheus")])
assert.NotNil(t, exporters[component.MustNewType("sapm")])
assert.NotNil(t, exporters[component.MustNewType("signalfx")])
assert.NotNil(t, exporters[component.MustNewType("logzio")])
assert.NotNil(t, exporters[component.MustNewType("prometheusremotewrite")])
assert.NotNil(t, exporters[component.MustNewType("kafka")])
assert.NotNil(t, exporters[component.MustNewType("loadbalancing")])
Expand Down Expand Up @@ -105,4 +102,56 @@ func TestComponents(t *testing.T) {
assert.NotNil(t, processors[component.MustNewType("groupbytrace")])
assert.NotNil(t, processors[component.MustNewType("tail_sampling")])
assert.NotNil(t, processors[component.MustNewType("k8sattributes")])

// Ensure that the components behind feature gates are included
assert.NotNil(t, exporters[component.MustNewType("datadog")])
assert.NotNil(t, exporters[component.MustNewType("sapm")])
assert.NotNil(t, exporters[component.MustNewType("signalfx")])
assert.NotNil(t, exporters[component.MustNewType("logzio")])
}

func TestEnableFeatureGate(t *testing.T) {

testCases := []struct {
desc string
featureName string
component component.Type
}{
{
desc: "disable datadog exporter",
featureName: "adot.exporter.datadogexporter.deprecation",
component: component.MustNewType("datadog"),
},
{
desc: "disable logzio exporter",
featureName: "adot.exporter.logzioexporter.deprecation",
component: component.MustNewType("logzio"),
},
{
desc: "disable sapm exporter",
featureName: "adot.exporter.sapmexporter.deprecation",
component: component.MustNewType("sapm"),
},
{
desc: "disable signalfx exporter",
featureName: "adot.exporter.signalfxexporter.deprecation",
component: component.MustNewType("signalfx"),
},
}
expectedLen := exportersCount

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

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

exporters := factories.Exporters
assert.Len(t, exporters, expectedLen)
assert.Nil(t, exporters[tc.component])
})
}
}

0 comments on commit fb02e65

Please sign in to comment.