From 5147353e42bdcfe7f6aec054f2f8419ce360a01e Mon Sep 17 00:00:00 2001 From: Michael Aaron Safyan Date: Wed, 23 Oct 2024 15:45:53 -0400 Subject: [PATCH 1/8] Create a skeleton for the 'blobuploadconnector'. --- .chloggen/blobuploadconnector.yaml | 6 + connector/blobuploadconnector/Makefile | 1 + connector/blobuploadconnector/README.md | 84 +++++++++++ connector/blobuploadconnector/config.go | 22 +++ .../blobuploadconnector/config_common.go | 7 + .../blobuploadconnector/config_common_test.go | 4 + connector/blobuploadconnector/config_logs.go | 7 + .../blobuploadconnector/config_logs_test.go | 4 + connector/blobuploadconnector/config_test.go | 16 ++ .../blobuploadconnector/config_traces.go | 7 + .../blobuploadconnector/config_traces_test.go | 4 + connector/blobuploadconnector/deps.go | 15 ++ connector/blobuploadconnector/doc.go | 6 + connector/blobuploadconnector/factory.go | 34 +++++ .../generated_component_test.go | 80 ++++++++++ .../generated_package_test.go | 12 ++ connector/blobuploadconnector/go.mod | 54 +++++++ connector/blobuploadconnector/go.sum | 138 +++++++++++++++++ .../internal/metadata/generated_status.go | 17 +++ connector/blobuploadconnector/logs.go | 40 +++++ connector/blobuploadconnector/logs_test.go | 4 + connector/blobuploadconnector/metadata.yaml | 21 +++ connector/blobuploadconnector/package_test.go | 141 ++++++++++++++++++ connector/blobuploadconnector/traces.go | 40 +++++ connector/blobuploadconnector/traces_test.go | 4 + 25 files changed, 768 insertions(+) create mode 100644 .chloggen/blobuploadconnector.yaml create mode 100644 connector/blobuploadconnector/Makefile create mode 100644 connector/blobuploadconnector/README.md create mode 100644 connector/blobuploadconnector/config.go create mode 100644 connector/blobuploadconnector/config_common.go create mode 100644 connector/blobuploadconnector/config_common_test.go create mode 100644 connector/blobuploadconnector/config_logs.go create mode 100644 connector/blobuploadconnector/config_logs_test.go create mode 100644 connector/blobuploadconnector/config_test.go create mode 100644 connector/blobuploadconnector/config_traces.go create mode 100644 connector/blobuploadconnector/config_traces_test.go create mode 100644 connector/blobuploadconnector/deps.go create mode 100644 connector/blobuploadconnector/doc.go create mode 100644 connector/blobuploadconnector/factory.go create mode 100644 connector/blobuploadconnector/generated_component_test.go create mode 100644 connector/blobuploadconnector/generated_package_test.go create mode 100644 connector/blobuploadconnector/go.mod create mode 100644 connector/blobuploadconnector/go.sum create mode 100644 connector/blobuploadconnector/internal/metadata/generated_status.go create mode 100644 connector/blobuploadconnector/logs.go create mode 100644 connector/blobuploadconnector/logs_test.go create mode 100644 connector/blobuploadconnector/metadata.yaml create mode 100644 connector/blobuploadconnector/package_test.go create mode 100644 connector/blobuploadconnector/traces.go create mode 100644 connector/blobuploadconnector/traces_test.go diff --git a/.chloggen/blobuploadconnector.yaml b/.chloggen/blobuploadconnector.yaml new file mode 100644 index 000000000000..2cb0f1e2cb35 --- /dev/null +++ b/.chloggen/blobuploadconnector.yaml @@ -0,0 +1,6 @@ +change_type: new_component +component: blobuploadconnector +note: Connector for uploading and replacing pieces of a signal to blob storage +issues: [33737] +subtext: Skeleton implementation at the moment. +change_logs: [] diff --git a/connector/blobuploadconnector/Makefile b/connector/blobuploadconnector/Makefile new file mode 100644 index 000000000000..c1496226e590 --- /dev/null +++ b/connector/blobuploadconnector/Makefile @@ -0,0 +1 @@ +include ../../Makefile.Common \ No newline at end of file diff --git a/connector/blobuploadconnector/README.md b/connector/blobuploadconnector/README.md new file mode 100644 index 000000000000..d565c96076f2 --- /dev/null +++ b/connector/blobuploadconnector/README.md @@ -0,0 +1,84 @@ +# Blob Upload Connector + +## Status + +Under development. + +This code is a skeleton only. Follow implementation at [#33737](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/33737) ("New component: Blob Uploader Connector"). + +## What It Does + +1. Queues an upload for specified pieces of a signal to a configured blob storage destination. +2. Replaces the original data with a reference to where the blob was written. +3. Forwards the modified signal to subsequent pipeline (to be exported per normal). + +## Motivation + +1. Handling overly large pieces of a signal that may be too big for a typical ops backend +2. Handling sensitive information by sending to an alternative system with tighter ACLs + +## Config + +The configuration will look roughly as follows: + +``` +blobuploadconnector: + common: ... + traces: ... + logs: ... +``` + +As shown above, there will be some set of common configuration that applies by default to all signal types. + +Each signal type will have its own config for how it will be processed. + +### Common Config + +The common configuration governs things like how to upload the data: + +``` +blobuploadconnector: + common: + upload: + queue_size: 100 + timeout_nanos: 5000 + ... +``` + +The `queue_size` indicates the maximum number of parallel uploads; the `timeout_nanos` specifies the timeout on uploading. + +### Traces Config + +The traces configuration governs how to match trace spans and span events. It will look roughly as follows: + +``` +blobuploadconnector: + traces: + # matching attributes on spans + attributes: ... + # matching (groups of) span events and their attributes + events: ... + ... +``` + +### Logs Config + +The logs configuration governs how to match logs. It will look roughly as follows: + +``` +blobuploadconnector: + logs: + groups: + - name: ... + match: ... + body: ... + attributes: ... + ... +``` + +Each named group will match logs based on `match`. For matched logs, `attributes` will govern whether/how to upload attributes while `body` will govern whether/how to upload portions of the body. + +## See Also + +- [#1428](https://github.com/open-telemetry/semantic-conventions/issues/1428) - "Seeking input on proposal for 'reference'-type attribute values" +- [#33737](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/33737) - "New component: Blob Uploader Connector" diff --git a/connector/blobuploadconnector/config.go b/connector/blobuploadconnector/config.go new file mode 100644 index 000000000000..d5f9f11f3750 --- /dev/null +++ b/connector/blobuploadconnector/config.go @@ -0,0 +1,22 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package blobuploadconnector + +// Config defines the overall configuration for this component. +type Config struct { + Common *CommonConfig `mapstructure:"common"` + TracesConfig *TracesConfig `mapstructure:"traces"` + LogsConfig *LogsConfig `mapstructure:"logs"` +} + +// NewDefaultConfig instantiates a default, valid config. +func NewDefaultConfig() *Config { + return &Config{} +} + +// Validate ensures that the configuration is valid. +func (c *Config) Validate() error { + // TODO: implement validation in subsequent PRs. + return nil +} diff --git a/connector/blobuploadconnector/config_common.go b/connector/blobuploadconnector/config_common.go new file mode 100644 index 000000000000..a634bd5b46bd --- /dev/null +++ b/connector/blobuploadconnector/config_common.go @@ -0,0 +1,7 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package blobuploadconnector + +// CommonConfig defines configuration that applies to multiple signal types. +type CommonConfig struct{} diff --git a/connector/blobuploadconnector/config_common_test.go b/connector/blobuploadconnector/config_common_test.go new file mode 100644 index 000000000000..750d695177f0 --- /dev/null +++ b/connector/blobuploadconnector/config_common_test.go @@ -0,0 +1,4 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package blobuploadconnector diff --git a/connector/blobuploadconnector/config_logs.go b/connector/blobuploadconnector/config_logs.go new file mode 100644 index 000000000000..093949bcf547 --- /dev/null +++ b/connector/blobuploadconnector/config_logs.go @@ -0,0 +1,7 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package blobuploadconnector + +// LogsConfig defines configuration for the logs signal type. +type LogsConfig struct{} diff --git a/connector/blobuploadconnector/config_logs_test.go b/connector/blobuploadconnector/config_logs_test.go new file mode 100644 index 000000000000..750d695177f0 --- /dev/null +++ b/connector/blobuploadconnector/config_logs_test.go @@ -0,0 +1,4 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package blobuploadconnector diff --git a/connector/blobuploadconnector/config_test.go b/connector/blobuploadconnector/config_test.go new file mode 100644 index 000000000000..215f902e12ba --- /dev/null +++ b/connector/blobuploadconnector/config_test.go @@ -0,0 +1,16 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package blobuploadconnector + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestDefaultConfigIsValid(t *testing.T) { + cfg := NewDefaultConfig() + assert.NotNil(t, cfg) + assert.Nil(t, cfg.Validate()) +} diff --git a/connector/blobuploadconnector/config_traces.go b/connector/blobuploadconnector/config_traces.go new file mode 100644 index 000000000000..aaf3d3993382 --- /dev/null +++ b/connector/blobuploadconnector/config_traces.go @@ -0,0 +1,7 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package blobuploadconnector + +// TracesConfig defines configuration for the traces signal type. +type TracesConfig struct{} diff --git a/connector/blobuploadconnector/config_traces_test.go b/connector/blobuploadconnector/config_traces_test.go new file mode 100644 index 000000000000..750d695177f0 --- /dev/null +++ b/connector/blobuploadconnector/config_traces_test.go @@ -0,0 +1,4 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package blobuploadconnector diff --git a/connector/blobuploadconnector/deps.go b/connector/blobuploadconnector/deps.go new file mode 100644 index 000000000000..d5c65b30f2e6 --- /dev/null +++ b/connector/blobuploadconnector/deps.go @@ -0,0 +1,15 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package blobuploadconnector + +// Deps provides a means of mocking out dependencies in tests. +type Deps interface{} + +// Default implementation of Deps. +type depsImpl struct{} + +// NewDeps provides access to the default, real version of deps. +func NewDeps() Deps { + return &depsImpl{} +} diff --git a/connector/blobuploadconnector/doc.go b/connector/blobuploadconnector/doc.go new file mode 100644 index 000000000000..c678211816ac --- /dev/null +++ b/connector/blobuploadconnector/doc.go @@ -0,0 +1,6 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +//go:generate mdatagen metadata.yaml + +package blobuploadconnector diff --git a/connector/blobuploadconnector/factory.go b/connector/blobuploadconnector/factory.go new file mode 100644 index 000000000000..d5e3afa047c2 --- /dev/null +++ b/connector/blobuploadconnector/factory.go @@ -0,0 +1,34 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package blobuploadconnector + +import ( + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/connector" + + "github.com/open-telemetry/opentelemetry-collector-contrib/connector/blobuploadconnector/internal/metadata" +) + +func createDefaultConfig() component.Config { + return NewDefaultConfig() +} + +// NewFactoryWithDeps instantiates the factory with dependency injection, allowing +// for a more testable interface that allows global functions/objects to be swapped out. +func NewFactoryWithDeps(deps Deps) connector.Factory { + return connector.NewFactory( + metadata.Type, + createDefaultConfig, + connector.WithTracesToTraces( + createTracesToTracesConnector(deps), + metadata.TracesToTracesStability), + connector.WithLogsToLogs( + createLogsToLogsConnector(deps), + metadata.LogsToLogsStability)) +} + +// NewFactory is used by the OTel collector to instantiate this component. +func NewFactory() connector.Factory { + return NewFactoryWithDeps(NewDeps()) +} diff --git a/connector/blobuploadconnector/generated_component_test.go b/connector/blobuploadconnector/generated_component_test.go new file mode 100644 index 000000000000..852b800aaedc --- /dev/null +++ b/connector/blobuploadconnector/generated_component_test.go @@ -0,0 +1,80 @@ +// Code generated by mdatagen. DO NOT EDIT. + +package blobuploadconnector + +import ( + "context" + "testing" + + "github.com/stretchr/testify/require" + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componenttest" + "go.opentelemetry.io/collector/confmap/confmaptest" + "go.opentelemetry.io/collector/connector" + "go.opentelemetry.io/collector/connector/connectortest" + "go.opentelemetry.io/collector/consumer" + "go.opentelemetry.io/collector/consumer/consumertest" + "go.opentelemetry.io/collector/pipeline" +) + +func TestComponentFactoryType(t *testing.T) { + require.Equal(t, "blobuploadconnector", NewFactory().Type().String()) +} + +func TestComponentConfigStruct(t *testing.T) { + require.NoError(t, componenttest.CheckConfigStruct(NewFactory().CreateDefaultConfig())) +} + +func TestComponentLifecycle(t *testing.T) { + factory := NewFactory() + + tests := []struct { + name string + createFn func(ctx context.Context, set connector.Settings, cfg component.Config) (component.Component, error) + }{ + + { + name: "logs_to_logs", + createFn: func(ctx context.Context, set connector.Settings, cfg component.Config) (component.Component, error) { + router := connector.NewLogsRouter(map[pipeline.ID]consumer.Logs{pipeline.NewID(pipeline.SignalLogs): consumertest.NewNop()}) + return factory.CreateLogsToLogs(ctx, set, cfg, router) + }, + }, + + { + name: "traces_to_traces", + createFn: func(ctx context.Context, set connector.Settings, cfg component.Config) (component.Component, error) { + router := connector.NewTracesRouter(map[pipeline.ID]consumer.Traces{pipeline.NewID(pipeline.SignalTraces): consumertest.NewNop()}) + return factory.CreateTracesToTraces(ctx, set, cfg, router) + }, + }, + } + + cm, err := confmaptest.LoadConf("metadata.yaml") + require.NoError(t, err) + cfg := factory.CreateDefaultConfig() + sub, err := cm.Sub("tests::config") + require.NoError(t, err) + require.NoError(t, sub.Unmarshal(&cfg)) + + for _, tt := range tests { + t.Run(tt.name+"-shutdown", func(t *testing.T) { + c, err := tt.createFn(context.Background(), connectortest.NewNopSettings(), cfg) + require.NoError(t, err) + err = c.Shutdown(context.Background()) + require.NoError(t, err) + }) + t.Run(tt.name+"-lifecycle", func(t *testing.T) { + firstConnector, err := tt.createFn(context.Background(), connectortest.NewNopSettings(), cfg) + require.NoError(t, err) + host := componenttest.NewNopHost() + require.NoError(t, err) + require.NoError(t, firstConnector.Start(context.Background(), host)) + require.NoError(t, firstConnector.Shutdown(context.Background())) + secondConnector, err := tt.createFn(context.Background(), connectortest.NewNopSettings(), cfg) + require.NoError(t, err) + require.NoError(t, secondConnector.Start(context.Background(), host)) + require.NoError(t, secondConnector.Shutdown(context.Background())) + }) + } +} diff --git a/connector/blobuploadconnector/generated_package_test.go b/connector/blobuploadconnector/generated_package_test.go new file mode 100644 index 000000000000..46bb83bf07d4 --- /dev/null +++ b/connector/blobuploadconnector/generated_package_test.go @@ -0,0 +1,12 @@ +// Code generated by mdatagen. DO NOT EDIT. + +package blobuploadconnector + +import ( + "go.uber.org/goleak" + "testing" +) + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m, goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start")) +} diff --git a/connector/blobuploadconnector/go.mod b/connector/blobuploadconnector/go.mod new file mode 100644 index 000000000000..5ded36fd58cb --- /dev/null +++ b/connector/blobuploadconnector/go.mod @@ -0,0 +1,54 @@ +module github.com/open-telemetry/opentelemetry-collector-contrib/connector/blobuploadconnector + +go 1.23 + +require ( + github.com/stretchr/testify v1.9.0 + go.opentelemetry.io/collector/component v0.112.0 + go.opentelemetry.io/collector/confmap v1.18.0 + go.opentelemetry.io/collector/connector v0.112.0 + go.opentelemetry.io/collector/connector/connectortest v0.112.0 + go.opentelemetry.io/collector/consumer v0.112.0 + go.opentelemetry.io/collector/consumer/consumertest v0.112.0 + go.opentelemetry.io/collector/pdata v1.18.0 + go.opentelemetry.io/collector/pipeline v0.112.0 + go.uber.org/goleak v1.3.0 +) + +require ( + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/go-logr/logr v1.4.2 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/go-viper/mapstructure/v2 v2.2.1 // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/json-iterator/go v1.1.12 // indirect + github.com/knadh/koanf/maps v0.1.1 // indirect + github.com/knadh/koanf/providers/confmap v0.1.0 // indirect + github.com/knadh/koanf/v2 v2.1.1 // indirect + github.com/mitchellh/copystructure v1.2.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 + go.opentelemetry.io/collector v0.112.0 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.112.0 // indirect + go.opentelemetry.io/collector/connector/connectorprofiles v0.112.0 // indirect + go.opentelemetry.io/collector/consumer/consumerprofiles v0.112.0 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.112.0 // indirect + go.opentelemetry.io/collector/pipeline/pipelineprofiles v0.112.0 // indirect + go.opentelemetry.io/otel v1.31.0 // indirect + go.opentelemetry.io/otel/metric v1.31.0 // indirect + go.opentelemetry.io/otel/sdk v1.31.0 // indirect + go.opentelemetry.io/otel/sdk/metric v1.31.0 // indirect + go.opentelemetry.io/otel/trace v1.31.0 // indirect + go.uber.org/multierr v1.11.0 // indirect + go.uber.org/zap v1.27.0 // indirect + golang.org/x/net v0.28.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.18.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd // indirect + google.golang.org/grpc v1.67.1 // indirect + google.golang.org/protobuf v1.35.1 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/connector/blobuploadconnector/go.sum b/connector/blobuploadconnector/go.sum new file mode 100644 index 000000000000..ec817bc0ee26 --- /dev/null +++ b/connector/blobuploadconnector/go.sum @@ -0,0 +1,138 @@ +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= +github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/go-viper/mapstructure/v2 v2.2.1 h1:ZAaOCxANMuZx5RCeg0mBdEZk7DZasvvZIxtHqx8aGss= +github.com/go-viper/mapstructure/v2 v2.2.1/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/knadh/koanf/maps v0.1.1 h1:G5TjmUh2D7G2YWf5SQQqSiHRJEjaicvU0KpypqB3NIs= +github.com/knadh/koanf/maps v0.1.1/go.mod h1:npD/QZY3V6ghQDdcQzl1W4ICNVTkohC8E73eI2xW4yI= +github.com/knadh/koanf/providers/confmap v0.1.0 h1:gOkxhHkemwG4LezxxN8DMOFopOPghxRVp7JbIvdvqzU= +github.com/knadh/koanf/providers/confmap v0.1.0/go.mod h1:2uLhxQzJnyHKfxG927awZC7+fyHFdQkd697K4MdLnIU= +github.com/knadh/koanf/v2 v2.1.1 h1:/R8eXqasSTsmDCsAyYj+81Wteg8AqrV9CP6gvsTsOmM= +github.com/knadh/koanf/v2 v2.1.1/go.mod h1:4mnTRbZCK+ALuBXHZMjDfG9y714L7TykVnZkXbMU3Es= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= +github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= +github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= +github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= +github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.opentelemetry.io/collector v0.112.0 h1:yyA9hC2FTIRs4T418cQHxgei82oa9uNugFQIeNjRzv0= +go.opentelemetry.io/collector v0.112.0/go.mod h1:AgSN5Wd8mcHaOnBTgo0zdS03E9HuFp2ccKpVRs5YFz8= +go.opentelemetry.io/collector/component v0.112.0 h1:Hw125Tdb427yKkzFx3U/OsfPATYXsbURkc27dn19he8= +go.opentelemetry.io/collector/component v0.112.0/go.mod h1:hV9PEgkNlVAySX+Oo/g7+NcLe234L04kRXw6uGj3VEw= +go.opentelemetry.io/collector/config/configtelemetry v0.112.0 h1:MVBrWJUoqfKrORI38dY8OV0i5d1RRHR/ACIBu9TOcZ8= +go.opentelemetry.io/collector/config/configtelemetry v0.112.0/go.mod h1:R0MBUxjSMVMIhljuDHWIygzzJWQyZHXXWIgQNxcFwhc= +go.opentelemetry.io/collector/confmap v1.18.0 h1:UEOeJY8RW8lZ1O4lzHSGqolS7uzkpXQi5fa8SidKqQg= +go.opentelemetry.io/collector/confmap v1.18.0/go.mod h1:GgNu1ElPGmLn9govqIfjaopvdspw4PJ9KeDtWC4E2Q4= +go.opentelemetry.io/collector/connector v0.112.0 h1:F7nLFJOaQBpowI4WwICm3ws/ua2mmke5zTqYezddLVY= +go.opentelemetry.io/collector/connector v0.112.0/go.mod h1:zr+qW7d3xfhhAiKTDodrO/PWn3w9cTu4nZ9kzPYc8ew= +go.opentelemetry.io/collector/connector/connectorprofiles v0.112.0 h1:jeGUmx1usnzrH/XyT2hhIEsa1ogSe08z1sR2KzV6UFY= +go.opentelemetry.io/collector/connector/connectorprofiles v0.112.0/go.mod h1:j96elpMwsro4TEQSDDvA8ocEl9USiId/vsZQGF9mouI= +go.opentelemetry.io/collector/connector/connectortest v0.112.0 h1:4rKkmqjtjSTYyIpD727zKy1bHxXkET2pbmN5jq2QdVs= +go.opentelemetry.io/collector/connector/connectortest v0.112.0/go.mod h1:PkVWrwvgI58yCiOTI0SPymeruNkrTrIpQ8Gq6lap3n8= +go.opentelemetry.io/collector/consumer v0.112.0 h1:tfO4FpuQ8MsD7AxgslC3tRNVYjd9Xkus34BOExsG4fM= +go.opentelemetry.io/collector/consumer v0.112.0/go.mod h1:ZKSeGvXvaofIlvPrWlARKQpONOmuw6R/yifgYCWHKRw= +go.opentelemetry.io/collector/consumer/consumerprofiles v0.112.0 h1:ym+QxemlbWwfMSUto1hRTfcZeYbj2q8FpMzjk8O+X60= +go.opentelemetry.io/collector/consumer/consumerprofiles v0.112.0/go.mod h1:4PjDUpURFh85R6NLEHrEf/uZjpk4LAYmmOrqu+iZsyE= +go.opentelemetry.io/collector/consumer/consumertest v0.112.0 h1:pGvNH+H4rMygUOql6ynVQim6UFdimTiJ0HRfQL6v0GE= +go.opentelemetry.io/collector/consumer/consumertest v0.112.0/go.mod h1:rfVo0tYt/BaLWw3IaQKVQafjUlMsA5qTkvsSOfFrr9c= +go.opentelemetry.io/collector/pdata v1.18.0 h1:/yg2rO2dxqDM2p6GutsMCxXN6sKlXwyIz/ZYyUPONBg= +go.opentelemetry.io/collector/pdata v1.18.0/go.mod h1:Ox1YVLe87cZDB/TL30i4SUz1cA5s6AM6SpFMfY61ICs= +go.opentelemetry.io/collector/pdata/pprofile v0.112.0 h1:t+LYorcMqZ3sDz5/jp3xU2l5lIhIXuIOOGO4Ef9CG2c= +go.opentelemetry.io/collector/pdata/pprofile v0.112.0/go.mod h1:F2aTCoDzIaxEUK1g92LZvMwradySFMo3ZsAnBIpOdUg= +go.opentelemetry.io/collector/pdata/testdata v0.112.0 h1:7jJzNvRE+CpYrwHbAYwPiN9a/hqmVRlRADJNeDJTvYI= +go.opentelemetry.io/collector/pdata/testdata v0.112.0/go.mod h1:9kO148Qp12B93SSUE52s0QGGV8Nf9RFN2G/PnZx3l+w= +go.opentelemetry.io/collector/pipeline v0.112.0 h1:jqKDdb8k53OLPibvxzX6fmMec0ZHAtqe4p2+cuHclEI= +go.opentelemetry.io/collector/pipeline v0.112.0/go.mod h1:4vOvjVsoYTHVGTbfFwqfnQOSV2K3RKUHofh3jNRc2Mg= +go.opentelemetry.io/collector/pipeline/pipelineprofiles v0.112.0 h1:opXGNrlJAjYRKn2xMWJNr8E9sPDE+hKL//0sE+RMlQI= +go.opentelemetry.io/collector/pipeline/pipelineprofiles v0.112.0/go.mod h1:c9yn4x+vY3G10eLCRuUu/oH7Y8YdE/BsgmLWmfHkaNY= +go.opentelemetry.io/otel v1.31.0 h1:NsJcKPIW0D0H3NgzPDHmo0WW6SptzPdqg/L1zsIm2hY= +go.opentelemetry.io/otel v1.31.0/go.mod h1:O0C14Yl9FgkjqcCZAsE053C13OaddMYr/hz6clDkEJE= +go.opentelemetry.io/otel/metric v1.31.0 h1:FSErL0ATQAmYHUIzSezZibnyVlft1ybhy4ozRPcF2fE= +go.opentelemetry.io/otel/metric v1.31.0/go.mod h1:C3dEloVbLuYoX41KpmAhOqNriGbA+qqH6PQ5E5mUfnY= +go.opentelemetry.io/otel/sdk v1.31.0 h1:xLY3abVHYZ5HSfOg3l2E5LUj2Cwva5Y7yGxnSW9H5Gk= +go.opentelemetry.io/otel/sdk v1.31.0/go.mod h1:TfRbMdhvxIIr/B2N2LQW2S5v9m3gOQ/08KsbbO5BPT0= +go.opentelemetry.io/otel/sdk/metric v1.31.0 h1:i9hxxLJF/9kkvfHppyLL55aW7iIJz4JjxTeYusH7zMc= +go.opentelemetry.io/otel/sdk/metric v1.31.0/go.mod h1:CRInTMVvNhUKgSAMbKyTMxqOBC0zgyxzW55lZzX43Y8= +go.opentelemetry.io/otel/trace v1.31.0 h1:ffjsj1aRouKewfr85U2aGagJ46+MvodynlQ1HYdmJys= +go.opentelemetry.io/otel/trace v1.31.0/go.mod h1:TXZkRk7SM2ZQLtR6eoAWQFIHPvzQ06FJAsO1tJg480A= +go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= +go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= +go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= +go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= +golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd h1:6TEm2ZxXoQmFWFlt1vNxvVOa1Q0dXFQD1m/rYjXmS0E= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E= +google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= +google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= +google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/connector/blobuploadconnector/internal/metadata/generated_status.go b/connector/blobuploadconnector/internal/metadata/generated_status.go new file mode 100644 index 000000000000..45a762cf2146 --- /dev/null +++ b/connector/blobuploadconnector/internal/metadata/generated_status.go @@ -0,0 +1,17 @@ +// Code generated by mdatagen. DO NOT EDIT. + +package metadata + +import ( + "go.opentelemetry.io/collector/component" +) + +var ( + Type = component.MustNewType("blobuploadconnector") + ScopeName = "otelcol/blobuploadconnector" +) + +const ( + TracesToTracesStability = component.StabilityLevelDevelopment + LogsToLogsStability = component.StabilityLevelDevelopment +) diff --git a/connector/blobuploadconnector/logs.go b/connector/blobuploadconnector/logs.go new file mode 100644 index 000000000000..9381a644c585 --- /dev/null +++ b/connector/blobuploadconnector/logs.go @@ -0,0 +1,40 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package blobuploadconnector + +import ( + "context" + + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/connector" + "go.opentelemetry.io/collector/consumer" + + "go.opentelemetry.io/collector/pdata/plog" +) + +type passThroughLogsConnector struct { + nextConsumer consumer.Logs + component.StartFunc + component.ShutdownFunc +} + +func (c *passThroughLogsConnector) ConsumeLogs(ctx context.Context, ld plog.Logs) error { + return c.nextConsumer.ConsumeLogs(ctx, ld) +} + +func (c *passThroughLogsConnector) Capabilities() consumer.Capabilities { + return consumer.Capabilities{MutatesData: false} +} + +func createLogsToLogsConnector(deps Deps) connector.CreateLogsToLogsFunc { + return func( + ctx context.Context, + settings connector.Settings, + config component.Config, + nextConsumer consumer.Logs) (connector.Logs, error) { + // TODO: implement actual, non-pass through implementation when + // there is a config present with a non-empty "logs" config. + return &passThroughLogsConnector{nextConsumer: nextConsumer}, nil + } +} diff --git a/connector/blobuploadconnector/logs_test.go b/connector/blobuploadconnector/logs_test.go new file mode 100644 index 000000000000..750d695177f0 --- /dev/null +++ b/connector/blobuploadconnector/logs_test.go @@ -0,0 +1,4 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package blobuploadconnector diff --git a/connector/blobuploadconnector/metadata.yaml b/connector/blobuploadconnector/metadata.yaml new file mode 100644 index 000000000000..cce3ff0ca72b --- /dev/null +++ b/connector/blobuploadconnector/metadata.yaml @@ -0,0 +1,21 @@ +type: blobuploadconnector +scope_name: otelcol/blobuploadconnector + +status: + class: connector + stability: + # Implementation still in-progress. Please follow along at: + # https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/33737 + development: [traces_to_traces, logs_to_logs] + distributions: [contrib] + codeowners: + active: [michaelsafyan, dashpole] + +tests: + config: + goleak: + skip: false + ignore: + # See https://github.com/census-instrumentation/opencensus-go/issues/1191 for more information. + top: go.opencensus.io/stats/view.(*worker).start + \ No newline at end of file diff --git a/connector/blobuploadconnector/package_test.go b/connector/blobuploadconnector/package_test.go new file mode 100644 index 000000000000..b708d035d7da --- /dev/null +++ b/connector/blobuploadconnector/package_test.go @@ -0,0 +1,141 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package blobuploadconnector + +import ( + "context" + "testing" + + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componenttest" + "go.opentelemetry.io/collector/connector/connectortest" + "go.opentelemetry.io/collector/consumer/consumertest" + "go.opentelemetry.io/collector/pdata/plog" + "go.opentelemetry.io/collector/pdata/ptrace" + + "github.com/stretchr/testify/assert" +) + +func TestNewFactorySucceedsAndReturnsValidResult(t *testing.T) { + f := NewFactory() + assert.NotNil(t, f) + assert.NotNil(t, f.CreateDefaultConfig()) + assert.Equal(t, component.StabilityLevelDevelopment, f.TracesToTracesStability()) + assert.Equal(t, component.StabilityLevelDevelopment, f.LogsToLogsStability()) +} + +func TestNewFactoryDefaultConfigIsValid(t *testing.T) { + f := NewFactory() + assert.NotNil(t, f) + + cfg := f.CreateDefaultConfig() + assert.NotNil(t, cfg) + assert.NoError(t, componenttest.CheckConfigStruct(cfg)) +} + +func TestCanStartUpAndShutDownTracesToTracesWithDefaultConfig(t *testing.T) { + f := NewFactory() + assert.NotNil(t, f) + assert.NotNil(t, f.CreateDefaultConfig()) + + consumer := consumertest.NewNop() + settings := connectortest.NewNopSettings() + cfg := f.CreateDefaultConfig() + createCtx := context.Background() + tracesToTraces, createErr := f.CreateTracesToTraces(createCtx, settings, cfg, consumer) + + assert.Nil(t, createErr) + assert.NotNil(t, tracesToTraces) + + host := componenttest.NewNopHost() + startCtx := context.Background() + startErr := tracesToTraces.Start(startCtx, host) + assert.Nil(t, startErr) + + shutDownCtx := context.Background() + shutDownErr := tracesToTraces.Shutdown(shutDownCtx) + assert.Nil(t, shutDownErr) +} + +func TestCanStartUpAndShutDownLogsToLogsWithDefaultConfig(t *testing.T) { + f := NewFactory() + assert.NotNil(t, f) + assert.NotNil(t, f.CreateDefaultConfig()) + + consumer := consumertest.NewNop() + settings := connectortest.NewNopSettings() + cfg := f.CreateDefaultConfig() + createCtx := context.Background() + logsToLogs, createErr := f.CreateLogsToLogs(createCtx, settings, cfg, consumer) + + assert.Nil(t, createErr) + assert.NotNil(t, logsToLogs) + + host := componenttest.NewNopHost() + startCtx := context.Background() + startErr := logsToLogs.Start(startCtx, host) + assert.Nil(t, startErr) + + shutDownCtx := context.Background() + shutDownErr := logsToLogs.Shutdown(shutDownCtx) + assert.Nil(t, shutDownErr) +} + +func TestCanWriteTracesToTracesWithDefaultConfig(t *testing.T) { + f := NewFactory() + assert.NotNil(t, f) + assert.NotNil(t, f.CreateDefaultConfig()) + + consumer := consumertest.NewNop() + settings := connectortest.NewNopSettings() + cfg := f.CreateDefaultConfig() + createCtx := context.Background() + tracesToTraces, createErr := f.CreateTracesToTraces(createCtx, settings, cfg, consumer) + + assert.Nil(t, createErr) + assert.NotNil(t, tracesToTraces) + + host := componenttest.NewNopHost() + startCtx := context.Background() + startErr := tracesToTraces.Start(startCtx, host) + assert.Nil(t, startErr) + + consumeCtx := context.Background() + dataToConsume := ptrace.NewTraces() + consumeErr := tracesToTraces.ConsumeTraces(consumeCtx, dataToConsume) + assert.Nil(t, consumeErr) + + shutDownCtx := context.Background() + shutDownErr := tracesToTraces.Shutdown(shutDownCtx) + assert.Nil(t, shutDownErr) +} + +func TestCanWriteLogsToLogsWithDefaultConfig(t *testing.T) { + f := NewFactory() + assert.NotNil(t, f) + assert.NotNil(t, f.CreateDefaultConfig()) + + consumer := consumertest.NewNop() + settings := connectortest.NewNopSettings() + cfg := f.CreateDefaultConfig() + createCtx := context.Background() + logsToLogs, createErr := f.CreateLogsToLogs(createCtx, settings, cfg, consumer) + + assert.Nil(t, createErr) + assert.NotNil(t, logsToLogs) + + host := componenttest.NewNopHost() + startCtx := context.Background() + startErr := logsToLogs.Start(startCtx, host) + assert.Nil(t, startErr) + + consumeCtx := context.Background() + dataToConsume := plog.NewLogs() + consumeErr := logsToLogs.ConsumeLogs(consumeCtx, dataToConsume) + assert.Nil(t, consumeErr) + + shutDownCtx := context.Background() + shutDownErr := logsToLogs.Shutdown(shutDownCtx) + assert.Nil(t, shutDownErr) +} diff --git a/connector/blobuploadconnector/traces.go b/connector/blobuploadconnector/traces.go new file mode 100644 index 000000000000..e16146174fd0 --- /dev/null +++ b/connector/blobuploadconnector/traces.go @@ -0,0 +1,40 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package blobuploadconnector + +import ( + "context" + + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/connector" + "go.opentelemetry.io/collector/consumer" + + "go.opentelemetry.io/collector/pdata/ptrace" +) + +type passThroughTracesConnector struct { + nextConsumer consumer.Traces + component.StartFunc + component.ShutdownFunc +} + +func (c *passThroughTracesConnector) ConsumeTraces(ctx context.Context, td ptrace.Traces) error { + return c.nextConsumer.ConsumeTraces(ctx, td) +} + +func (c *passThroughTracesConnector) Capabilities() consumer.Capabilities { + return consumer.Capabilities{MutatesData: false} +} + +func createTracesToTracesConnector(deps Deps) connector.CreateTracesToTracesFunc { + return func( + ctx context.Context, + settings connector.Settings, + config component.Config, + nextConsumer consumer.Traces) (connector.Traces, error) { + // TODO: implement actual, non-pass through implementation when + // there is a config present with a non-empty "traces" config. + return &passThroughTracesConnector{nextConsumer: nextConsumer}, nil + } +} diff --git a/connector/blobuploadconnector/traces_test.go b/connector/blobuploadconnector/traces_test.go new file mode 100644 index 000000000000..750d695177f0 --- /dev/null +++ b/connector/blobuploadconnector/traces_test.go @@ -0,0 +1,4 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package blobuploadconnector From 849cd8a5324f1708678402179edc0c82c9ac640d Mon Sep 17 00:00:00 2001 From: Michael Aaron Safyan Date: Wed, 23 Oct 2024 16:48:40 -0400 Subject: [PATCH 2/8] Add files specified in the CONTRIBUTING.md guide that were omitted in the initial mailing. --- .github/CODEOWNERS | 1 + .github/ISSUE_TEMPLATE/bug_report.yaml | 1 + .github/ISSUE_TEMPLATE/feature_request.yaml | 1 + .github/ISSUE_TEMPLATE/other.yaml | 1 + .github/ISSUE_TEMPLATE/unmaintained.yaml | 1 + cmd/otelcontribcol/builder-config.yaml | 1 + connector/blobuploadconnector/README.md | 3 +++ versions.yaml | 1 + 8 files changed, 10 insertions(+) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 20622d15d474..f7c89966166a 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -25,6 +25,7 @@ confmap/provider/aesprovider/ @open-teleme confmap/provider/s3provider/ @open-telemetry/collector-contrib-approvers @Aneurysm9 confmap/provider/secretsmanagerprovider/ @open-telemetry/collector-contrib-approvers @driverpt @atoulme +connector/blobuploadconnector/ @open-telemetry/collector-contrib-approvers @michaelsafyan @dashpole connector/countconnector/ @open-telemetry/collector-contrib-approvers @djaglowski @jpkrohling connector/datadogconnector/ @open-telemetry/collector-contrib-approvers @mx-psi @dineshg13 @ankitpatel96 connector/exceptionsconnector/ @open-telemetry/collector-contrib-approvers @jpkrohling @marctc diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml index 0433fefe27b2..84bca7e1096c 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yaml +++ b/.github/ISSUE_TEMPLATE/bug_report.yaml @@ -26,6 +26,7 @@ body: - confmap/provider/aesprovider - confmap/provider/s3provider - confmap/provider/secretsmanagerprovider + - connector/blobupload - connector/count - connector/datadog - connector/exceptions diff --git a/.github/ISSUE_TEMPLATE/feature_request.yaml b/.github/ISSUE_TEMPLATE/feature_request.yaml index ae3465dfba4a..87fbff1dd2d4 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yaml +++ b/.github/ISSUE_TEMPLATE/feature_request.yaml @@ -20,6 +20,7 @@ body: - confmap/provider/aesprovider - confmap/provider/s3provider - confmap/provider/secretsmanagerprovider + - connector/blobupload - connector/count - connector/datadog - connector/exceptions diff --git a/.github/ISSUE_TEMPLATE/other.yaml b/.github/ISSUE_TEMPLATE/other.yaml index 183a5e514639..532e0a3a533f 100644 --- a/.github/ISSUE_TEMPLATE/other.yaml +++ b/.github/ISSUE_TEMPLATE/other.yaml @@ -20,6 +20,7 @@ body: - confmap/provider/aesprovider - confmap/provider/s3provider - confmap/provider/secretsmanagerprovider + - connector/blobupload - connector/count - connector/datadog - connector/exceptions diff --git a/.github/ISSUE_TEMPLATE/unmaintained.yaml b/.github/ISSUE_TEMPLATE/unmaintained.yaml index 2ecfeb2eccd4..40806f726eb4 100644 --- a/.github/ISSUE_TEMPLATE/unmaintained.yaml +++ b/.github/ISSUE_TEMPLATE/unmaintained.yaml @@ -25,6 +25,7 @@ body: - confmap/provider/aesprovider - confmap/provider/s3provider - confmap/provider/secretsmanagerprovider + - connector/blobupload - connector/count - connector/datadog - connector/exceptions diff --git a/cmd/otelcontribcol/builder-config.yaml b/cmd/otelcontribcol/builder-config.yaml index 0b8d3d6b9650..834ea379e85a 100644 --- a/cmd/otelcontribcol/builder-config.yaml +++ b/cmd/otelcontribcol/builder-config.yaml @@ -220,6 +220,7 @@ receivers: connectors: - gomod: go.opentelemetry.io/collector/connector/forwardconnector v0.112.0 + - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/connector/blobuploadconnector v0.112.0 - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/connector/countconnector v0.112.0 - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/connector/datadogconnector v0.112.0 - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/connector/exceptionsconnector v0.112.0 diff --git a/connector/blobuploadconnector/README.md b/connector/blobuploadconnector/README.md index d565c96076f2..20798142a5ab 100644 --- a/connector/blobuploadconnector/README.md +++ b/connector/blobuploadconnector/README.md @@ -1,5 +1,8 @@ # Blob Upload Connector + + + ## Status Under development. diff --git a/versions.yaml b/versions.yaml index 922243793e69..89c362057641 100644 --- a/versions.yaml +++ b/versions.yaml @@ -12,6 +12,7 @@ module-sets: - github.com/open-telemetry/opentelemetry-collector-contrib/confmap/provider/aesprovider - github.com/open-telemetry/opentelemetry-collector-contrib/confmap/provider/s3provider - github.com/open-telemetry/opentelemetry-collector-contrib/confmap/provider/secretsmanagerprovider + - github.com/open-telemetry/opentelemetry-collector-contrib/connector/blobuploadconnector - github.com/open-telemetry/opentelemetry-collector-contrib/connector/countconnector - github.com/open-telemetry/opentelemetry-collector-contrib/connector/datadogconnector - github.com/open-telemetry/opentelemetry-collector-contrib/connector/exceptionsconnector From f7e9c1b6f7fd39fad174a4334b253722fc46ee8b Mon Sep 17 00:00:00 2001 From: Michael Aaron Safyan Date: Wed, 23 Oct 2024 17:10:09 -0400 Subject: [PATCH 3/8] Bring version into conformance with other modules. --- connector/blobuploadconnector/go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/connector/blobuploadconnector/go.mod b/connector/blobuploadconnector/go.mod index 5ded36fd58cb..04abbcbc4989 100644 --- a/connector/blobuploadconnector/go.mod +++ b/connector/blobuploadconnector/go.mod @@ -1,6 +1,6 @@ module github.com/open-telemetry/opentelemetry-collector-contrib/connector/blobuploadconnector -go 1.23 +go 1.22.0 require ( github.com/stretchr/testify v1.9.0 From 208a79c46a31b8400f6bfdbf76071a6da68690d5 Mon Sep 17 00:00:00 2001 From: Michael Aaron Safyan Date: Wed, 23 Oct 2024 17:22:02 -0400 Subject: [PATCH 4/8] Add relative path rewrite to fix 'make genotelcontribcol'. --- cmd/otelcontribcol/builder-config.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/cmd/otelcontribcol/builder-config.yaml b/cmd/otelcontribcol/builder-config.yaml index 834ea379e85a..d6aa8cc7f2dd 100644 --- a/cmd/otelcontribcol/builder-config.yaml +++ b/cmd/otelcontribcol/builder-config.yaml @@ -452,6 +452,7 @@ replaces: - github.com/open-telemetry/opentelemetry-collector-contrib/exporter/syslogexporter => ../../exporter/syslogexporter - github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatatest => ../../pkg/pdatatest - github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil => ../../pkg/pdatautil + - github.com/open-telemetry/opentelemetry-collector-contrib/connector/blobuploadconnector => ../../connector/blobuploadconnector - github.com/open-telemetry/opentelemetry-collector-contrib/connector/countconnector => ../../connector/countconnector - github.com/open-telemetry/opentelemetry-collector-contrib/connector/datadogconnector => ../../connector/datadogconnector - github.com/open-telemetry/opentelemetry-collector-contrib/connector/exceptionsconnector => ../../connector/exceptionsconnector From bbf3f40559f0ac7b0f9053ec9bff7579418e48d4 Mon Sep 17 00:00:00 2001 From: Michael Aaron Safyan Date: Wed, 23 Oct 2024 17:49:44 -0400 Subject: [PATCH 5/8] Fixed lint and formatting issues. --- connector/blobuploadconnector/config_test.go | 2 +- connector/blobuploadconnector/deps.go | 6 +++- .../generated_package_test.go | 3 +- connector/blobuploadconnector/logs.go | 9 +++--- connector/blobuploadconnector/package_test.go | 31 +++++++++---------- connector/blobuploadconnector/traces.go | 9 +++--- 6 files changed, 31 insertions(+), 29 deletions(-) diff --git a/connector/blobuploadconnector/config_test.go b/connector/blobuploadconnector/config_test.go index 215f902e12ba..a7b03f490eb1 100644 --- a/connector/blobuploadconnector/config_test.go +++ b/connector/blobuploadconnector/config_test.go @@ -12,5 +12,5 @@ import ( func TestDefaultConfigIsValid(t *testing.T) { cfg := NewDefaultConfig() assert.NotNil(t, cfg) - assert.Nil(t, cfg.Validate()) + assert.NoError(t, cfg.Validate()) } diff --git a/connector/blobuploadconnector/deps.go b/connector/blobuploadconnector/deps.go index d5c65b30f2e6..b0e30c9a8d35 100644 --- a/connector/blobuploadconnector/deps.go +++ b/connector/blobuploadconnector/deps.go @@ -4,11 +4,15 @@ package blobuploadconnector // Deps provides a means of mocking out dependencies in tests. -type Deps interface{} +type Deps interface { + depsUnexported() +} // Default implementation of Deps. type depsImpl struct{} +func (*depsImpl) depsUnexported() {} + // NewDeps provides access to the default, real version of deps. func NewDeps() Deps { return &depsImpl{} diff --git a/connector/blobuploadconnector/generated_package_test.go b/connector/blobuploadconnector/generated_package_test.go index 46bb83bf07d4..71cc4a71891d 100644 --- a/connector/blobuploadconnector/generated_package_test.go +++ b/connector/blobuploadconnector/generated_package_test.go @@ -3,8 +3,9 @@ package blobuploadconnector import ( - "go.uber.org/goleak" "testing" + + "go.uber.org/goleak" ) func TestMain(m *testing.M) { diff --git a/connector/blobuploadconnector/logs.go b/connector/blobuploadconnector/logs.go index 9381a644c585..d66ec258c691 100644 --- a/connector/blobuploadconnector/logs.go +++ b/connector/blobuploadconnector/logs.go @@ -9,7 +9,6 @@ import ( "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/connector" "go.opentelemetry.io/collector/consumer" - "go.opentelemetry.io/collector/pdata/plog" ) @@ -27,11 +26,11 @@ func (c *passThroughLogsConnector) Capabilities() consumer.Capabilities { return consumer.Capabilities{MutatesData: false} } -func createLogsToLogsConnector(deps Deps) connector.CreateLogsToLogsFunc { +func createLogsToLogsConnector(_ Deps) connector.CreateLogsToLogsFunc { return func( - ctx context.Context, - settings connector.Settings, - config component.Config, + _ context.Context, + _ connector.Settings, + _ component.Config, nextConsumer consumer.Logs) (connector.Logs, error) { // TODO: implement actual, non-pass through implementation when // there is a config present with a non-empty "logs" config. diff --git a/connector/blobuploadconnector/package_test.go b/connector/blobuploadconnector/package_test.go index b708d035d7da..1eef18d7ebe0 100644 --- a/connector/blobuploadconnector/package_test.go +++ b/connector/blobuploadconnector/package_test.go @@ -7,14 +7,13 @@ import ( "context" "testing" + "github.com/stretchr/testify/assert" "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/connector/connectortest" "go.opentelemetry.io/collector/consumer/consumertest" "go.opentelemetry.io/collector/pdata/plog" "go.opentelemetry.io/collector/pdata/ptrace" - - "github.com/stretchr/testify/assert" ) func TestNewFactorySucceedsAndReturnsValidResult(t *testing.T) { @@ -45,17 +44,17 @@ func TestCanStartUpAndShutDownTracesToTracesWithDefaultConfig(t *testing.T) { createCtx := context.Background() tracesToTraces, createErr := f.CreateTracesToTraces(createCtx, settings, cfg, consumer) - assert.Nil(t, createErr) + assert.NoError(t, createErr) assert.NotNil(t, tracesToTraces) host := componenttest.NewNopHost() startCtx := context.Background() startErr := tracesToTraces.Start(startCtx, host) - assert.Nil(t, startErr) + assert.NoError(t, startErr) shutDownCtx := context.Background() shutDownErr := tracesToTraces.Shutdown(shutDownCtx) - assert.Nil(t, shutDownErr) + assert.NoError(t, shutDownErr) } func TestCanStartUpAndShutDownLogsToLogsWithDefaultConfig(t *testing.T) { @@ -69,17 +68,17 @@ func TestCanStartUpAndShutDownLogsToLogsWithDefaultConfig(t *testing.T) { createCtx := context.Background() logsToLogs, createErr := f.CreateLogsToLogs(createCtx, settings, cfg, consumer) - assert.Nil(t, createErr) + assert.NoError(t, createErr) assert.NotNil(t, logsToLogs) host := componenttest.NewNopHost() startCtx := context.Background() startErr := logsToLogs.Start(startCtx, host) - assert.Nil(t, startErr) + assert.NoError(t, startErr) shutDownCtx := context.Background() shutDownErr := logsToLogs.Shutdown(shutDownCtx) - assert.Nil(t, shutDownErr) + assert.NoError(t, shutDownErr) } func TestCanWriteTracesToTracesWithDefaultConfig(t *testing.T) { @@ -93,22 +92,22 @@ func TestCanWriteTracesToTracesWithDefaultConfig(t *testing.T) { createCtx := context.Background() tracesToTraces, createErr := f.CreateTracesToTraces(createCtx, settings, cfg, consumer) - assert.Nil(t, createErr) + assert.NoError(t, createErr) assert.NotNil(t, tracesToTraces) host := componenttest.NewNopHost() startCtx := context.Background() startErr := tracesToTraces.Start(startCtx, host) - assert.Nil(t, startErr) + assert.NoError(t, startErr) consumeCtx := context.Background() dataToConsume := ptrace.NewTraces() consumeErr := tracesToTraces.ConsumeTraces(consumeCtx, dataToConsume) - assert.Nil(t, consumeErr) + assert.NoError(t, consumeErr) shutDownCtx := context.Background() shutDownErr := tracesToTraces.Shutdown(shutDownCtx) - assert.Nil(t, shutDownErr) + assert.NoError(t, shutDownErr) } func TestCanWriteLogsToLogsWithDefaultConfig(t *testing.T) { @@ -122,20 +121,20 @@ func TestCanWriteLogsToLogsWithDefaultConfig(t *testing.T) { createCtx := context.Background() logsToLogs, createErr := f.CreateLogsToLogs(createCtx, settings, cfg, consumer) - assert.Nil(t, createErr) + assert.NoError(t, createErr) assert.NotNil(t, logsToLogs) host := componenttest.NewNopHost() startCtx := context.Background() startErr := logsToLogs.Start(startCtx, host) - assert.Nil(t, startErr) + assert.NoError(t, startErr) consumeCtx := context.Background() dataToConsume := plog.NewLogs() consumeErr := logsToLogs.ConsumeLogs(consumeCtx, dataToConsume) - assert.Nil(t, consumeErr) + assert.NoError(t, consumeErr) shutDownCtx := context.Background() shutDownErr := logsToLogs.Shutdown(shutDownCtx) - assert.Nil(t, shutDownErr) + assert.NoError(t, shutDownErr) } diff --git a/connector/blobuploadconnector/traces.go b/connector/blobuploadconnector/traces.go index e16146174fd0..1bf761169baf 100644 --- a/connector/blobuploadconnector/traces.go +++ b/connector/blobuploadconnector/traces.go @@ -9,7 +9,6 @@ import ( "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/connector" "go.opentelemetry.io/collector/consumer" - "go.opentelemetry.io/collector/pdata/ptrace" ) @@ -27,11 +26,11 @@ func (c *passThroughTracesConnector) Capabilities() consumer.Capabilities { return consumer.Capabilities{MutatesData: false} } -func createTracesToTracesConnector(deps Deps) connector.CreateTracesToTracesFunc { +func createTracesToTracesConnector(_ Deps) connector.CreateTracesToTracesFunc { return func( - ctx context.Context, - settings connector.Settings, - config component.Config, + _ context.Context, + _ connector.Settings, + _ component.Config, nextConsumer consumer.Traces) (connector.Traces, error) { // TODO: implement actual, non-pass through implementation when // there is a config present with a non-empty "traces" config. From 80976e9b745df4e7ca3c88d5810b3db3c8c22753 Mon Sep 17 00:00:00 2001 From: Michael Aaron Safyan Date: Fri, 1 Nov 2024 13:45:13 -0400 Subject: [PATCH 6/8] Define 'Start' and 'Shutdown' functions. --- connector/blobuploadconnector/logs.go | 5 +++-- connector/blobuploadconnector/traces.go | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/connector/blobuploadconnector/logs.go b/connector/blobuploadconnector/logs.go index d66ec258c691..a3e85e130c7c 100644 --- a/connector/blobuploadconnector/logs.go +++ b/connector/blobuploadconnector/logs.go @@ -14,10 +14,11 @@ import ( type passThroughLogsConnector struct { nextConsumer consumer.Logs - component.StartFunc - component.ShutdownFunc } +func (c *passThroughLogsConnector) Start(_ context.Context, _ component.Host) error { return nil } +func (c *passThroughLogsConnector) Shutdown(_ context.Context) error { return nil } + func (c *passThroughLogsConnector) ConsumeLogs(ctx context.Context, ld plog.Logs) error { return c.nextConsumer.ConsumeLogs(ctx, ld) } diff --git a/connector/blobuploadconnector/traces.go b/connector/blobuploadconnector/traces.go index 1bf761169baf..3264a00e9ac5 100644 --- a/connector/blobuploadconnector/traces.go +++ b/connector/blobuploadconnector/traces.go @@ -18,6 +18,9 @@ type passThroughTracesConnector struct { component.ShutdownFunc } +func (c *passThroughTracesConnector) Start(_ context.Context, _ component.Host) error { return nil } +func (c *passThroughTracesConnector) Shutdown(_ context.Context) error { return nil } + func (c *passThroughTracesConnector) ConsumeTraces(ctx context.Context, td ptrace.Traces) error { return c.nextConsumer.ConsumeTraces(ctx, td) } From 929e38a33bf9e2b35b645c47aa515ceca6df6793 Mon Sep 17 00:00:00 2001 From: Michael Aaron Safyan Date: Fri, 1 Nov 2024 13:55:37 -0400 Subject: [PATCH 7/8] Act on review comment to remove passthrough with placeholder for real implementation. --- connector/blobuploadconnector/logs.go | 23 +++++++++++++++-------- connector/blobuploadconnector/traces.go | 25 +++++++++++++++---------- 2 files changed, 30 insertions(+), 18 deletions(-) diff --git a/connector/blobuploadconnector/logs.go b/connector/blobuploadconnector/logs.go index a3e85e130c7c..410c367f92bf 100644 --- a/connector/blobuploadconnector/logs.go +++ b/connector/blobuploadconnector/logs.go @@ -12,18 +12,26 @@ import ( "go.opentelemetry.io/collector/pdata/plog" ) -type passThroughLogsConnector struct { +type logsToLogsImpl struct { nextConsumer consumer.Logs } -func (c *passThroughLogsConnector) Start(_ context.Context, _ component.Host) error { return nil } -func (c *passThroughLogsConnector) Shutdown(_ context.Context) error { return nil } +func (c *logsToLogsImpl) Start(_ context.Context, _ component.Host) error { + // TODO: implement + return nil +} + +func (c *logsToLogsImpl) Shutdown(_ context.Context) error { + // TODO: implement + return nil +} -func (c *passThroughLogsConnector) ConsumeLogs(ctx context.Context, ld plog.Logs) error { +func (c *logsToLogsImpl) ConsumeLogs(ctx context.Context, ld plog.Logs) error { + // TODO: implement return c.nextConsumer.ConsumeLogs(ctx, ld) } -func (c *passThroughLogsConnector) Capabilities() consumer.Capabilities { +func (c *logsToLogsImpl) Capabilities() consumer.Capabilities { return consumer.Capabilities{MutatesData: false} } @@ -33,8 +41,7 @@ func createLogsToLogsConnector(_ Deps) connector.CreateLogsToLogsFunc { _ connector.Settings, _ component.Config, nextConsumer consumer.Logs) (connector.Logs, error) { - // TODO: implement actual, non-pass through implementation when - // there is a config present with a non-empty "logs" config. - return &passThroughLogsConnector{nextConsumer: nextConsumer}, nil + // TODO: implement + return &logsToLogsImpl{nextConsumer: nextConsumer}, nil } } diff --git a/connector/blobuploadconnector/traces.go b/connector/blobuploadconnector/traces.go index 3264a00e9ac5..0893e0dd4186 100644 --- a/connector/blobuploadconnector/traces.go +++ b/connector/blobuploadconnector/traces.go @@ -12,20 +12,26 @@ import ( "go.opentelemetry.io/collector/pdata/ptrace" ) -type passThroughTracesConnector struct { +type tracesToTracesImpl struct { nextConsumer consumer.Traces - component.StartFunc - component.ShutdownFunc } -func (c *passThroughTracesConnector) Start(_ context.Context, _ component.Host) error { return nil } -func (c *passThroughTracesConnector) Shutdown(_ context.Context) error { return nil } +func (c *tracesToTracesImpl) Start(_ context.Context, _ component.Host) error { + // TODO: implement + return nil +} + +func (c *tracesToTracesImpl) Shutdown(_ context.Context) error { + // TODO: implement + return nil +} -func (c *passThroughTracesConnector) ConsumeTraces(ctx context.Context, td ptrace.Traces) error { +func (c *tracesToTracesImpl) ConsumeTraces(ctx context.Context, td ptrace.Traces) error { + // TODO: implement return c.nextConsumer.ConsumeTraces(ctx, td) } -func (c *passThroughTracesConnector) Capabilities() consumer.Capabilities { +func (c *tracesToTracesImpl) Capabilities() consumer.Capabilities { return consumer.Capabilities{MutatesData: false} } @@ -35,8 +41,7 @@ func createTracesToTracesConnector(_ Deps) connector.CreateTracesToTracesFunc { _ connector.Settings, _ component.Config, nextConsumer consumer.Traces) (connector.Traces, error) { - // TODO: implement actual, non-pass through implementation when - // there is a config present with a non-empty "traces" config. - return &passThroughTracesConnector{nextConsumer: nextConsumer}, nil + // TODO: implement + return &tracesToTracesImpl{nextConsumer: nextConsumer}, nil } } From 4f145a04adf3d8782cbc453522ea1b9344885fcc Mon Sep 17 00:00:00 2001 From: Michael Aaron Safyan Date: Fri, 1 Nov 2024 16:44:42 -0400 Subject: [PATCH 8/8] Switch from 'connector' to 'processor' per review feedback. --- .chloggen/blobuploadconnector.yaml | 6 - .chloggen/blobuploadprocessor.yaml | 6 + .github/CODEOWNERS | 2 +- .github/ISSUE_TEMPLATE/bug_report.yaml | 2 +- cmd/otelcontribcol/builder-config.yaml | 4 +- connector/blobuploadconnector/doc.go | 6 - connector/blobuploadconnector/factory.go | 34 ----- .../generated_component_test.go | 80 ---------- connector/blobuploadconnector/logs.go | 47 ------ connector/blobuploadconnector/traces.go | 47 ------ .../blobuploadprocessor}/Makefile | 0 .../blobuploadprocessor}/README.md | 9 ++ .../blobuploadprocessor}/config.go | 15 +- .../blobuploadprocessor}/config_common.go | 2 +- .../config_common_test.go | 2 +- .../blobuploadprocessor}/config_logs.go | 2 +- .../blobuploadprocessor}/config_logs_test.go | 2 +- .../blobuploadprocessor}/config_test.go | 4 +- .../blobuploadprocessor}/config_traces.go | 2 +- .../config_traces_test.go | 2 +- .../blobuploadprocessor}/deps.go | 8 +- processor/blobuploadprocessor/doc.go | 6 + processor/blobuploadprocessor/factory.go | 29 ++++ .../generated_component_test.go | 142 ++++++++++++++++++ .../generated_package_test.go | 2 +- .../blobuploadprocessor}/go.mod | 15 +- .../blobuploadprocessor}/go.sum | 18 +-- .../internal/metadata/generated_status.go | 4 +- processor/blobuploadprocessor/logs.go | 47 ++++++ .../blobuploadprocessor}/logs_test.go | 2 +- .../blobuploadprocessor}/metadata.yaml | 6 +- .../blobuploadprocessor}/package_test.go | 60 ++++---- processor/blobuploadprocessor/traces.go | 47 ++++++ .../blobuploadprocessor}/traces_test.go | 2 +- versions.yaml | 2 +- 35 files changed, 369 insertions(+), 295 deletions(-) delete mode 100644 .chloggen/blobuploadconnector.yaml create mode 100644 .chloggen/blobuploadprocessor.yaml delete mode 100644 connector/blobuploadconnector/doc.go delete mode 100644 connector/blobuploadconnector/factory.go delete mode 100644 connector/blobuploadconnector/generated_component_test.go delete mode 100644 connector/blobuploadconnector/logs.go delete mode 100644 connector/blobuploadconnector/traces.go rename {connector/blobuploadconnector => processor/blobuploadprocessor}/Makefile (100%) rename {connector/blobuploadconnector => processor/blobuploadprocessor}/README.md (64%) rename {connector/blobuploadconnector => processor/blobuploadprocessor}/config.go (52%) rename {connector/blobuploadconnector => processor/blobuploadprocessor}/config_common.go (58%) rename {connector/blobuploadconnector => processor/blobuploadprocessor}/config_common_test.go (73%) rename {connector/blobuploadconnector => processor/blobuploadprocessor}/config_logs.go (56%) rename {connector/blobuploadconnector => processor/blobuploadprocessor}/config_logs_test.go (73%) rename {connector/blobuploadconnector => processor/blobuploadprocessor}/config_test.go (79%) rename {connector/blobuploadconnector => processor/blobuploadprocessor}/config_traces.go (57%) rename {connector/blobuploadconnector => processor/blobuploadprocessor}/config_traces_test.go (73%) rename {connector/blobuploadconnector => processor/blobuploadprocessor}/deps.go (60%) create mode 100644 processor/blobuploadprocessor/doc.go create mode 100644 processor/blobuploadprocessor/factory.go create mode 100644 processor/blobuploadprocessor/generated_component_test.go rename {connector/blobuploadconnector => processor/blobuploadprocessor}/generated_package_test.go (88%) rename {connector/blobuploadconnector => processor/blobuploadprocessor}/go.mod (82%) rename {connector/blobuploadconnector => processor/blobuploadprocessor}/go.sum (91%) rename {connector/blobuploadconnector => processor/blobuploadprocessor}/internal/metadata/generated_status.go (65%) create mode 100644 processor/blobuploadprocessor/logs.go rename {connector/blobuploadconnector => processor/blobuploadprocessor}/logs_test.go (73%) rename {connector/blobuploadconnector => processor/blobuploadprocessor}/metadata.yaml (82%) rename {connector/blobuploadconnector => processor/blobuploadprocessor}/package_test.go (59%) create mode 100644 processor/blobuploadprocessor/traces.go rename {connector/blobuploadconnector => processor/blobuploadprocessor}/traces_test.go (73%) diff --git a/.chloggen/blobuploadconnector.yaml b/.chloggen/blobuploadconnector.yaml deleted file mode 100644 index 2cb0f1e2cb35..000000000000 --- a/.chloggen/blobuploadconnector.yaml +++ /dev/null @@ -1,6 +0,0 @@ -change_type: new_component -component: blobuploadconnector -note: Connector for uploading and replacing pieces of a signal to blob storage -issues: [33737] -subtext: Skeleton implementation at the moment. -change_logs: [] diff --git a/.chloggen/blobuploadprocessor.yaml b/.chloggen/blobuploadprocessor.yaml new file mode 100644 index 000000000000..7ddf2784d431 --- /dev/null +++ b/.chloggen/blobuploadprocessor.yaml @@ -0,0 +1,6 @@ +change_type: new_component +component: blobuploadprocessor +note: Processor for uploading pieces of a signal to blob storage and replacing with a ref +issues: [33737] +subtext: Skeleton implementation at the moment. +change_logs: [] diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 1202b6ee404a..f4641773f8c3 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -25,7 +25,6 @@ confmap/provider/aesprovider/ @open-teleme confmap/provider/s3provider/ @open-telemetry/collector-contrib-approvers @Aneurysm9 confmap/provider/secretsmanagerprovider/ @open-telemetry/collector-contrib-approvers @driverpt @atoulme -connector/blobuploadconnector/ @open-telemetry/collector-contrib-approvers @michaelsafyan @dashpole connector/countconnector/ @open-telemetry/collector-contrib-approvers @djaglowski @jpkrohling connector/datadogconnector/ @open-telemetry/collector-contrib-approvers @mx-psi @dineshg13 @ankitpatel96 connector/exceptionsconnector/ @open-telemetry/collector-contrib-approvers @jpkrohling @marctc @@ -172,6 +171,7 @@ pkg/translator/zipkin/ @open-teleme pkg/winperfcounters/ @open-telemetry/collector-contrib-approvers @dashpole @Mrod1598 @alxbl @pjanotti processor/attributesprocessor/ @open-telemetry/collector-contrib-approvers @boostchicken +connector/blobuploadprocessor/ @open-telemetry/collector-contrib-approvers @michaelsafyan @dashpole @braydonk processor/coralogixprocessor/ @open-telemetry/collector-contrib-approvers @crobert-1 @galrose processor/cumulativetodeltaprocessor/ @open-telemetry/collector-contrib-approvers @TylerHelmuth processor/deltatocumulativeprocessor/ @open-telemetry/collector-contrib-approvers @sh0rez @RichieSams @jpkrohling diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml index f1c73ee9a653..afe2ee912de5 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yaml +++ b/.github/ISSUE_TEMPLATE/bug_report.yaml @@ -26,7 +26,6 @@ body: - confmap/provider/aesprovider - confmap/provider/s3provider - confmap/provider/secretsmanagerprovider - - connector/blobupload - connector/count - connector/datadog - connector/exceptions @@ -167,6 +166,7 @@ body: - pkg/translator/zipkin - pkg/winperfcounters - processor/attributes + - processor/blobupload - processor/coralogix - processor/cumulativetodelta - processor/deltatocumulative diff --git a/cmd/otelcontribcol/builder-config.yaml b/cmd/otelcontribcol/builder-config.yaml index 624c87454931..a5751196e65f 100644 --- a/cmd/otelcontribcol/builder-config.yaml +++ b/cmd/otelcontribcol/builder-config.yaml @@ -102,6 +102,7 @@ processors: - gomod: go.opentelemetry.io/collector/processor/batchprocessor v0.112.0 - gomod: go.opentelemetry.io/collector/processor/memorylimiterprocessor v0.112.0 - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/processor/attributesprocessor v0.112.0 + - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/processor/blobuploadprocessor v0.112.0 - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/processor/cumulativetodeltaprocessor v0.112.0 - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/processor/deltatocumulativeprocessor v0.112.0 - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/processor/deltatorateprocessor v0.112.0 @@ -222,7 +223,6 @@ receivers: connectors: - gomod: go.opentelemetry.io/collector/connector/forwardconnector v0.112.0 - - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/connector/blobuploadconnector v0.112.0 - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/connector/countconnector v0.112.0 - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/connector/datadogconnector v0.112.0 - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/connector/exceptionsconnector v0.112.0 @@ -352,6 +352,7 @@ replaces: - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/elasticsearchreceiver => ../../receiver/elasticsearchreceiver - github.com/open-telemetry/opentelemetry-collector-contrib/processor/metricsgenerationprocessor => ../../processor/metricsgenerationprocessor - github.com/open-telemetry/opentelemetry-collector-contrib/processor/attributesprocessor => ../../processor/attributesprocessor + - github.com/open-telemetry/opentelemetry-collector-contrib/processor/blobuploadprocessor => ../../processor/blobuploadprocessor - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/sqlqueryreceiver => ../../receiver/sqlqueryreceiver - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/purefareceiver => ../../receiver/purefareceiver - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/purefbreceiver => ../../receiver/purefbreceiver @@ -456,7 +457,6 @@ replaces: - github.com/open-telemetry/opentelemetry-collector-contrib/exporter/syslogexporter => ../../exporter/syslogexporter - github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatatest => ../../pkg/pdatatest - github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil => ../../pkg/pdatautil - - github.com/open-telemetry/opentelemetry-collector-contrib/connector/blobuploadconnector => ../../connector/blobuploadconnector - github.com/open-telemetry/opentelemetry-collector-contrib/connector/countconnector => ../../connector/countconnector - github.com/open-telemetry/opentelemetry-collector-contrib/connector/datadogconnector => ../../connector/datadogconnector - github.com/open-telemetry/opentelemetry-collector-contrib/connector/exceptionsconnector => ../../connector/exceptionsconnector diff --git a/connector/blobuploadconnector/doc.go b/connector/blobuploadconnector/doc.go deleted file mode 100644 index c678211816ac..000000000000 --- a/connector/blobuploadconnector/doc.go +++ /dev/null @@ -1,6 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -//go:generate mdatagen metadata.yaml - -package blobuploadconnector diff --git a/connector/blobuploadconnector/factory.go b/connector/blobuploadconnector/factory.go deleted file mode 100644 index d5e3afa047c2..000000000000 --- a/connector/blobuploadconnector/factory.go +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package blobuploadconnector - -import ( - "go.opentelemetry.io/collector/component" - "go.opentelemetry.io/collector/connector" - - "github.com/open-telemetry/opentelemetry-collector-contrib/connector/blobuploadconnector/internal/metadata" -) - -func createDefaultConfig() component.Config { - return NewDefaultConfig() -} - -// NewFactoryWithDeps instantiates the factory with dependency injection, allowing -// for a more testable interface that allows global functions/objects to be swapped out. -func NewFactoryWithDeps(deps Deps) connector.Factory { - return connector.NewFactory( - metadata.Type, - createDefaultConfig, - connector.WithTracesToTraces( - createTracesToTracesConnector(deps), - metadata.TracesToTracesStability), - connector.WithLogsToLogs( - createLogsToLogsConnector(deps), - metadata.LogsToLogsStability)) -} - -// NewFactory is used by the OTel collector to instantiate this component. -func NewFactory() connector.Factory { - return NewFactoryWithDeps(NewDeps()) -} diff --git a/connector/blobuploadconnector/generated_component_test.go b/connector/blobuploadconnector/generated_component_test.go deleted file mode 100644 index 852b800aaedc..000000000000 --- a/connector/blobuploadconnector/generated_component_test.go +++ /dev/null @@ -1,80 +0,0 @@ -// Code generated by mdatagen. DO NOT EDIT. - -package blobuploadconnector - -import ( - "context" - "testing" - - "github.com/stretchr/testify/require" - "go.opentelemetry.io/collector/component" - "go.opentelemetry.io/collector/component/componenttest" - "go.opentelemetry.io/collector/confmap/confmaptest" - "go.opentelemetry.io/collector/connector" - "go.opentelemetry.io/collector/connector/connectortest" - "go.opentelemetry.io/collector/consumer" - "go.opentelemetry.io/collector/consumer/consumertest" - "go.opentelemetry.io/collector/pipeline" -) - -func TestComponentFactoryType(t *testing.T) { - require.Equal(t, "blobuploadconnector", NewFactory().Type().String()) -} - -func TestComponentConfigStruct(t *testing.T) { - require.NoError(t, componenttest.CheckConfigStruct(NewFactory().CreateDefaultConfig())) -} - -func TestComponentLifecycle(t *testing.T) { - factory := NewFactory() - - tests := []struct { - name string - createFn func(ctx context.Context, set connector.Settings, cfg component.Config) (component.Component, error) - }{ - - { - name: "logs_to_logs", - createFn: func(ctx context.Context, set connector.Settings, cfg component.Config) (component.Component, error) { - router := connector.NewLogsRouter(map[pipeline.ID]consumer.Logs{pipeline.NewID(pipeline.SignalLogs): consumertest.NewNop()}) - return factory.CreateLogsToLogs(ctx, set, cfg, router) - }, - }, - - { - name: "traces_to_traces", - createFn: func(ctx context.Context, set connector.Settings, cfg component.Config) (component.Component, error) { - router := connector.NewTracesRouter(map[pipeline.ID]consumer.Traces{pipeline.NewID(pipeline.SignalTraces): consumertest.NewNop()}) - return factory.CreateTracesToTraces(ctx, set, cfg, router) - }, - }, - } - - cm, err := confmaptest.LoadConf("metadata.yaml") - require.NoError(t, err) - cfg := factory.CreateDefaultConfig() - sub, err := cm.Sub("tests::config") - require.NoError(t, err) - require.NoError(t, sub.Unmarshal(&cfg)) - - for _, tt := range tests { - t.Run(tt.name+"-shutdown", func(t *testing.T) { - c, err := tt.createFn(context.Background(), connectortest.NewNopSettings(), cfg) - require.NoError(t, err) - err = c.Shutdown(context.Background()) - require.NoError(t, err) - }) - t.Run(tt.name+"-lifecycle", func(t *testing.T) { - firstConnector, err := tt.createFn(context.Background(), connectortest.NewNopSettings(), cfg) - require.NoError(t, err) - host := componenttest.NewNopHost() - require.NoError(t, err) - require.NoError(t, firstConnector.Start(context.Background(), host)) - require.NoError(t, firstConnector.Shutdown(context.Background())) - secondConnector, err := tt.createFn(context.Background(), connectortest.NewNopSettings(), cfg) - require.NoError(t, err) - require.NoError(t, secondConnector.Start(context.Background(), host)) - require.NoError(t, secondConnector.Shutdown(context.Background())) - }) - } -} diff --git a/connector/blobuploadconnector/logs.go b/connector/blobuploadconnector/logs.go deleted file mode 100644 index 410c367f92bf..000000000000 --- a/connector/blobuploadconnector/logs.go +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package blobuploadconnector - -import ( - "context" - - "go.opentelemetry.io/collector/component" - "go.opentelemetry.io/collector/connector" - "go.opentelemetry.io/collector/consumer" - "go.opentelemetry.io/collector/pdata/plog" -) - -type logsToLogsImpl struct { - nextConsumer consumer.Logs -} - -func (c *logsToLogsImpl) Start(_ context.Context, _ component.Host) error { - // TODO: implement - return nil -} - -func (c *logsToLogsImpl) Shutdown(_ context.Context) error { - // TODO: implement - return nil -} - -func (c *logsToLogsImpl) ConsumeLogs(ctx context.Context, ld plog.Logs) error { - // TODO: implement - return c.nextConsumer.ConsumeLogs(ctx, ld) -} - -func (c *logsToLogsImpl) Capabilities() consumer.Capabilities { - return consumer.Capabilities{MutatesData: false} -} - -func createLogsToLogsConnector(_ Deps) connector.CreateLogsToLogsFunc { - return func( - _ context.Context, - _ connector.Settings, - _ component.Config, - nextConsumer consumer.Logs) (connector.Logs, error) { - // TODO: implement - return &logsToLogsImpl{nextConsumer: nextConsumer}, nil - } -} diff --git a/connector/blobuploadconnector/traces.go b/connector/blobuploadconnector/traces.go deleted file mode 100644 index 0893e0dd4186..000000000000 --- a/connector/blobuploadconnector/traces.go +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package blobuploadconnector - -import ( - "context" - - "go.opentelemetry.io/collector/component" - "go.opentelemetry.io/collector/connector" - "go.opentelemetry.io/collector/consumer" - "go.opentelemetry.io/collector/pdata/ptrace" -) - -type tracesToTracesImpl struct { - nextConsumer consumer.Traces -} - -func (c *tracesToTracesImpl) Start(_ context.Context, _ component.Host) error { - // TODO: implement - return nil -} - -func (c *tracesToTracesImpl) Shutdown(_ context.Context) error { - // TODO: implement - return nil -} - -func (c *tracesToTracesImpl) ConsumeTraces(ctx context.Context, td ptrace.Traces) error { - // TODO: implement - return c.nextConsumer.ConsumeTraces(ctx, td) -} - -func (c *tracesToTracesImpl) Capabilities() consumer.Capabilities { - return consumer.Capabilities{MutatesData: false} -} - -func createTracesToTracesConnector(_ Deps) connector.CreateTracesToTracesFunc { - return func( - _ context.Context, - _ connector.Settings, - _ component.Config, - nextConsumer consumer.Traces) (connector.Traces, error) { - // TODO: implement - return &tracesToTracesImpl{nextConsumer: nextConsumer}, nil - } -} diff --git a/connector/blobuploadconnector/Makefile b/processor/blobuploadprocessor/Makefile similarity index 100% rename from connector/blobuploadconnector/Makefile rename to processor/blobuploadprocessor/Makefile diff --git a/connector/blobuploadconnector/README.md b/processor/blobuploadprocessor/README.md similarity index 64% rename from connector/blobuploadconnector/README.md rename to processor/blobuploadprocessor/README.md index 20798142a5ab..35a3e18e70d7 100644 --- a/connector/blobuploadconnector/README.md +++ b/processor/blobuploadprocessor/README.md @@ -1,6 +1,15 @@ # Blob Upload Connector +| Status | | +| ------------- |-----------| +| Stability | [development]: traces, logs | +| Distributions | [contrib] | +| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aopen%20label%3Aprocessor%2Fblobupload%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Aprocessor%2Fblobupload) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aclosed%20label%3Aprocessor%2Fblobupload%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aclosed+is%3Aissue+label%3Aprocessor%2Fblobupload) | +| [Code Owners](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/CONTRIBUTING.md#becoming-a-code-owner) | [@michaelsafyan](https://www.github.com/michaelsafyan), [@dashpole](https://www.github.com/dashpole), [@braydonk](https://www.github.com/braydonk) | + +[development]: https://github.com/open-telemetry/opentelemetry-collector#development +[contrib]: https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol-contrib ## Status diff --git a/connector/blobuploadconnector/config.go b/processor/blobuploadprocessor/config.go similarity index 52% rename from connector/blobuploadconnector/config.go rename to processor/blobuploadprocessor/config.go index d5f9f11f3750..36e2137581f9 100644 --- a/connector/blobuploadconnector/config.go +++ b/processor/blobuploadprocessor/config.go @@ -1,7 +1,11 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package blobuploadconnector +package blobuploadprocessor // import "github.com/open-telemetry/opentelemetry-collector-contrib/processor/blobuploadprocessor" + +import ( + "go.opentelemetry.io/collector/component" +) // Config defines the overall configuration for this component. type Config struct { @@ -10,11 +14,16 @@ type Config struct { LogsConfig *LogsConfig `mapstructure:"logs"` } -// NewDefaultConfig instantiates a default, valid config. -func NewDefaultConfig() *Config { +// createTypedDefaultConfig instantiates a default, valid config. +func createTypedDefaultConfig() *Config { return &Config{} } +// createDefaultConfig erases the type to allow use in component. +func createDefaultConfig() component.Config { + return createTypedDefaultConfig() +} + // Validate ensures that the configuration is valid. func (c *Config) Validate() error { // TODO: implement validation in subsequent PRs. diff --git a/connector/blobuploadconnector/config_common.go b/processor/blobuploadprocessor/config_common.go similarity index 58% rename from connector/blobuploadconnector/config_common.go rename to processor/blobuploadprocessor/config_common.go index a634bd5b46bd..081e5826ff1a 100644 --- a/connector/blobuploadconnector/config_common.go +++ b/processor/blobuploadprocessor/config_common.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package blobuploadconnector +package blobuploadprocessor // import "github.com/open-telemetry/opentelemetry-collector-contrib/processor/blobuploadprocessor" // CommonConfig defines configuration that applies to multiple signal types. type CommonConfig struct{} diff --git a/connector/blobuploadconnector/config_common_test.go b/processor/blobuploadprocessor/config_common_test.go similarity index 73% rename from connector/blobuploadconnector/config_common_test.go rename to processor/blobuploadprocessor/config_common_test.go index 750d695177f0..62f7f132dfc1 100644 --- a/connector/blobuploadconnector/config_common_test.go +++ b/processor/blobuploadprocessor/config_common_test.go @@ -1,4 +1,4 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package blobuploadconnector +package blobuploadprocessor diff --git a/connector/blobuploadconnector/config_logs.go b/processor/blobuploadprocessor/config_logs.go similarity index 56% rename from connector/blobuploadconnector/config_logs.go rename to processor/blobuploadprocessor/config_logs.go index 093949bcf547..85fba0321de4 100644 --- a/connector/blobuploadconnector/config_logs.go +++ b/processor/blobuploadprocessor/config_logs.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package blobuploadconnector +package blobuploadprocessor // import "github.com/open-telemetry/opentelemetry-collector-contrib/processor/blobuploadprocessor" // LogsConfig defines configuration for the logs signal type. type LogsConfig struct{} diff --git a/connector/blobuploadconnector/config_logs_test.go b/processor/blobuploadprocessor/config_logs_test.go similarity index 73% rename from connector/blobuploadconnector/config_logs_test.go rename to processor/blobuploadprocessor/config_logs_test.go index 750d695177f0..62f7f132dfc1 100644 --- a/connector/blobuploadconnector/config_logs_test.go +++ b/processor/blobuploadprocessor/config_logs_test.go @@ -1,4 +1,4 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package blobuploadconnector +package blobuploadprocessor diff --git a/connector/blobuploadconnector/config_test.go b/processor/blobuploadprocessor/config_test.go similarity index 79% rename from connector/blobuploadconnector/config_test.go rename to processor/blobuploadprocessor/config_test.go index a7b03f490eb1..347a43aa3fd8 100644 --- a/connector/blobuploadconnector/config_test.go +++ b/processor/blobuploadprocessor/config_test.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package blobuploadconnector +package blobuploadprocessor import ( "testing" @@ -10,7 +10,7 @@ import ( ) func TestDefaultConfigIsValid(t *testing.T) { - cfg := NewDefaultConfig() + cfg := createTypedDefaultConfig() assert.NotNil(t, cfg) assert.NoError(t, cfg.Validate()) } diff --git a/connector/blobuploadconnector/config_traces.go b/processor/blobuploadprocessor/config_traces.go similarity index 57% rename from connector/blobuploadconnector/config_traces.go rename to processor/blobuploadprocessor/config_traces.go index aaf3d3993382..667f6da2d2c0 100644 --- a/connector/blobuploadconnector/config_traces.go +++ b/processor/blobuploadprocessor/config_traces.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package blobuploadconnector +package blobuploadprocessor // import "github.com/open-telemetry/opentelemetry-collector-contrib/processor/blobuploadprocessor" // TracesConfig defines configuration for the traces signal type. type TracesConfig struct{} diff --git a/connector/blobuploadconnector/config_traces_test.go b/processor/blobuploadprocessor/config_traces_test.go similarity index 73% rename from connector/blobuploadconnector/config_traces_test.go rename to processor/blobuploadprocessor/config_traces_test.go index 750d695177f0..62f7f132dfc1 100644 --- a/connector/blobuploadconnector/config_traces_test.go +++ b/processor/blobuploadprocessor/config_traces_test.go @@ -1,4 +1,4 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package blobuploadconnector +package blobuploadprocessor diff --git a/connector/blobuploadconnector/deps.go b/processor/blobuploadprocessor/deps.go similarity index 60% rename from connector/blobuploadconnector/deps.go rename to processor/blobuploadprocessor/deps.go index b0e30c9a8d35..797c2d16b66b 100644 --- a/connector/blobuploadconnector/deps.go +++ b/processor/blobuploadprocessor/deps.go @@ -1,19 +1,19 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package blobuploadconnector +package blobuploadprocessor // import "github.com/open-telemetry/opentelemetry-collector-contrib/processor/blobuploadprocessor" // Deps provides a means of mocking out dependencies in tests. -type Deps interface { +type deps interface { depsUnexported() } -// Default implementation of Deps. +// Default implementation of deps. type depsImpl struct{} func (*depsImpl) depsUnexported() {} // NewDeps provides access to the default, real version of deps. -func NewDeps() Deps { +func newDeps() deps { return &depsImpl{} } diff --git a/processor/blobuploadprocessor/doc.go b/processor/blobuploadprocessor/doc.go new file mode 100644 index 000000000000..97d053f3f0a0 --- /dev/null +++ b/processor/blobuploadprocessor/doc.go @@ -0,0 +1,6 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +//go:generate mdatagen metadata.yaml + +package blobuploadprocessor // import "github.com/open-telemetry/opentelemetry-collector-contrib/processor/blobuploadprocessor" diff --git a/processor/blobuploadprocessor/factory.go b/processor/blobuploadprocessor/factory.go new file mode 100644 index 000000000000..a6edb96ac7ab --- /dev/null +++ b/processor/blobuploadprocessor/factory.go @@ -0,0 +1,29 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package blobuploadprocessor // import "github.com/open-telemetry/opentelemetry-collector-contrib/processor/blobuploadprocessor" + +import ( + "go.opentelemetry.io/collector/processor" + + "github.com/open-telemetry/opentelemetry-collector-contrib/processor/blobuploadprocessor/internal/metadata" +) + +// NewFactoryWithDeps instantiates the factory with dependency injection, allowing +// for a more testable interface that allows global functions/objects to be swapped out. +func newFactoryWithDeps(d deps) processor.Factory { + return processor.NewFactory( + metadata.Type, + createDefaultConfig, + processor.WithTraces( + createTracesProcessor(d), + metadata.TracesStability), + processor.WithLogs( + createLogsProcessor(d), + metadata.LogsStability)) +} + +// NewFactory is used by the OTel collector to instantiate this component. +func NewFactory() processor.Factory { + return newFactoryWithDeps(newDeps()) +} diff --git a/processor/blobuploadprocessor/generated_component_test.go b/processor/blobuploadprocessor/generated_component_test.go new file mode 100644 index 000000000000..29696cb0f2e7 --- /dev/null +++ b/processor/blobuploadprocessor/generated_component_test.go @@ -0,0 +1,142 @@ +// Code generated by mdatagen. DO NOT EDIT. + +package blobuploadprocessor + +import ( + "context" + "testing" + "time" + + "github.com/stretchr/testify/require" + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componenttest" + "go.opentelemetry.io/collector/confmap/confmaptest" + "go.opentelemetry.io/collector/consumer/consumertest" + "go.opentelemetry.io/collector/pdata/pcommon" + "go.opentelemetry.io/collector/pdata/plog" + "go.opentelemetry.io/collector/pdata/pmetric" + "go.opentelemetry.io/collector/pdata/ptrace" + "go.opentelemetry.io/collector/processor" + "go.opentelemetry.io/collector/processor/processortest" +) + +func TestComponentFactoryType(t *testing.T) { + require.Equal(t, "blobuploadconnector", NewFactory().Type().String()) +} + +func TestComponentConfigStruct(t *testing.T) { + require.NoError(t, componenttest.CheckConfigStruct(NewFactory().CreateDefaultConfig())) +} + +func TestComponentLifecycle(t *testing.T) { + factory := NewFactory() + + tests := []struct { + name string + createFn func(ctx context.Context, set processor.Settings, cfg component.Config) (component.Component, error) + }{ + + { + name: "logs", + createFn: func(ctx context.Context, set processor.Settings, cfg component.Config) (component.Component, error) { + return factory.CreateLogs(ctx, set, cfg, consumertest.NewNop()) + }, + }, + + { + name: "traces", + createFn: func(ctx context.Context, set processor.Settings, cfg component.Config) (component.Component, error) { + return factory.CreateTraces(ctx, set, cfg, consumertest.NewNop()) + }, + }, + } + + cm, err := confmaptest.LoadConf("metadata.yaml") + require.NoError(t, err) + cfg := factory.CreateDefaultConfig() + sub, err := cm.Sub("tests::config") + require.NoError(t, err) + require.NoError(t, sub.Unmarshal(&cfg)) + + for _, tt := range tests { + t.Run(tt.name+"-shutdown", func(t *testing.T) { + c, err := tt.createFn(context.Background(), processortest.NewNopSettings(), cfg) + require.NoError(t, err) + err = c.Shutdown(context.Background()) + require.NoError(t, err) + }) + t.Run(tt.name+"-lifecycle", func(t *testing.T) { + c, err := tt.createFn(context.Background(), processortest.NewNopSettings(), cfg) + require.NoError(t, err) + host := componenttest.NewNopHost() + err = c.Start(context.Background(), host) + require.NoError(t, err) + require.NotPanics(t, func() { + switch tt.name { + case "logs": + e, ok := c.(processor.Logs) + require.True(t, ok) + logs := generateLifecycleTestLogs() + if !e.Capabilities().MutatesData { + logs.MarkReadOnly() + } + err = e.ConsumeLogs(context.Background(), logs) + case "metrics": + e, ok := c.(processor.Metrics) + require.True(t, ok) + metrics := generateLifecycleTestMetrics() + if !e.Capabilities().MutatesData { + metrics.MarkReadOnly() + } + err = e.ConsumeMetrics(context.Background(), metrics) + case "traces": + e, ok := c.(processor.Traces) + require.True(t, ok) + traces := generateLifecycleTestTraces() + if !e.Capabilities().MutatesData { + traces.MarkReadOnly() + } + err = e.ConsumeTraces(context.Background(), traces) + } + }) + require.NoError(t, err) + err = c.Shutdown(context.Background()) + require.NoError(t, err) + }) + } +} + +func generateLifecycleTestLogs() plog.Logs { + logs := plog.NewLogs() + rl := logs.ResourceLogs().AppendEmpty() + rl.Resource().Attributes().PutStr("resource", "R1") + l := rl.ScopeLogs().AppendEmpty().LogRecords().AppendEmpty() + l.Body().SetStr("test log message") + l.SetTimestamp(pcommon.NewTimestampFromTime(time.Now())) + return logs +} + +func generateLifecycleTestMetrics() pmetric.Metrics { + metrics := pmetric.NewMetrics() + rm := metrics.ResourceMetrics().AppendEmpty() + rm.Resource().Attributes().PutStr("resource", "R1") + m := rm.ScopeMetrics().AppendEmpty().Metrics().AppendEmpty() + m.SetName("test_metric") + dp := m.SetEmptyGauge().DataPoints().AppendEmpty() + dp.Attributes().PutStr("test_attr", "value_1") + dp.SetIntValue(123) + dp.SetTimestamp(pcommon.NewTimestampFromTime(time.Now())) + return metrics +} + +func generateLifecycleTestTraces() ptrace.Traces { + traces := ptrace.NewTraces() + rs := traces.ResourceSpans().AppendEmpty() + rs.Resource().Attributes().PutStr("resource", "R1") + span := rs.ScopeSpans().AppendEmpty().Spans().AppendEmpty() + span.Attributes().PutStr("test_attr", "value_1") + span.SetName("test_span") + span.SetStartTimestamp(pcommon.NewTimestampFromTime(time.Now().Add(-1 * time.Second))) + span.SetEndTimestamp(pcommon.NewTimestampFromTime(time.Now())) + return traces +} diff --git a/connector/blobuploadconnector/generated_package_test.go b/processor/blobuploadprocessor/generated_package_test.go similarity index 88% rename from connector/blobuploadconnector/generated_package_test.go rename to processor/blobuploadprocessor/generated_package_test.go index 71cc4a71891d..9c6bd7f42030 100644 --- a/connector/blobuploadconnector/generated_package_test.go +++ b/processor/blobuploadprocessor/generated_package_test.go @@ -1,6 +1,6 @@ // Code generated by mdatagen. DO NOT EDIT. -package blobuploadconnector +package blobuploadprocessor import ( "testing" diff --git a/connector/blobuploadconnector/go.mod b/processor/blobuploadprocessor/go.mod similarity index 82% rename from connector/blobuploadconnector/go.mod rename to processor/blobuploadprocessor/go.mod index 04abbcbc4989..8dd3fa52c1cb 100644 --- a/connector/blobuploadconnector/go.mod +++ b/processor/blobuploadprocessor/go.mod @@ -1,4 +1,4 @@ -module github.com/open-telemetry/opentelemetry-collector-contrib/connector/blobuploadconnector +module github.com/open-telemetry/opentelemetry-collector-contrib/processor/blobuploadprocessor go 1.22.0 @@ -6,12 +6,11 @@ require ( github.com/stretchr/testify v1.9.0 go.opentelemetry.io/collector/component v0.112.0 go.opentelemetry.io/collector/confmap v1.18.0 - go.opentelemetry.io/collector/connector v0.112.0 - go.opentelemetry.io/collector/connector/connectortest v0.112.0 go.opentelemetry.io/collector/consumer v0.112.0 go.opentelemetry.io/collector/consumer/consumertest v0.112.0 go.opentelemetry.io/collector/pdata v1.18.0 - go.opentelemetry.io/collector/pipeline v0.112.0 + go.opentelemetry.io/collector/processor v0.112.0 + go.opentelemetry.io/collector/processor/processortest v0.112.0 go.uber.org/goleak v1.3.0 ) @@ -31,12 +30,14 @@ require ( 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 - go.opentelemetry.io/collector v0.112.0 // indirect + github.com/rogpeppe/go-internal v1.12.0 // indirect + go.opentelemetry.io/collector/component/componentstatus v0.112.0 // indirect go.opentelemetry.io/collector/config/configtelemetry v0.112.0 // indirect - go.opentelemetry.io/collector/connector/connectorprofiles v0.112.0 // indirect go.opentelemetry.io/collector/consumer/consumerprofiles v0.112.0 // indirect go.opentelemetry.io/collector/pdata/pprofile v0.112.0 // indirect - go.opentelemetry.io/collector/pipeline/pipelineprofiles v0.112.0 // indirect + go.opentelemetry.io/collector/pdata/testdata v0.112.0 // indirect + go.opentelemetry.io/collector/pipeline v0.112.0 // indirect + go.opentelemetry.io/collector/processor/processorprofiles v0.112.0 // indirect go.opentelemetry.io/otel v1.31.0 // indirect go.opentelemetry.io/otel/metric v1.31.0 // indirect go.opentelemetry.io/otel/sdk v1.31.0 // indirect diff --git a/connector/blobuploadconnector/go.sum b/processor/blobuploadprocessor/go.sum similarity index 91% rename from connector/blobuploadconnector/go.sum rename to processor/blobuploadprocessor/go.sum index ec817bc0ee26..0bcf564cc816 100644 --- a/connector/blobuploadconnector/go.sum +++ b/processor/blobuploadprocessor/go.sum @@ -48,20 +48,14 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -go.opentelemetry.io/collector v0.112.0 h1:yyA9hC2FTIRs4T418cQHxgei82oa9uNugFQIeNjRzv0= -go.opentelemetry.io/collector v0.112.0/go.mod h1:AgSN5Wd8mcHaOnBTgo0zdS03E9HuFp2ccKpVRs5YFz8= go.opentelemetry.io/collector/component v0.112.0 h1:Hw125Tdb427yKkzFx3U/OsfPATYXsbURkc27dn19he8= go.opentelemetry.io/collector/component v0.112.0/go.mod h1:hV9PEgkNlVAySX+Oo/g7+NcLe234L04kRXw6uGj3VEw= +go.opentelemetry.io/collector/component/componentstatus v0.112.0 h1:khR9QKMv1v5MPa4I3TcNxNzFYVdi1x/+1U/44clQdls= +go.opentelemetry.io/collector/component/componentstatus v0.112.0/go.mod h1:cbpNsZrsOAt0/T9urCxMhbzOGs9ijgNDhyALQGs6H4A= go.opentelemetry.io/collector/config/configtelemetry v0.112.0 h1:MVBrWJUoqfKrORI38dY8OV0i5d1RRHR/ACIBu9TOcZ8= go.opentelemetry.io/collector/config/configtelemetry v0.112.0/go.mod h1:R0MBUxjSMVMIhljuDHWIygzzJWQyZHXXWIgQNxcFwhc= go.opentelemetry.io/collector/confmap v1.18.0 h1:UEOeJY8RW8lZ1O4lzHSGqolS7uzkpXQi5fa8SidKqQg= go.opentelemetry.io/collector/confmap v1.18.0/go.mod h1:GgNu1ElPGmLn9govqIfjaopvdspw4PJ9KeDtWC4E2Q4= -go.opentelemetry.io/collector/connector v0.112.0 h1:F7nLFJOaQBpowI4WwICm3ws/ua2mmke5zTqYezddLVY= -go.opentelemetry.io/collector/connector v0.112.0/go.mod h1:zr+qW7d3xfhhAiKTDodrO/PWn3w9cTu4nZ9kzPYc8ew= -go.opentelemetry.io/collector/connector/connectorprofiles v0.112.0 h1:jeGUmx1usnzrH/XyT2hhIEsa1ogSe08z1sR2KzV6UFY= -go.opentelemetry.io/collector/connector/connectorprofiles v0.112.0/go.mod h1:j96elpMwsro4TEQSDDvA8ocEl9USiId/vsZQGF9mouI= -go.opentelemetry.io/collector/connector/connectortest v0.112.0 h1:4rKkmqjtjSTYyIpD727zKy1bHxXkET2pbmN5jq2QdVs= -go.opentelemetry.io/collector/connector/connectortest v0.112.0/go.mod h1:PkVWrwvgI58yCiOTI0SPymeruNkrTrIpQ8Gq6lap3n8= go.opentelemetry.io/collector/consumer v0.112.0 h1:tfO4FpuQ8MsD7AxgslC3tRNVYjd9Xkus34BOExsG4fM= go.opentelemetry.io/collector/consumer v0.112.0/go.mod h1:ZKSeGvXvaofIlvPrWlARKQpONOmuw6R/yifgYCWHKRw= go.opentelemetry.io/collector/consumer/consumerprofiles v0.112.0 h1:ym+QxemlbWwfMSUto1hRTfcZeYbj2q8FpMzjk8O+X60= @@ -76,8 +70,12 @@ go.opentelemetry.io/collector/pdata/testdata v0.112.0 h1:7jJzNvRE+CpYrwHbAYwPiN9 go.opentelemetry.io/collector/pdata/testdata v0.112.0/go.mod h1:9kO148Qp12B93SSUE52s0QGGV8Nf9RFN2G/PnZx3l+w= go.opentelemetry.io/collector/pipeline v0.112.0 h1:jqKDdb8k53OLPibvxzX6fmMec0ZHAtqe4p2+cuHclEI= go.opentelemetry.io/collector/pipeline v0.112.0/go.mod h1:4vOvjVsoYTHVGTbfFwqfnQOSV2K3RKUHofh3jNRc2Mg= -go.opentelemetry.io/collector/pipeline/pipelineprofiles v0.112.0 h1:opXGNrlJAjYRKn2xMWJNr8E9sPDE+hKL//0sE+RMlQI= -go.opentelemetry.io/collector/pipeline/pipelineprofiles v0.112.0/go.mod h1:c9yn4x+vY3G10eLCRuUu/oH7Y8YdE/BsgmLWmfHkaNY= +go.opentelemetry.io/collector/processor v0.112.0 h1:nMv9DOBYR9MB78ddUgY3A3ytwAwk3t4HQMNIu+w8o0g= +go.opentelemetry.io/collector/processor v0.112.0/go.mod h1:AJ8EHq8Z/ev90f4gU6G5ULUncdpWmBRATYk8ioR3pvw= +go.opentelemetry.io/collector/processor/processorprofiles v0.112.0 h1:Aef68SAbmBbhbsZZPuZb0ECwkV05vIcHIizGOGbWsbM= +go.opentelemetry.io/collector/processor/processorprofiles v0.112.0/go.mod h1:OUS7GcPCvFAIERSUFJLMtj6MSUOTCuS2pGKB7B+OHXs= +go.opentelemetry.io/collector/processor/processortest v0.112.0 h1:kW7kZ6EC1YjBiOvdajxN/DxvVljr9MKMemHheoaYcFc= +go.opentelemetry.io/collector/processor/processortest v0.112.0/go.mod h1:idZ8tCMswGQ8VsPBLtPDL2N7+pvtiMYkz6vNFPPew2M= go.opentelemetry.io/otel v1.31.0 h1:NsJcKPIW0D0H3NgzPDHmo0WW6SptzPdqg/L1zsIm2hY= go.opentelemetry.io/otel v1.31.0/go.mod h1:O0C14Yl9FgkjqcCZAsE053C13OaddMYr/hz6clDkEJE= go.opentelemetry.io/otel/metric v1.31.0 h1:FSErL0ATQAmYHUIzSezZibnyVlft1ybhy4ozRPcF2fE= diff --git a/connector/blobuploadconnector/internal/metadata/generated_status.go b/processor/blobuploadprocessor/internal/metadata/generated_status.go similarity index 65% rename from connector/blobuploadconnector/internal/metadata/generated_status.go rename to processor/blobuploadprocessor/internal/metadata/generated_status.go index 45a762cf2146..9ff4e2ef2052 100644 --- a/connector/blobuploadconnector/internal/metadata/generated_status.go +++ b/processor/blobuploadprocessor/internal/metadata/generated_status.go @@ -12,6 +12,6 @@ var ( ) const ( - TracesToTracesStability = component.StabilityLevelDevelopment - LogsToLogsStability = component.StabilityLevelDevelopment + TracesStability = component.StabilityLevelDevelopment + LogsStability = component.StabilityLevelDevelopment ) diff --git a/processor/blobuploadprocessor/logs.go b/processor/blobuploadprocessor/logs.go new file mode 100644 index 000000000000..c4a60640d5ae --- /dev/null +++ b/processor/blobuploadprocessor/logs.go @@ -0,0 +1,47 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package blobuploadprocessor // import "github.com/open-telemetry/opentelemetry-collector-contrib/processor/blobuploadprocessor" + +import ( + "context" + + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/consumer" + "go.opentelemetry.io/collector/pdata/plog" + "go.opentelemetry.io/collector/processor" +) + +type logsProcessorImpl struct { + nextConsumer consumer.Logs +} + +func (c *logsProcessorImpl) Start(_ context.Context, _ component.Host) error { + // TODO: implement + return nil +} + +func (c *logsProcessorImpl) Shutdown(_ context.Context) error { + // TODO: implement + return nil +} + +func (c *logsProcessorImpl) ConsumeLogs(ctx context.Context, ld plog.Logs) error { + // TODO: implement + return c.nextConsumer.ConsumeLogs(ctx, ld) +} + +func (c *logsProcessorImpl) Capabilities() consumer.Capabilities { + return consumer.Capabilities{MutatesData: false} +} + +func createLogsProcessor(_ deps) processor.CreateLogsFunc { + return func( + _ context.Context, + _ processor.Settings, + _ component.Config, + nextConsumer consumer.Logs) (processor.Logs, error) { + // TODO: implement + return &logsProcessorImpl{nextConsumer: nextConsumer}, nil + } +} diff --git a/connector/blobuploadconnector/logs_test.go b/processor/blobuploadprocessor/logs_test.go similarity index 73% rename from connector/blobuploadconnector/logs_test.go rename to processor/blobuploadprocessor/logs_test.go index 750d695177f0..62f7f132dfc1 100644 --- a/connector/blobuploadconnector/logs_test.go +++ b/processor/blobuploadprocessor/logs_test.go @@ -1,4 +1,4 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package blobuploadconnector +package blobuploadprocessor diff --git a/connector/blobuploadconnector/metadata.yaml b/processor/blobuploadprocessor/metadata.yaml similarity index 82% rename from connector/blobuploadconnector/metadata.yaml rename to processor/blobuploadprocessor/metadata.yaml index cce3ff0ca72b..6bbf3558848b 100644 --- a/connector/blobuploadconnector/metadata.yaml +++ b/processor/blobuploadprocessor/metadata.yaml @@ -2,14 +2,14 @@ type: blobuploadconnector scope_name: otelcol/blobuploadconnector status: - class: connector + class: processor stability: # Implementation still in-progress. Please follow along at: # https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/33737 - development: [traces_to_traces, logs_to_logs] + development: [traces, logs] distributions: [contrib] codeowners: - active: [michaelsafyan, dashpole] + active: [michaelsafyan, dashpole, braydonk] tests: config: diff --git a/connector/blobuploadconnector/package_test.go b/processor/blobuploadprocessor/package_test.go similarity index 59% rename from connector/blobuploadconnector/package_test.go rename to processor/blobuploadprocessor/package_test.go index 1eef18d7ebe0..94631ec9311a 100644 --- a/connector/blobuploadconnector/package_test.go +++ b/processor/blobuploadprocessor/package_test.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package blobuploadconnector +package blobuploadprocessor import ( "context" @@ -10,18 +10,18 @@ import ( "github.com/stretchr/testify/assert" "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/component/componenttest" - "go.opentelemetry.io/collector/connector/connectortest" "go.opentelemetry.io/collector/consumer/consumertest" "go.opentelemetry.io/collector/pdata/plog" "go.opentelemetry.io/collector/pdata/ptrace" + "go.opentelemetry.io/collector/processor/processortest" ) func TestNewFactorySucceedsAndReturnsValidResult(t *testing.T) { f := NewFactory() assert.NotNil(t, f) assert.NotNil(t, f.CreateDefaultConfig()) - assert.Equal(t, component.StabilityLevelDevelopment, f.TracesToTracesStability()) - assert.Equal(t, component.StabilityLevelDevelopment, f.LogsToLogsStability()) + assert.Equal(t, component.StabilityLevelDevelopment, f.TracesStability()) + assert.Equal(t, component.StabilityLevelDevelopment, f.LogsStability()) } func TestNewFactoryDefaultConfigIsValid(t *testing.T) { @@ -33,108 +33,108 @@ func TestNewFactoryDefaultConfigIsValid(t *testing.T) { assert.NoError(t, componenttest.CheckConfigStruct(cfg)) } -func TestCanStartUpAndShutDownTracesToTracesWithDefaultConfig(t *testing.T) { +func TestCanStartUpAndShutDownTracesWithDefaultConfig(t *testing.T) { f := NewFactory() assert.NotNil(t, f) assert.NotNil(t, f.CreateDefaultConfig()) consumer := consumertest.NewNop() - settings := connectortest.NewNopSettings() + settings := processortest.NewNopSettings() cfg := f.CreateDefaultConfig() createCtx := context.Background() - tracesToTraces, createErr := f.CreateTracesToTraces(createCtx, settings, cfg, consumer) + Traces, createErr := f.CreateTraces(createCtx, settings, cfg, consumer) assert.NoError(t, createErr) - assert.NotNil(t, tracesToTraces) + assert.NotNil(t, Traces) host := componenttest.NewNopHost() startCtx := context.Background() - startErr := tracesToTraces.Start(startCtx, host) + startErr := Traces.Start(startCtx, host) assert.NoError(t, startErr) shutDownCtx := context.Background() - shutDownErr := tracesToTraces.Shutdown(shutDownCtx) + shutDownErr := Traces.Shutdown(shutDownCtx) assert.NoError(t, shutDownErr) } -func TestCanStartUpAndShutDownLogsToLogsWithDefaultConfig(t *testing.T) { +func TestCanStartUpAndShutDownLogsWithDefaultConfig(t *testing.T) { f := NewFactory() assert.NotNil(t, f) assert.NotNil(t, f.CreateDefaultConfig()) consumer := consumertest.NewNop() - settings := connectortest.NewNopSettings() + settings := processortest.NewNopSettings() cfg := f.CreateDefaultConfig() createCtx := context.Background() - logsToLogs, createErr := f.CreateLogsToLogs(createCtx, settings, cfg, consumer) + Logs, createErr := f.CreateLogs(createCtx, settings, cfg, consumer) assert.NoError(t, createErr) - assert.NotNil(t, logsToLogs) + assert.NotNil(t, Logs) host := componenttest.NewNopHost() startCtx := context.Background() - startErr := logsToLogs.Start(startCtx, host) + startErr := Logs.Start(startCtx, host) assert.NoError(t, startErr) shutDownCtx := context.Background() - shutDownErr := logsToLogs.Shutdown(shutDownCtx) + shutDownErr := Logs.Shutdown(shutDownCtx) assert.NoError(t, shutDownErr) } -func TestCanWriteTracesToTracesWithDefaultConfig(t *testing.T) { +func TestCanWriteTracesWithDefaultConfig(t *testing.T) { f := NewFactory() assert.NotNil(t, f) assert.NotNil(t, f.CreateDefaultConfig()) consumer := consumertest.NewNop() - settings := connectortest.NewNopSettings() + settings := processortest.NewNopSettings() cfg := f.CreateDefaultConfig() createCtx := context.Background() - tracesToTraces, createErr := f.CreateTracesToTraces(createCtx, settings, cfg, consumer) + Traces, createErr := f.CreateTraces(createCtx, settings, cfg, consumer) assert.NoError(t, createErr) - assert.NotNil(t, tracesToTraces) + assert.NotNil(t, Traces) host := componenttest.NewNopHost() startCtx := context.Background() - startErr := tracesToTraces.Start(startCtx, host) + startErr := Traces.Start(startCtx, host) assert.NoError(t, startErr) consumeCtx := context.Background() dataToConsume := ptrace.NewTraces() - consumeErr := tracesToTraces.ConsumeTraces(consumeCtx, dataToConsume) + consumeErr := Traces.ConsumeTraces(consumeCtx, dataToConsume) assert.NoError(t, consumeErr) shutDownCtx := context.Background() - shutDownErr := tracesToTraces.Shutdown(shutDownCtx) + shutDownErr := Traces.Shutdown(shutDownCtx) assert.NoError(t, shutDownErr) } -func TestCanWriteLogsToLogsWithDefaultConfig(t *testing.T) { +func TestCanWriteLogsWithDefaultConfig(t *testing.T) { f := NewFactory() assert.NotNil(t, f) assert.NotNil(t, f.CreateDefaultConfig()) consumer := consumertest.NewNop() - settings := connectortest.NewNopSettings() + settings := processortest.NewNopSettings() cfg := f.CreateDefaultConfig() createCtx := context.Background() - logsToLogs, createErr := f.CreateLogsToLogs(createCtx, settings, cfg, consumer) + Logs, createErr := f.CreateLogs(createCtx, settings, cfg, consumer) assert.NoError(t, createErr) - assert.NotNil(t, logsToLogs) + assert.NotNil(t, Logs) host := componenttest.NewNopHost() startCtx := context.Background() - startErr := logsToLogs.Start(startCtx, host) + startErr := Logs.Start(startCtx, host) assert.NoError(t, startErr) consumeCtx := context.Background() dataToConsume := plog.NewLogs() - consumeErr := logsToLogs.ConsumeLogs(consumeCtx, dataToConsume) + consumeErr := Logs.ConsumeLogs(consumeCtx, dataToConsume) assert.NoError(t, consumeErr) shutDownCtx := context.Background() - shutDownErr := logsToLogs.Shutdown(shutDownCtx) + shutDownErr := Logs.Shutdown(shutDownCtx) assert.NoError(t, shutDownErr) } diff --git a/processor/blobuploadprocessor/traces.go b/processor/blobuploadprocessor/traces.go new file mode 100644 index 000000000000..0156b01adef2 --- /dev/null +++ b/processor/blobuploadprocessor/traces.go @@ -0,0 +1,47 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package blobuploadprocessor // import "github.com/open-telemetry/opentelemetry-collector-contrib/processor/blobuploadprocessor" + +import ( + "context" + + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/consumer" + "go.opentelemetry.io/collector/pdata/ptrace" + "go.opentelemetry.io/collector/processor" +) + +type tracesProcessorImpl struct { + nextConsumer consumer.Traces +} + +func (c *tracesProcessorImpl) Start(_ context.Context, _ component.Host) error { + // TODO: implement + return nil +} + +func (c *tracesProcessorImpl) Shutdown(_ context.Context) error { + // TODO: implement + return nil +} + +func (c *tracesProcessorImpl) ConsumeTraces(ctx context.Context, td ptrace.Traces) error { + // TODO: implement + return c.nextConsumer.ConsumeTraces(ctx, td) +} + +func (c *tracesProcessorImpl) Capabilities() consumer.Capabilities { + return consumer.Capabilities{MutatesData: false} +} + +func createTracesProcessor(_ deps) processor.CreateTracesFunc { + return func( + _ context.Context, + _ processor.Settings, + _ component.Config, + nextConsumer consumer.Traces) (processor.Traces, error) { + // TODO: implement + return &tracesProcessorImpl{nextConsumer: nextConsumer}, nil + } +} diff --git a/connector/blobuploadconnector/traces_test.go b/processor/blobuploadprocessor/traces_test.go similarity index 73% rename from connector/blobuploadconnector/traces_test.go rename to processor/blobuploadprocessor/traces_test.go index 750d695177f0..62f7f132dfc1 100644 --- a/connector/blobuploadconnector/traces_test.go +++ b/processor/blobuploadprocessor/traces_test.go @@ -1,4 +1,4 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package blobuploadconnector +package blobuploadprocessor diff --git a/versions.yaml b/versions.yaml index bd07fea968a5..57521616081e 100644 --- a/versions.yaml +++ b/versions.yaml @@ -12,7 +12,6 @@ module-sets: - github.com/open-telemetry/opentelemetry-collector-contrib/confmap/provider/aesprovider - github.com/open-telemetry/opentelemetry-collector-contrib/confmap/provider/s3provider - github.com/open-telemetry/opentelemetry-collector-contrib/confmap/provider/secretsmanagerprovider - - github.com/open-telemetry/opentelemetry-collector-contrib/connector/blobuploadconnector - github.com/open-telemetry/opentelemetry-collector-contrib/connector/countconnector - github.com/open-telemetry/opentelemetry-collector-contrib/connector/datadogconnector - github.com/open-telemetry/opentelemetry-collector-contrib/connector/exceptionsconnector @@ -164,6 +163,7 @@ module-sets: - github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/zipkin - github.com/open-telemetry/opentelemetry-collector-contrib/pkg/winperfcounters - github.com/open-telemetry/opentelemetry-collector-contrib/processor/attributesprocessor + - github.com/open-telemetry/opentelemetry-collector-contrib/processor/blobuploadprocessor - github.com/open-telemetry/opentelemetry-collector-contrib/processor/cumulativetodeltaprocessor - github.com/open-telemetry/opentelemetry-collector-contrib/processor/coralogixprocessor - github.com/open-telemetry/opentelemetry-collector-contrib/processor/deltatocumulativeprocessor