Skip to content

Commit

Permalink
[exporter/googlecloud] Graduate and remove exporter.googlecloud.OTLPD…
Browse files Browse the repository at this point in the history
…irect feature-gate (open-telemetry#17191)

The feature-gate was graduated to beta in v0.50.0. We have provided plenty of time to transition, and have addressed issues that have arisen during the process.
  • Loading branch information
dashpole authored Dec 22, 2022
1 parent cedc744 commit 0f57f29
Show file tree
Hide file tree
Showing 20 changed files with 39 additions and 1,485 deletions.
16 changes: 16 additions & 0 deletions .chloggen/graduate_gcp_otlpdirect.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: breaking

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: googlecloudexporter

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Graduate exporter.googlecloud.OTLPDirect feature-gate to GA, and remove legacy exporter.

# One or more tracking issues related to the change
issues: [17192]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:
1 change: 0 additions & 1 deletion cmd/configschema/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ require (
code.cloudfoundry.org/go-loggregator v7.4.0+incompatible // indirect
code.cloudfoundry.org/rfc5424 v0.0.0-20201103192249-000122071b78 // indirect
contrib.go.opencensus.io/exporter/prometheus v0.4.2 // indirect
contrib.go.opencensus.io/exporter/stackdriver v0.13.14 // indirect
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect
github.com/99designs/keyring v1.2.1 // indirect
github.com/AthenZ/athenz v1.10.39 // indirect
Expand Down
2 changes: 0 additions & 2 deletions cmd/configschema/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion cmd/otelcontribcol/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ require (
code.cloudfoundry.org/go-loggregator v7.4.0+incompatible // indirect
code.cloudfoundry.org/rfc5424 v0.0.0-20201103192249-000122071b78 // indirect
contrib.go.opencensus.io/exporter/prometheus v0.4.2 // indirect
contrib.go.opencensus.io/exporter/stackdriver v0.13.14 // indirect
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect
github.com/99designs/keyring v1.2.1 // indirect
github.com/AthenZ/athenz v1.10.39 // indirect
Expand Down
2 changes: 0 additions & 2 deletions cmd/otelcontribcol/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 0 additions & 14 deletions exporter/googlecloudexporter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -314,19 +314,5 @@ By default, the exporter sends telemetry to the project specified by `project` i

See the [Collector feature gates](https://github.com/open-telemetry/opentelemetry-collector/blob/main/featuregate/README.md#collector-feature-gates) for an overview of feature gates in the collector.

**BETA**: `exporter.googlecloud.OTLPDirect`

The `exporter.googlecloud.OTLPDirect` is enabled by default starting in v0.50.0, and can be disabled via `--feature-gates=-exporter.googlecloud.OTLPDirect`. The new googlecloud exporter translates pdata directly to google cloud monitoring's types, rather than first translating to opencensus. See the [Breaking Changes documentation](https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/blob/main/exporter/collector/breaking-changes.md#breaking-changes-vs-old-googlecloud-exporter) for breaking changes that will occur as a result of this feature.
If you are broken by changes described there, or have encountered an issue with the new implementation, please open an issue [here](https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/issues/new)
If you disable the feature-gate, you can continue to set removed legacy configuration options:
- `endpoint` (optional): Endpoint where data is going to be sent to.
- `use_insecure` (optional): If true. use gRPC as their communication transport. Only has effect if Endpoint is not "".
- `timeout` (optional): Timeout for all API calls. If not set, defaults to 12 seconds.
- `resource_mappings` (optional): ResourceMapping defines mapping of resources from source (OpenCensus) to target (Google Cloud).
- `label_mappings` (optional): Optional flag signals whether we can proceed with transformation if a label is missing in the resource.
[beta]:https://github.com/open-telemetry/opentelemetry-collector#beta
[contrib]:https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol-contrib
12 changes: 0 additions & 12 deletions exporter/googlecloudexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,9 @@ import (
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/confmap/confmaptest"
"go.opentelemetry.io/collector/exporter/exporterhelper"
"go.opentelemetry.io/collector/featuregate"
)

// setPdataFeatureGateForTest changes the pdata feature gate during a test.
// usage: defer SetPdataFeatureGateForTest(true)()
func setPdataFeatureGateForTest(t testing.TB, enabled bool) func() {
originalValue := featuregate.GetRegistry().IsEnabled(pdataExporterFeatureGate)
require.NoError(t, featuregate.GetRegistry().Apply(map[string]bool{pdataExporterFeatureGate: enabled}))
return func() {
require.NoError(t, featuregate.GetRegistry().Apply(map[string]bool{pdataExporterFeatureGate: originalValue}))
}
}

func TestLoadConfig(t *testing.T) {
defer setPdataFeatureGateForTest(t, true)()
cm, err := confmaptest.LoadConf(filepath.Join("testdata", "config.yaml"))
require.NoError(t, err)
factory := NewFactory()
Expand Down
41 changes: 4 additions & 37 deletions exporter/googlecloudexporter/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,16 @@ import (
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/exporter"
"go.opentelemetry.io/collector/exporter/exporterhelper"
"go.opentelemetry.io/collector/featuregate"
)

const (
// The value of "type" key in configuration.
typeStr = "googlecloud"
// The stability level of the exporter.
stability = component.StabilityLevelBeta
defaultTimeout = 12 * time.Second // Consistent with Cloud Monitoring's timeout
pdataExporterFeatureGate = "exporter.googlecloud.OTLPDirect"
stability = component.StabilityLevelBeta
defaultTimeout = 12 * time.Second // Consistent with Cloud Monitoring's timeout
)

func init() {
featuregate.GetRegistry().MustRegisterID(
pdataExporterFeatureGate,
featuregate.StageBeta,
featuregate.WithRegisterDescription("When enabled, the googlecloud exporter translates pdata directly to google cloud monitoring's types, rather than first translating to opencensus."),
featuregate.WithRegisterReferenceURL("https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/7132"),
)
}

// NewFactory creates a factory for the googlecloud exporter
func NewFactory() exporter.Factory {
return exporter.NewFactory(
Expand All @@ -56,14 +45,6 @@ func NewFactory() exporter.Factory {

// createDefaultConfig creates the default configuration for exporter.
func createDefaultConfig() component.Config {
if !featuregate.GetRegistry().IsEnabled(pdataExporterFeatureGate) {
return &LegacyConfig{
TimeoutSettings: exporterhelper.TimeoutSettings{Timeout: defaultTimeout},
RetrySettings: exporterhelper.NewDefaultRetrySettings(),
QueueSettings: exporterhelper.NewDefaultQueueSettings(),
UserAgent: "opentelemetry-collector-contrib {{version}}",
}
}
return &Config{
TimeoutSettings: exporterhelper.TimeoutSettings{Timeout: defaultTimeout},
RetrySettings: exporterhelper.NewDefaultRetrySettings(),
Expand All @@ -76,12 +57,7 @@ func createLogsExporter(
ctx context.Context,
params exporter.CreateSettings,
cfg component.Config) (exporter.Logs, error) {
var eCfg *Config
if !featuregate.GetRegistry().IsEnabled(pdataExporterFeatureGate) {
eCfg = toNewConfig(cfg.(*LegacyConfig))
} else {
eCfg = cfg.(*Config)
}
eCfg := cfg.(*Config)
logsExporter, err := collector.NewGoogleCloudLogsExporter(ctx, eCfg.Config, params.TelemetrySettings.Logger)
if err != nil {
return nil, err
Expand All @@ -104,12 +80,7 @@ func createTracesExporter(
ctx context.Context,
params exporter.CreateSettings,
cfg component.Config) (exporter.Traces, error) {
var eCfg *Config
if !featuregate.GetRegistry().IsEnabled(pdataExporterFeatureGate) {
eCfg = toNewConfig(cfg.(*LegacyConfig))
} else {
eCfg = cfg.(*Config)
}
eCfg := cfg.(*Config)
tExp, err := collector.NewGoogleCloudTracesExporter(ctx, eCfg.Config, params.BuildInfo.Version, eCfg.Timeout)
if err != nil {
return nil, err
Expand All @@ -132,10 +103,6 @@ func createMetricsExporter(
ctx context.Context,
params exporter.CreateSettings,
cfg component.Config) (exporter.Metrics, error) {
if !featuregate.GetRegistry().IsEnabled(pdataExporterFeatureGate) {
eCfg := cfg.(*LegacyConfig)
return newLegacyGoogleCloudMetricsExporter(eCfg, params)
}
eCfg := cfg.(*Config)
mExp, err := collector.NewGoogleCloudMetricsExporter(ctx, eCfg.Config, params.TelemetrySettings.Logger, params.BuildInfo.Version, eCfg.Timeout)
if err != nil {
Expand Down
2 changes: 0 additions & 2 deletions exporter/googlecloudexporter/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ func TestCreateDefaultConfig(t *testing.T) {
}

func TestCreateExporter(t *testing.T) {
defer setPdataFeatureGateForTest(t, true)()
if os.Getenv("GOOGLE_APPLICATION_CREDENTIALS") == "" {
t.Skip("Default credentials not set, skip creating Google Cloud exporter")
}
Expand All @@ -52,7 +51,6 @@ func TestCreateExporter(t *testing.T) {
}

func TestCreateLegacyExporter(t *testing.T) {
defer setPdataFeatureGateForTest(t, false)()
if os.Getenv("GOOGLE_APPLICATION_CREDENTIALS") == "" {
t.Skip("Default credentials not set, skip creating Google Cloud exporter")
}
Expand Down
55 changes: 13 additions & 42 deletions exporter/googlecloudexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,11 @@ module github.com/open-telemetry/opentelemetry-collector-contrib/exporter/google
go 1.18

require (
cloud.google.com/go/monitoring v1.9.1
contrib.go.opencensus.io/exporter/stackdriver v0.13.14
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/collector v0.34.3-0.20221202192616-0186b89ba914
github.com/census-instrumentation/opencensus-proto v0.4.1
github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.68.0
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/opencensus v0.68.0
github.com/stretchr/testify v1.8.1
go.opencensus.io v0.24.0
go.opentelemetry.io/collector v0.68.0
go.opentelemetry.io/collector/component v0.68.0
go.opentelemetry.io/collector/confmap v0.68.0
go.opentelemetry.io/collector/featuregate v0.68.0
go.opentelemetry.io/collector/pdata v1.0.0-rc2
go.opentelemetry.io/collector/semconv v0.68.0
google.golang.org/api v0.105.0
google.golang.org/genproto v0.0.0-20221206210731-b1a01be3a5f6
google.golang.org/grpc v1.51.0
google.golang.org/protobuf v1.28.1
)

require (
Expand All @@ -29,71 +16,55 @@ require (
cloud.google.com/go/compute/metadata v0.2.3 // indirect
cloud.google.com/go/logging v1.6.1 // indirect
cloud.google.com/go/longrunning v0.3.0 // indirect
cloud.google.com/go/monitoring v1.9.1 // indirect
cloud.google.com/go/trace v1.4.0 // indirect
contrib.go.opencensus.io/exporter/prometheus v0.4.2 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/trace v1.10.2 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.34.3-0.20221202192616-0186b89ba914 // indirect
github.com/aws/aws-sdk-go v1.44.163 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cenkalti/backoff/v4 v4.2.0 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/go-kit/log v0.2.1 // indirect
github.com/go-logfmt/logfmt v0.5.1 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.0 // indirect
github.com/googleapis/gax-go/v2 v2.7.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.14.0 // indirect
github.com/inconshreveable/mousetrap v1.0.1 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/knadh/koanf v1.4.4 // indirect
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
github.com/prometheus/client_golang v1.14.0 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.39.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
github.com/prometheus/prometheus v0.40.7 // indirect
github.com/prometheus/statsd_exporter v0.22.7 // indirect
github.com/shirou/gopsutil/v3 v3.22.10 // indirect
github.com/spf13/cobra v1.6.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/tklauser/go-sysconf v0.3.11 // indirect
github.com/tklauser/numcpus v0.6.0 // indirect
github.com/yusufpapurcu/wmi v1.2.2 // indirect
github.com/rogpeppe/go-internal v1.9.0 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/collector/consumer v0.68.0 // indirect
go.opentelemetry.io/contrib/propagators/b3 v1.12.0 // indirect
go.opentelemetry.io/collector/featuregate v0.68.0 // indirect
go.opentelemetry.io/collector/pdata v1.0.0-rc2 // indirect
go.opentelemetry.io/collector/semconv v0.68.0 // indirect
go.opentelemetry.io/otel v1.11.2 // indirect
go.opentelemetry.io/otel/exporters/prometheus v0.34.0 // indirect
go.opentelemetry.io/otel/metric v0.34.0 // indirect
go.opentelemetry.io/otel/sdk v1.11.2 // indirect
go.opentelemetry.io/otel/sdk/metric v0.34.0 // indirect
go.opentelemetry.io/otel/trace v1.11.2 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/goleak v1.2.0 // indirect
go.uber.org/multierr v1.9.0 // indirect
go.uber.org/zap v1.24.0 // indirect
golang.org/x/net v0.4.0 // indirect
golang.org/x/oauth2 v0.3.0 // indirect
golang.org/x/sync v0.1.0 // indirect
golang.org/x/sys v0.3.0 // indirect
golang.org/x/text v0.5.0 // indirect
google.golang.org/api v0.105.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
google.golang.org/genproto v0.0.0-20221206210731-b1a01be3a5f6 // indirect
google.golang.org/grpc v1.51.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

Expand Down
Loading

0 comments on commit 0f57f29

Please sign in to comment.