diff --git a/.chloggen/profiles-connector.yaml b/.chloggen/profiles-connector.yaml new file mode 100644 index 00000000000..3cddea2ffad --- /dev/null +++ b/.chloggen/profiles-connector.yaml @@ -0,0 +1,25 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: new_component + +# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) +component: connector/connectorprofiles + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Allow handling profiles in connector. + +# One or more tracking issues or pull requests related to the change +issues: [10703] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: + +# Optional: The change log or logs in which this entry should be included. +# e.g. '[user]' or '[user, api]' +# Include 'user' if the change is relevant to end users. +# Include 'api' if there is a change to a library API. +# Default: '[user]' +change_logs: [api] diff --git a/Makefile b/Makefile index ba35b2e397e..052cbcd5d81 100644 --- a/Makefile +++ b/Makefile @@ -259,6 +259,7 @@ check-contrib: -replace go.opentelemetry.io/collector=$(CURDIR) \ -replace go.opentelemetry.io/collector/client=$(CURDIR)/client \ -replace go.opentelemetry.io/collector/component=$(CURDIR)/component \ + -replace go.opentelemetry.io/collector/component/componentprofiles=$(CURDIR)/component/componentprofiles \ -replace go.opentelemetry.io/collector/component/componentstatus=$(CURDIR)/component/componentstatus \ -replace go.opentelemetry.io/collector/config/configauth=$(CURDIR)/config/configauth \ -replace go.opentelemetry.io/collector/config/configcompression=$(CURDIR)/config/configcompression \ @@ -322,6 +323,7 @@ restore-contrib: -dropreplace go.opentelemetry.io/collector \ -dropreplace go.opentelemetry.io/collector/client \ -dropreplace go.opentelemetry.io/collector/component \ + -dropreplace go.opentelemetry.io/collector/component/componentprofiles \ -dropreplace go.opentelemetry.io/collector/component/componentstatus \ -dropreplace go.opentelemetry.io/collector/config/configauth \ -dropreplace go.opentelemetry.io/collector/config/configcompression \ diff --git a/cmd/builder/internal/builder/main_test.go b/cmd/builder/internal/builder/main_test.go index 3c6a614e609..3dc92e9f2dc 100644 --- a/cmd/builder/internal/builder/main_test.go +++ b/cmd/builder/internal/builder/main_test.go @@ -41,6 +41,7 @@ var ( replaceModules = []string{ "", "/component", + "/component/componentprofiles", "/client", "/config/configauth", "/config/configcompression", diff --git a/cmd/builder/test/core.builder.yaml b/cmd/builder/test/core.builder.yaml index 33c8d3ed39a..ab0f73bf1ff 100644 --- a/cmd/builder/test/core.builder.yaml +++ b/cmd/builder/test/core.builder.yaml @@ -21,6 +21,7 @@ replaces: - go.opentelemetry.io/collector => ${WORKSPACE_DIR} - go.opentelemetry.io/collector/client => ${WORKSPACE_DIR}/client - go.opentelemetry.io/collector/component => ${WORKSPACE_DIR}/component + - go.opentelemetry.io/collector/component/componentprofiles => ${WORKSPACE_DIR}/component/componentprofiles - go.opentelemetry.io/collector/config/configauth => ${WORKSPACE_DIR}/config/configauth - go.opentelemetry.io/collector/config/configcompression => ${WORKSPACE_DIR}/config/configcompression - go.opentelemetry.io/collector/config/configgrpc => ${WORKSPACE_DIR}/config/configgrpc diff --git a/cmd/otelcorecol/builder-config.yaml b/cmd/otelcorecol/builder-config.yaml index ec2501f5706..3dfa4b40729 100644 --- a/cmd/otelcorecol/builder-config.yaml +++ b/cmd/otelcorecol/builder-config.yaml @@ -45,6 +45,7 @@ replaces: - go.opentelemetry.io/collector/client => ../../client - go.opentelemetry.io/collector/otelcol => ../../otelcol - go.opentelemetry.io/collector/component => ../../component + - go.opentelemetry.io/collector/component/componentprofiles => ../../component/componentprofiles - go.opentelemetry.io/collector/config/configauth => ../../config/configauth - go.opentelemetry.io/collector/config/configcompression => ../../config/configcompression - go.opentelemetry.io/collector/config/configgrpc => ../../config/configgrpc diff --git a/cmd/otelcorecol/go.mod b/cmd/otelcorecol/go.mod index d645f233b49..c16d7426a0f 100644 --- a/cmd/otelcorecol/go.mod +++ b/cmd/otelcorecol/go.mod @@ -80,6 +80,7 @@ require ( github.com/yusufpapurcu/wmi v1.2.4 // indirect go.opentelemetry.io/collector v0.106.1 // indirect go.opentelemetry.io/collector/client v0.106.1 // indirect + go.opentelemetry.io/collector/component/componentprofiles v0.0.0-00010101000000-000000000000 // indirect go.opentelemetry.io/collector/config/configauth v0.106.1 // indirect go.opentelemetry.io/collector/config/configcompression v1.12.0 // indirect go.opentelemetry.io/collector/config/configgrpc v0.106.1 // indirect @@ -145,6 +146,8 @@ replace go.opentelemetry.io/collector/otelcol => ../../otelcol replace go.opentelemetry.io/collector/component => ../../component +replace go.opentelemetry.io/collector/component/componentprofiles => ../../component/componentprofiles + replace go.opentelemetry.io/collector/config/configauth => ../../config/configauth replace go.opentelemetry.io/collector/config/configcompression => ../../config/configcompression diff --git a/connector/connectorprofiles/Makefile b/connector/connectorprofiles/Makefile new file mode 100644 index 00000000000..ded7a36092d --- /dev/null +++ b/connector/connectorprofiles/Makefile @@ -0,0 +1 @@ +include ../../Makefile.Common diff --git a/connector/connectorprofiles/connector.go b/connector/connectorprofiles/connector.go new file mode 100644 index 00000000000..c9888e877d8 --- /dev/null +++ b/connector/connectorprofiles/connector.go @@ -0,0 +1,80 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package connector // import "go.opentelemetry.io/collector/connector/connectorprofiles" + +import ( + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/connector" + "go.opentelemetry.io/collector/connector/internal" +) + +// A Profiles connector acts as an exporter from a profiles pipeline and a receiver +// to one or more traces, metrics, logs, or profiles pipelines. +// Profiles feeds a consumer.Traces, consumer.Metrics, consumer.Logs, or consumerprofiles.Profiles with data. +// +// Examples: +// - Profiles could be collected in one pipeline and routed to another profiles pipeline +// based on criteria such as attributes or other content of the profile. The second +// pipeline can then process and export the profile to the appropriate backend. +// - Profiles could be summarized by a metrics connector that emits statistics describing +// the number of profiles observed. +// - Profiles could be analyzed by a logs connector that emits events when particular +// criteria are met. +type Profiles = internal.Profiles + +// CreateTracesToProfilesFunc is the equivalent of Factory.CreateTracesToProfiles(). +type CreateTracesToProfilesFunc = internal.CreateTracesToProfilesFunc + +// CreateMetricsToProfilesFunc is the equivalent of Factory.CreateMetricsToProfiles(). +type CreateMetricsToProfilesFunc = internal.CreateMetricsToProfilesFunc + +// CreateLogsToProfilesFunc is the equivalent of Factory.CreateLogsToProfiles(). +type CreateLogsToProfilesFunc = internal.CreateLogsToProfilesFunc + +// CreateProfilesToProfilesFunc is the equivalent of Factory.CreateProfilesToProfiles(). +type CreateProfilesToProfilesFunc = internal.CreateProfilesToProfilesFunc + +// CreateProfilesToTracesFunc is the equivalent of Factory.CreateProfilesToTraces(). +type CreateProfilesToTracesFunc = internal.CreateProfilesToTracesFunc + +// CreateProfilesToMetricsFunc is the equivalent of Factory.CreateProfilesToMetrics(). +type CreateProfilesToMetricsFunc = internal.CreateProfilesToMetricsFunc + +// CreateProfilesToLogsFunc is the equivalent of Factory.CreateProfilesToLogs(). +type CreateProfilesToLogsFunc = internal.CreateProfilesToLogsFunc + +// WithTracesToProfiles overrides the default "error not supported" implementation for WithTracesToProfiles and the default "undefined" stability level. +func WithTracesToProfiles(createTracesToProfiles CreateTracesToProfilesFunc, sl component.StabilityLevel) connector.FactoryOption { + return internal.WithTracesToProfiles(createTracesToProfiles, sl) +} + +// WithMetricsToProfiles overrides the default "error not supported" implementation for WithMetricsToProfiles and the default "undefined" stability level. +func WithMetricsToProfiles(createMetricsToProfiles CreateMetricsToProfilesFunc, sl component.StabilityLevel) connector.FactoryOption { + return internal.WithMetricsToProfiles(createMetricsToProfiles, sl) +} + +// WithLogsToProfiles overrides the default "error not supported" implementation for WithLogsToProfiles and the default "undefined" stability level. +func WithLogsToProfiles(createLogsToProfiles CreateLogsToProfilesFunc, sl component.StabilityLevel) connector.FactoryOption { + return internal.WithLogsToProfiles(createLogsToProfiles, sl) +} + +// WithProfilesToProfiles overrides the default "error not supported" implementation for WithProfilesToProfiles and the default "undefined" stability level. +func WithProfilesToProfiles(createProfilesToProfiles CreateProfilesToProfilesFunc, sl component.StabilityLevel) connector.FactoryOption { + return internal.WithProfilesToProfiles(createProfilesToProfiles, sl) +} + +// WithProfilesToTraces overrides the default "error not supported" implementation for WithProfilesToTraces and the default "undefined" stability level. +func WithProfilesToTraces(createProfilesToTraces CreateProfilesToTracesFunc, sl component.StabilityLevel) connector.FactoryOption { + return internal.WithProfilesToTraces(createProfilesToTraces, sl) +} + +// WithProfilesToMetrics overrides the default "error not supported" implementation for WithProfilesToMetrics and the default "undefined" stability level. +func WithProfilesToMetrics(createProfilesToMetrics CreateProfilesToMetricsFunc, sl component.StabilityLevel) connector.FactoryOption { + return internal.WithProfilesToMetrics(createProfilesToMetrics, sl) +} + +// WithProfilesToLogs overrides the default "error not supported" implementation for WithProfilesToLogs and the default "undefined" stability level. +func WithProfilesToLogs(createProfilesToLogs CreateProfilesToLogsFunc, sl component.StabilityLevel) connector.FactoryOption { + return internal.WithProfilesToLogs(createProfilesToLogs, sl) +} diff --git a/connector/connectorprofiles/connector_test.go b/connector/connectorprofiles/connector_test.go new file mode 100644 index 00000000000..e40f83c0b6d --- /dev/null +++ b/connector/connectorprofiles/connector_test.go @@ -0,0 +1,144 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package connector // import "go.opentelemetry.io/collector/connector" + +import ( + "context" + "testing" + + "github.com/stretchr/testify/assert" + + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componentprofiles" + "go.opentelemetry.io/collector/connector" + "go.opentelemetry.io/collector/connector/internal" + "go.opentelemetry.io/collector/consumer" + "go.opentelemetry.io/collector/consumer/consumerprofiles" + "go.opentelemetry.io/collector/consumer/consumertest" +) + +var ( + testType = component.MustNewType("test") + testID = component.MustNewIDWithName("type", "name") +) + +func TestNewFactoryNoOptions(t *testing.T) { + defaultCfg := struct{}{} + factory := connector.NewFactory(testType, func() component.Config { return &defaultCfg }) + assert.EqualValues(t, testType, factory.Type()) + assert.EqualValues(t, &defaultCfg, factory.CreateDefaultConfig()) + + _, err := factory.CreateTracesToProfiles(context.Background(), connector.Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) + assert.Equal(t, err, internal.ErrDataTypes(testID, component.DataTypeTraces, componentprofiles.DataTypeProfiles)) + _, err = factory.CreateMetricsToProfiles(context.Background(), connector.Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) + assert.Equal(t, err, internal.ErrDataTypes(testID, component.DataTypeMetrics, componentprofiles.DataTypeProfiles)) + _, err = factory.CreateLogsToProfiles(context.Background(), connector.Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) + assert.Equal(t, err, internal.ErrDataTypes(testID, component.DataTypeLogs, componentprofiles.DataTypeProfiles)) + + _, err = factory.CreateProfilesToTraces(context.Background(), connector.Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) + assert.Equal(t, err, internal.ErrDataTypes(testID, componentprofiles.DataTypeProfiles, component.DataTypeTraces)) + _, err = factory.CreateProfilesToMetrics(context.Background(), connector.Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) + assert.Equal(t, err, internal.ErrDataTypes(testID, componentprofiles.DataTypeProfiles, component.DataTypeMetrics)) + _, err = factory.CreateProfilesToLogs(context.Background(), connector.Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) + assert.Equal(t, err, internal.ErrDataTypes(testID, componentprofiles.DataTypeProfiles, component.DataTypeLogs)) +} + +func TestNewFactoryWithSameTypes(t *testing.T) { + defaultCfg := struct{}{} + factory := connector.NewFactory(testType, func() component.Config { return &defaultCfg }, + WithProfilesToProfiles(createProfilesToProfiles, component.StabilityLevelAlpha), + ) + assert.EqualValues(t, testType, factory.Type()) + assert.EqualValues(t, &defaultCfg, factory.CreateDefaultConfig()) + + assert.Equal(t, component.StabilityLevelAlpha, factory.ProfilesToProfilesStability()) + _, err := factory.CreateProfilesToProfiles(context.Background(), connector.Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) + assert.NoError(t, err) + + _, err = factory.CreateProfilesToTraces(context.Background(), connector.Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) + assert.Equal(t, err, internal.ErrDataTypes(testID, componentprofiles.DataTypeProfiles, component.DataTypeTraces)) + _, err = factory.CreateProfilesToMetrics(context.Background(), connector.Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) + assert.Equal(t, err, internal.ErrDataTypes(testID, componentprofiles.DataTypeProfiles, component.DataTypeMetrics)) + _, err = factory.CreateProfilesToLogs(context.Background(), connector.Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) + assert.Equal(t, err, internal.ErrDataTypes(testID, componentprofiles.DataTypeProfiles, component.DataTypeLogs)) +} + +func TestNewFactoryWithTranslateTypes(t *testing.T) { + defaultCfg := struct{}{} + factory := connector.NewFactory(testType, func() component.Config { return &defaultCfg }, + WithTracesToProfiles(createTracesToProfiles, component.StabilityLevelBeta), + WithMetricsToProfiles(createMetricsToProfiles, component.StabilityLevelDevelopment), + WithLogsToProfiles(createLogsToProfiles, component.StabilityLevelAlpha), + + WithProfilesToTraces(createProfilesToTraces, component.StabilityLevelBeta), + WithProfilesToMetrics(createProfilesToMetrics, component.StabilityLevelDevelopment), + WithProfilesToLogs(createProfilesToLogs, component.StabilityLevelAlpha), + ) + assert.EqualValues(t, testType, factory.Type()) + assert.EqualValues(t, &defaultCfg, factory.CreateDefaultConfig()) + + _, err := factory.CreateProfilesToProfiles(context.Background(), connector.Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) + assert.Equal(t, err, internal.ErrDataTypes(testID, componentprofiles.DataTypeProfiles, componentprofiles.DataTypeProfiles)) + + assert.Equal(t, component.StabilityLevelBeta, factory.TracesToProfilesStability()) + _, err = factory.CreateTracesToProfiles(context.Background(), connector.Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) + assert.NoError(t, err) + + assert.Equal(t, component.StabilityLevelDevelopment, factory.MetricsToProfilesStability()) + _, err = factory.CreateMetricsToProfiles(context.Background(), connector.Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) + assert.NoError(t, err) + + assert.Equal(t, component.StabilityLevelAlpha, factory.LogsToProfilesStability()) + _, err = factory.CreateLogsToProfiles(context.Background(), connector.Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) + assert.NoError(t, err) + + assert.Equal(t, component.StabilityLevelBeta, factory.ProfilesToTracesStability()) + _, err = factory.CreateProfilesToTraces(context.Background(), connector.Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) + assert.NoError(t, err) + + assert.Equal(t, component.StabilityLevelDevelopment, factory.ProfilesToMetricsStability()) + _, err = factory.CreateProfilesToMetrics(context.Background(), connector.Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) + assert.NoError(t, err) + + assert.Equal(t, component.StabilityLevelAlpha, factory.ProfilesToLogsStability()) + _, err = factory.CreateProfilesToLogs(context.Background(), connector.Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) + assert.NoError(t, err) +} + +var nopInstance = &nopConnector{ + Consumer: consumertest.NewNop(), +} + +// nopConnector stores consumed traces and metrics for testing purposes. +type nopConnector struct { + component.StartFunc + component.ShutdownFunc + consumertest.Consumer +} + +func createTracesToProfiles(context.Context, connector.Settings, component.Config, consumerprofiles.Profiles) (connector.Traces, error) { + return nopInstance, nil +} + +func createMetricsToProfiles(context.Context, connector.Settings, component.Config, consumerprofiles.Profiles) (connector.Metrics, error) { + return nopInstance, nil +} + +func createLogsToProfiles(context.Context, connector.Settings, component.Config, consumerprofiles.Profiles) (connector.Logs, error) { + return nopInstance, nil +} + +func createProfilesToProfiles(context.Context, connector.Settings, component.Config, consumerprofiles.Profiles) (Profiles, error) { + return nopInstance, nil +} + +func createProfilesToTraces(context.Context, connector.Settings, component.Config, consumer.Traces) (Profiles, error) { + return nopInstance, nil +} +func createProfilesToMetrics(context.Context, connector.Settings, component.Config, consumer.Metrics) (Profiles, error) { + return nopInstance, nil +} +func createProfilesToLogs(context.Context, connector.Settings, component.Config, consumer.Logs) (Profiles, error) { + return nopInstance, nil +} diff --git a/connector/connectorprofiles/go.mod b/connector/connectorprofiles/go.mod new file mode 100644 index 00000000000..c53c47d7a6f --- /dev/null +++ b/connector/connectorprofiles/go.mod @@ -0,0 +1,66 @@ +module go.opentelemetry.io/collector/connector/connectorprofiles + +go 1.21.0 + +require ( + github.com/stretchr/testify v1.9.0 + go.opentelemetry.io/collector/component v0.106.1 + go.opentelemetry.io/collector/component/componentprofiles v0.0.0-20240723122248-8b5e2318374d + go.opentelemetry.io/collector/connector v0.106.1 + go.opentelemetry.io/collector/consumer v0.106.1 + go.opentelemetry.io/collector/consumer/consumerprofiles v0.106.1 + go.opentelemetry.io/collector/consumer/consumertest v0.106.1 +) + +require ( + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/json-iterator/go v1.1.12 // 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.106.1 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.106.1 // indirect + go.opentelemetry.io/collector/pdata v1.12.0 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.106.1 // indirect + go.opentelemetry.io/otel v1.28.0 // indirect + go.opentelemetry.io/otel/metric v1.28.0 // indirect + go.opentelemetry.io/otel/trace v1.28.0 // indirect + go.uber.org/multierr v1.11.0 // indirect + go.uber.org/zap v1.27.0 // indirect + golang.org/x/net v0.26.0 // indirect + golang.org/x/sys v0.21.0 // indirect + golang.org/x/text v0.16.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect + google.golang.org/grpc v1.65.0 // indirect + google.golang.org/protobuf v1.34.2 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) + +replace go.opentelemetry.io/collector/connector => ../ + +replace go.opentelemetry.io/collector/consumer => ../../consumer + +replace go.opentelemetry.io/collector/consumer/consumertest => ../../consumer/consumertest + +replace go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile + +replace go.opentelemetry.io/collector/featuregate => ../../featuregate + +replace go.opentelemetry.io/collector/consumer/consumerprofiles => ../../consumer/consumerprofiles + +replace go.opentelemetry.io/collector/component/componentprofiles => ../../component/componentprofiles + +replace go.opentelemetry.io/collector => ../.. + +replace go.opentelemetry.io/collector/internal/globalgates => ../../internal/globalgates + +replace go.opentelemetry.io/collector/confmap => ../../confmap + +replace go.opentelemetry.io/collector/component => ../../component + +replace go.opentelemetry.io/collector/pdata => ../../pdata + +replace go.opentelemetry.io/collector/config/configtelemetry => ../../config/configtelemetry + +replace go.opentelemetry.io/collector/pdata/testdata => ../../pdata/testdata diff --git a/connector/connectorprofiles/go.sum b/connector/connectorprofiles/go.sum new file mode 100644 index 00000000000..837886f3a46 --- /dev/null +++ b/connector/connectorprofiles/go.sum @@ -0,0 +1,111 @@ +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +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.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/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/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/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/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= +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/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= +github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= +github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= +github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= +github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= +github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= +github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= +github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= +github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= +github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= +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/otel v1.28.0 h1:/SqNcYk+idO0CxKEUOtKQClMK/MimZihKYMruSMViUo= +go.opentelemetry.io/otel v1.28.0/go.mod h1:q68ijF8Fc8CnMHKyzqL6akLO46ePnjkgfIMIjUIX9z4= +go.opentelemetry.io/otel/exporters/prometheus v0.50.0 h1:2Ewsda6hejmbhGFyUvWZjUThC98Cf8Zy6g0zkIimOng= +go.opentelemetry.io/otel/exporters/prometheus v0.50.0/go.mod h1:pMm5PkUo5YwbLiuEf7t2xg4wbP0/eSJrMxIMxKosynY= +go.opentelemetry.io/otel/metric v1.28.0 h1:f0HGvSl1KRAU1DLgLGFjrwVyismPlnuU6JD6bOeuA5Q= +go.opentelemetry.io/otel/metric v1.28.0/go.mod h1:Fb1eVBFZmLVTMb6PPohq3TO9IIhUisDsbJoL/+uQW4s= +go.opentelemetry.io/otel/sdk v1.28.0 h1:b9d7hIry8yZsgtbmM0DKyPWMMUMlK9NEKuIG4aBqWyE= +go.opentelemetry.io/otel/sdk v1.28.0/go.mod h1:oYj7ClPUA7Iw3m+r7GeEjz0qckQRJK2B8zjcZEfu7Pg= +go.opentelemetry.io/otel/sdk/metric v1.28.0 h1:OkuaKgKrgAbYrrY0t92c+cC+2F6hsFNnCQArXCKlg08= +go.opentelemetry.io/otel/sdk/metric v1.28.0/go.mod h1:cWPjykihLAPvXKi4iZc1dpER3Jdq2Z0YLse3moQUCpg= +go.opentelemetry.io/otel/trace v1.28.0 h1:GhQ9cUuQGmNDd5BTCP2dAvv75RdMxEfTmYejp+lkx9g= +go.opentelemetry.io/otel/trace v1.28.0/go.mod h1:jPyXzNPg6da9+38HEwElrQiHlVMTnVfM3/yv2OlIHaI= +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.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= +golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= +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.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= +golang.org/x/sys v0.21.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.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= +golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +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-20240701130421-f6361c86f094 h1:BwIjyKYGsK9dMCBOorzRri8MQwmi7mT9rGHsCEinZkA= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= +google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= +google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= +google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= +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/forwardconnector/go.mod b/connector/forwardconnector/go.mod index 91422951a2f..5864c53aee3 100644 --- a/connector/forwardconnector/go.mod +++ b/connector/forwardconnector/go.mod @@ -38,6 +38,7 @@ require ( github.com/prometheus/common v0.55.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect go.opentelemetry.io/collector v0.106.1 // indirect + go.opentelemetry.io/collector/component/componentprofiles v0.0.0-00010101000000-000000000000 // indirect go.opentelemetry.io/collector/config/configtelemetry v0.106.1 // indirect go.opentelemetry.io/collector/consumer/consumerprofiles v0.106.1 // indirect go.opentelemetry.io/collector/featuregate v1.12.0 // indirect @@ -90,3 +91,5 @@ replace go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile replace go.opentelemetry.io/collector/consumer/consumerprofiles => ../../consumer/consumerprofiles replace go.opentelemetry.io/collector/consumer/consumertest => ../../consumer/consumertest + +replace go.opentelemetry.io/collector/component/componentprofiles => ../../component/componentprofiles diff --git a/connector/go.mod b/connector/go.mod index e7e28230e29..d6866619d71 100644 --- a/connector/go.mod +++ b/connector/go.mod @@ -7,7 +7,9 @@ require ( github.com/stretchr/testify v1.9.0 go.opentelemetry.io/collector v0.106.1 go.opentelemetry.io/collector/component v0.106.1 + go.opentelemetry.io/collector/component/componentprofiles v0.0.0-00010101000000-000000000000 go.opentelemetry.io/collector/consumer v0.106.1 + go.opentelemetry.io/collector/consumer/consumerprofiles v0.106.1 go.opentelemetry.io/collector/consumer/consumertest v0.106.1 go.opentelemetry.io/collector/pdata v1.12.0 go.opentelemetry.io/collector/pdata/testdata v0.106.1 @@ -33,7 +35,6 @@ require ( github.com/prometheus/common v0.55.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect go.opentelemetry.io/collector/config/configtelemetry v0.106.1 // indirect - go.opentelemetry.io/collector/consumer/consumerprofiles v0.106.1 // indirect go.opentelemetry.io/collector/pdata/pprofile v0.106.1 // indirect go.opentelemetry.io/otel v1.28.0 // indirect go.opentelemetry.io/otel/exporters/prometheus v0.50.0 // indirect @@ -73,3 +74,5 @@ replace go.opentelemetry.io/collector/internal/globalgates => ../internal/global replace go.opentelemetry.io/collector/consumer/consumerprofiles => ../consumer/consumerprofiles replace go.opentelemetry.io/collector/consumer/consumertest => ../consumer/consumertest + +replace go.opentelemetry.io/collector/component/componentprofiles => ../component/componentprofiles diff --git a/connector/internal/factory.go b/connector/internal/factory.go index 4fb92a8a47b..5cff95c854a 100644 --- a/connector/internal/factory.go +++ b/connector/internal/factory.go @@ -8,7 +8,9 @@ import ( "fmt" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componentprofiles" "go.opentelemetry.io/collector/consumer" + "go.opentelemetry.io/collector/consumer/consumerprofiles" ) // Factory is a factory interface for connectors. @@ -30,26 +32,42 @@ type Factory interface { CreateTracesToTraces(ctx context.Context, set Settings, cfg component.Config, nextConsumer consumer.Traces) (Traces, error) CreateTracesToMetrics(ctx context.Context, set Settings, cfg component.Config, nextConsumer consumer.Metrics) (Traces, error) CreateTracesToLogs(ctx context.Context, set Settings, cfg component.Config, nextConsumer consumer.Logs) (Traces, error) + CreateTracesToProfiles(ctx context.Context, set Settings, cfg component.Config, nextConsumer consumerprofiles.Profiles) (Traces, error) CreateMetricsToTraces(ctx context.Context, set Settings, cfg component.Config, nextConsumer consumer.Traces) (Metrics, error) CreateMetricsToMetrics(ctx context.Context, set Settings, cfg component.Config, nextConsumer consumer.Metrics) (Metrics, error) CreateMetricsToLogs(ctx context.Context, set Settings, cfg component.Config, nextConsumer consumer.Logs) (Metrics, error) + CreateMetricsToProfiles(ctx context.Context, set Settings, cfg component.Config, nextConsumer consumerprofiles.Profiles) (Metrics, error) CreateLogsToTraces(ctx context.Context, set Settings, cfg component.Config, nextConsumer consumer.Traces) (Logs, error) CreateLogsToMetrics(ctx context.Context, set Settings, cfg component.Config, nextConsumer consumer.Metrics) (Logs, error) CreateLogsToLogs(ctx context.Context, set Settings, cfg component.Config, nextConsumer consumer.Logs) (Logs, error) + CreateLogsToProfiles(ctx context.Context, set Settings, cfg component.Config, nextConsumer consumerprofiles.Profiles) (Logs, error) + + CreateProfilesToProfiles(ctx context.Context, set Settings, cfg component.Config, nextConsumer consumerprofiles.Profiles) (Profiles, error) + CreateProfilesToTraces(ctx context.Context, set Settings, cfg component.Config, nextConsumer consumer.Traces) (Profiles, error) + CreateProfilesToMetrics(ctx context.Context, set Settings, cfg component.Config, nextConsumer consumer.Metrics) (Profiles, error) + CreateProfilesToLogs(ctx context.Context, set Settings, cfg component.Config, nextConsumer consumer.Logs) (Profiles, error) TracesToTracesStability() component.StabilityLevel TracesToMetricsStability() component.StabilityLevel TracesToLogsStability() component.StabilityLevel + TracesToProfilesStability() component.StabilityLevel MetricsToTracesStability() component.StabilityLevel MetricsToMetricsStability() component.StabilityLevel MetricsToLogsStability() component.StabilityLevel + MetricsToProfilesStability() component.StabilityLevel LogsToTracesStability() component.StabilityLevel LogsToMetricsStability() component.StabilityLevel LogsToLogsStability() component.StabilityLevel + LogsToProfilesStability() component.StabilityLevel + + ProfilesToProfilesStability() component.StabilityLevel + ProfilesToTracesStability() component.StabilityLevel + ProfilesToMetricsStability() component.StabilityLevel + ProfilesToLogsStability() component.StabilityLevel unexportedFactoryFunc() } @@ -77,26 +95,42 @@ type factory struct { CreateTracesToTracesFunc CreateTracesToMetricsFunc CreateTracesToLogsFunc + CreateTracesToProfilesFunc CreateMetricsToTracesFunc CreateMetricsToMetricsFunc CreateMetricsToLogsFunc + CreateMetricsToProfilesFunc CreateLogsToTracesFunc CreateLogsToMetricsFunc CreateLogsToLogsFunc + CreateLogsToProfilesFunc + + CreateProfilesToProfilesFunc + CreateProfilesToTracesFunc + CreateProfilesToMetricsFunc + CreateProfilesToLogsFunc + + tracesToTracesStabilityLevel component.StabilityLevel + tracesToMetricsStabilityLevel component.StabilityLevel + tracesToLogsStabilityLevel component.StabilityLevel + tracesToProfilesStabilityLevel component.StabilityLevel - tracesToTracesStabilityLevel component.StabilityLevel - tracesToMetricsStabilityLevel component.StabilityLevel - tracesToLogsStabilityLevel component.StabilityLevel + metricsToTracesStabilityLevel component.StabilityLevel + metricsToMetricsStabilityLevel component.StabilityLevel + metricsToLogsStabilityLevel component.StabilityLevel + metricsToProfilesStabilityLevel component.StabilityLevel - metricsToTracesStabilityLevel component.StabilityLevel - metricsToMetricsStabilityLevel component.StabilityLevel - metricsToLogsStabilityLevel component.StabilityLevel + logsToTracesStabilityLevel component.StabilityLevel + logsToMetricsStabilityLevel component.StabilityLevel + logsToLogsStabilityLevel component.StabilityLevel + logsToProfilesStabilityLevel component.StabilityLevel - logsToTracesStabilityLevel component.StabilityLevel - logsToMetricsStabilityLevel component.StabilityLevel - logsToLogsStabilityLevel component.StabilityLevel + profilesToProfilesStabilityLevel component.StabilityLevel + profilesToTracesStabilityLevel component.StabilityLevel + profilesToMetricsStabilityLevel component.StabilityLevel + profilesToLogsStabilityLevel component.StabilityLevel } // CreateTracesToTracesFunc is the equivalent of Factory.CreateTracesToTraces(). @@ -146,6 +180,22 @@ func (f CreateTracesToLogsFunc) CreateTracesToLogs( return f(ctx, set, cfg, nextConsumer) } +// CreateTracesToProfilesFunc is the equivalent of Factory.CreateTracesToProfiles(). +type CreateTracesToProfilesFunc func(context.Context, Settings, component.Config, consumerprofiles.Profiles) (Traces, error) + +// CreateTracesToProfiles implements Factory.CreateTracesToProfiles(). +func (f CreateTracesToProfilesFunc) CreateTracesToProfiles( + ctx context.Context, + set Settings, + cfg component.Config, + nextConsumer consumerprofiles.Profiles, +) (Traces, error) { + if f == nil { + return nil, ErrDataTypes(set.ID, component.DataTypeTraces, componentprofiles.DataTypeProfiles) + } + return f(ctx, set, cfg, nextConsumer) +} + // CreateMetricsToTracesFunc is the equivalent of Factory.CreateMetricsToTraces(). type CreateMetricsToTracesFunc func(context.Context, Settings, component.Config, consumer.Traces) (Metrics, error) @@ -194,6 +244,22 @@ func (f CreateMetricsToLogsFunc) CreateMetricsToLogs( return f(ctx, set, cfg, nextConsumer) } +// CreateMetricsToProfilesFunc is the equivalent of Factory.CreateMetricsToProfiles(). +type CreateMetricsToProfilesFunc func(context.Context, Settings, component.Config, consumerprofiles.Profiles) (Metrics, error) + +// CreateMetricsToProfiles implements Factory.CreateMetricsToProfiles(). +func (f CreateMetricsToProfilesFunc) CreateMetricsToProfiles( + ctx context.Context, + set Settings, + cfg component.Config, + nextConsumer consumerprofiles.Profiles, +) (Metrics, error) { + if f == nil { + return nil, ErrDataTypes(set.ID, component.DataTypeMetrics, componentprofiles.DataTypeProfiles) + } + return f(ctx, set, cfg, nextConsumer) +} + // CreateLogsToTracesFunc is the equivalent of Factory.CreateLogsToTraces(). type CreateLogsToTracesFunc func(context.Context, Settings, component.Config, consumer.Traces) (Logs, error) @@ -242,6 +308,86 @@ func (f CreateLogsToLogsFunc) CreateLogsToLogs( return f(ctx, set, cfg, nextConsumer) } +// CreateLogsToProfilesFunc is the equivalent of Factory.CreateLogsToProfiles(). +type CreateLogsToProfilesFunc func(context.Context, Settings, component.Config, consumerprofiles.Profiles) (Logs, error) + +// CreateLogsToProfiles implements Factory.CreateLogsToProfiles(). +func (f CreateLogsToProfilesFunc) CreateLogsToProfiles( + ctx context.Context, + set Settings, + cfg component.Config, + nextConsumer consumerprofiles.Profiles, +) (Logs, error) { + if f == nil { + return nil, ErrDataTypes(set.ID, component.DataTypeLogs, componentprofiles.DataTypeProfiles) + } + return f(ctx, set, cfg, nextConsumer) +} + +// CreateProfilesToProfilesFunc is the equivalent of Factory.CreateProfilesToProfiles(). +type CreateProfilesToProfilesFunc func(context.Context, Settings, component.Config, consumerprofiles.Profiles) (Profiles, error) + +// CreateProfilesToProfiles implements Factory.CreateProfilesToProfiles(). +func (f CreateProfilesToProfilesFunc) CreateProfilesToProfiles( + ctx context.Context, + set Settings, + cfg component.Config, + nextConsumer consumerprofiles.Profiles, +) (Profiles, error) { + if f == nil { + return nil, ErrDataTypes(set.ID, componentprofiles.DataTypeProfiles, componentprofiles.DataTypeProfiles) + } + return f(ctx, set, cfg, nextConsumer) +} + +// CreateProfilesToTracesFunc is the equivalent of Factory.CreateProfilesToTraces(). +type CreateProfilesToTracesFunc func(context.Context, Settings, component.Config, consumer.Traces) (Profiles, error) + +// CreateProfilesToTraces implements Factory.CreateProfilesToTraces(). +func (f CreateProfilesToTracesFunc) CreateProfilesToTraces( + ctx context.Context, + set Settings, + cfg component.Config, + nextConsumer consumer.Traces, +) (Profiles, error) { + if f == nil { + return nil, ErrDataTypes(set.ID, componentprofiles.DataTypeProfiles, component.DataTypeTraces) + } + return f(ctx, set, cfg, nextConsumer) +} + +// CreateProfilesToMetricsFunc is the equivalent of Factory.CreateProfilesToMetrics(). +type CreateProfilesToMetricsFunc func(context.Context, Settings, component.Config, consumer.Metrics) (Profiles, error) + +// CreateProfilesToMetrics implements Factory.CreateProfilesToMetrics(). +func (f CreateProfilesToMetricsFunc) CreateProfilesToMetrics( + ctx context.Context, + set Settings, + cfg component.Config, + nextConsumer consumer.Metrics, +) (Profiles, error) { + if f == nil { + return nil, ErrDataTypes(set.ID, componentprofiles.DataTypeProfiles, component.DataTypeMetrics) + } + return f(ctx, set, cfg, nextConsumer) +} + +// CreateProfilesToLogsFunc is the equivalent of Factory.CreateProfilesToLogs(). +type CreateProfilesToLogsFunc func(context.Context, Settings, component.Config, consumer.Logs) (Profiles, error) + +// CreateProfilesToLogs implements Factory.CreateProfilesToLogs(). +func (f CreateProfilesToLogsFunc) CreateProfilesToLogs( + ctx context.Context, + set Settings, + cfg component.Config, + nextConsumer consumer.Logs, +) (Profiles, error) { + if f == nil { + return nil, ErrDataTypes(set.ID, componentprofiles.DataTypeProfiles, component.DataTypeLogs) + } + return f(ctx, set, cfg, nextConsumer) +} + // Type returns the type of component. func (f *factory) Type() component.Type { return f.cfgType @@ -261,6 +407,10 @@ func (f factory) TracesToLogsStability() component.StabilityLevel { return f.tracesToLogsStabilityLevel } +func (f factory) TracesToProfilesStability() component.StabilityLevel { + return f.tracesToProfilesStabilityLevel +} + func (f factory) MetricsToTracesStability() component.StabilityLevel { return f.metricsToTracesStabilityLevel } @@ -273,6 +423,10 @@ func (f factory) MetricsToLogsStability() component.StabilityLevel { return f.metricsToLogsStabilityLevel } +func (f factory) MetricsToProfilesStability() component.StabilityLevel { + return f.metricsToProfilesStabilityLevel +} + func (f factory) LogsToTracesStability() component.StabilityLevel { return f.logsToTracesStabilityLevel } @@ -285,6 +439,26 @@ func (f factory) LogsToLogsStability() component.StabilityLevel { return f.logsToLogsStabilityLevel } +func (f factory) LogsToProfilesStability() component.StabilityLevel { + return f.logsToProfilesStabilityLevel +} + +func (f factory) ProfilesToProfilesStability() component.StabilityLevel { + return f.profilesToProfilesStabilityLevel +} + +func (f factory) ProfilesToTracesStability() component.StabilityLevel { + return f.profilesToTracesStabilityLevel +} + +func (f factory) ProfilesToMetricsStability() component.StabilityLevel { + return f.profilesToMetricsStabilityLevel +} + +func (f factory) ProfilesToLogsStability() component.StabilityLevel { + return f.profilesToLogsStabilityLevel +} + // NewFactory returns a Factory. func NewFactory(cfgType component.Type, createDefaultConfig component.CreateDefaultConfigFunc, options ...FactoryOption) Factory { f := &factory{ @@ -321,6 +495,14 @@ func WithTracesToLogs(createTracesToLogs CreateTracesToLogsFunc, sl component.St }) } +// WithTracesToProfiles overrides the default "error not supported" implementation for WithTracesToProfiles and the default "undefined" stability level. +func WithTracesToProfiles(createTracesToProfiles CreateTracesToProfilesFunc, sl component.StabilityLevel) FactoryOption { + return factoryOptionFunc(func(o *factory) { + o.tracesToProfilesStabilityLevel = sl + o.CreateTracesToProfilesFunc = createTracesToProfiles + }) +} + // WithMetricsToTraces overrides the default "error not supported" implementation for WithMetricsToTraces and the default "undefined" stability level. func WithMetricsToTraces(createMetricsToTraces CreateMetricsToTracesFunc, sl component.StabilityLevel) FactoryOption { return factoryOptionFunc(func(o *factory) { @@ -345,6 +527,14 @@ func WithMetricsToLogs(createMetricsToLogs CreateMetricsToLogsFunc, sl component }) } +// WithMetricsToProfiles overrides the default "error not supported" implementation for WithMetricsToProfiles and the default "undefined" stability level. +func WithMetricsToProfiles(createMetricsToProfiles CreateMetricsToProfilesFunc, sl component.StabilityLevel) FactoryOption { + return factoryOptionFunc(func(o *factory) { + o.metricsToProfilesStabilityLevel = sl + o.CreateMetricsToProfilesFunc = createMetricsToProfiles + }) +} + // WithLogsToTraces overrides the default "error not supported" implementation for WithLogsToTraces and the default "undefined" stability level. func WithLogsToTraces(createLogsToTraces CreateLogsToTracesFunc, sl component.StabilityLevel) FactoryOption { return factoryOptionFunc(func(o *factory) { @@ -369,6 +559,46 @@ func WithLogsToLogs(createLogsToLogs CreateLogsToLogsFunc, sl component.Stabilit }) } +// WithLogsToProfiles overrides the default "error not supported" implementation for WithLogsToProfiles and the default "undefined" stability level. +func WithLogsToProfiles(createLogsToProfiles CreateLogsToProfilesFunc, sl component.StabilityLevel) FactoryOption { + return factoryOptionFunc(func(o *factory) { + o.logsToProfilesStabilityLevel = sl + o.CreateLogsToProfilesFunc = createLogsToProfiles + }) +} + +// WithProfilesToProfiles overrides the default "error not supported" implementation for WithProfilesToProfiles and the default "undefined" stability level. +func WithProfilesToProfiles(createProfilesToProfiles CreateProfilesToProfilesFunc, sl component.StabilityLevel) FactoryOption { + return factoryOptionFunc(func(o *factory) { + o.profilesToProfilesStabilityLevel = sl + o.CreateProfilesToProfilesFunc = createProfilesToProfiles + }) +} + +// WithProfilesToTraces overrides the default "error not supported" implementation for WithProfilesToTraces and the default "undefined" stability level. +func WithProfilesToTraces(createProfilesToTraces CreateProfilesToTracesFunc, sl component.StabilityLevel) FactoryOption { + return factoryOptionFunc(func(o *factory) { + o.profilesToTracesStabilityLevel = sl + o.CreateProfilesToTracesFunc = createProfilesToTraces + }) +} + +// WithProfilesToMetrics overrides the default "error not supported" implementation for WithProfilesToMetrics and the default "undefined" stability level. +func WithProfilesToMetrics(createProfilesToMetrics CreateProfilesToMetricsFunc, sl component.StabilityLevel) FactoryOption { + return factoryOptionFunc(func(o *factory) { + o.profilesToMetricsStabilityLevel = sl + o.CreateProfilesToMetricsFunc = createProfilesToMetrics + }) +} + +// WithProfilesToLogs overrides the default "error not supported" implementation for WithProfilesToLogs and the default "undefined" stability level. +func WithProfilesToLogs(createProfilesToLogs CreateProfilesToLogsFunc, sl component.StabilityLevel) FactoryOption { + return factoryOptionFunc(func(o *factory) { + o.profilesToLogsStabilityLevel = sl + o.CreateProfilesToLogsFunc = createProfilesToLogs + }) +} + func ErrDataTypes(id component.ID, from, to component.DataType) error { return fmt.Errorf("connector %q cannot connect from %s to %s: %w", id, from, to, component.ErrDataTypeIsNotSupported) } diff --git a/connector/internal/profiles.go b/connector/internal/profiles.go new file mode 100644 index 00000000000..4ac7889cd94 --- /dev/null +++ b/connector/internal/profiles.go @@ -0,0 +1,26 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package internal // import "go.opentelemetry.io/collector/connector/internal" + +import ( + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/consumer/consumerprofiles" +) + +// A Profiles connector acts as an exporter from a profiles pipeline and a receiver +// to one or more traces, metrics, logs, or profiles pipelines. +// Profiles feeds a consumer.Traces, consumer.Metrics, consumer.Logs, or consumerprofiles.Profiles with data. +// +// Examples: +// - Profiles could be collected in one pipeline and routed to another profiles pipeline +// based on criteria such as attributes or other content of the profile. The second +// pipeline can then process and export the profile to the appropriate backend. +// - Profiles could be summarized by a metrics connector that emits statistics describing +// the number of profiles observed. +// - Profiles could be analyzed by a logs connector that emits events when particular +// criteria are met. +type Profiles interface { + component.Component + consumerprofiles.Profiles +} diff --git a/otelcol/go.mod b/otelcol/go.mod index ebc457f87e5..5ade2d95f0f 100644 --- a/otelcol/go.mod +++ b/otelcol/go.mod @@ -62,6 +62,7 @@ require ( github.com/tklauser/numcpus v0.6.1 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect go.opentelemetry.io/collector v0.106.1 // indirect + go.opentelemetry.io/collector/component/componentprofiles v0.0.0-00010101000000-000000000000 // indirect go.opentelemetry.io/collector/consumer v0.106.1 // indirect go.opentelemetry.io/collector/consumer/consumerprofiles v0.106.1 // indirect go.opentelemetry.io/collector/consumer/consumertest v0.106.1 // indirect @@ -152,4 +153,6 @@ replace go.opentelemetry.io/collector/consumer/consumerprofiles => ../consumer/c replace go.opentelemetry.io/collector/consumer/consumertest => ../consumer/consumertest +replace go.opentelemetry.io/collector/component/componentprofiles => ../component/componentprofiles + replace go.opentelemetry.io/collector/client => ../client diff --git a/otelcol/otelcoltest/go.mod b/otelcol/otelcoltest/go.mod index bc229f26f83..c287ba0b5bd 100644 --- a/otelcol/otelcoltest/go.mod +++ b/otelcol/otelcoltest/go.mod @@ -59,6 +59,7 @@ require ( github.com/tklauser/numcpus v0.6.1 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect go.opentelemetry.io/collector v0.106.1 // indirect + go.opentelemetry.io/collector/component/componentprofiles v0.0.0-00010101000000-000000000000 // indirect go.opentelemetry.io/collector/config/configtelemetry v0.106.1 // indirect go.opentelemetry.io/collector/consumer v0.106.1 // indirect go.opentelemetry.io/collector/consumer/consumerprofiles v0.106.1 // indirect @@ -170,4 +171,6 @@ replace go.opentelemetry.io/collector/consumer/consumerprofiles => ../../consume replace go.opentelemetry.io/collector/consumer/consumertest => ../../consumer/consumertest +replace go.opentelemetry.io/collector/component/componentprofiles => ../../component/componentprofiles + replace go.opentelemetry.io/collector/client => ../../client diff --git a/service/go.mod b/service/go.mod index 8544fc26302..9dbe6596b81 100644 --- a/service/go.mod +++ b/service/go.mod @@ -78,6 +78,7 @@ require ( github.com/tklauser/numcpus v0.6.1 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect go.opentelemetry.io/collector/client v0.106.1 // indirect + go.opentelemetry.io/collector/component/componentprofiles v0.0.0-00010101000000-000000000000 // indirect go.opentelemetry.io/collector/config/configauth v0.106.1 // indirect go.opentelemetry.io/collector/config/configcompression v1.12.0 // indirect go.opentelemetry.io/collector/config/configopaque v1.12.0 // indirect @@ -161,4 +162,6 @@ replace go.opentelemetry.io/collector/consumer/consumerprofiles => ../consumer/c replace go.opentelemetry.io/collector/consumer/consumertest => ../consumer/consumertest +replace go.opentelemetry.io/collector/component/componentprofiles => ../component/componentprofiles + replace go.opentelemetry.io/collector/client => ../client diff --git a/versions.yaml b/versions.yaml index 28d454d7549..606e786e4b6 100644 --- a/versions.yaml +++ b/versions.yaml @@ -36,6 +36,7 @@ module-sets: - go.opentelemetry.io/collector/config/configtelemetry - go.opentelemetry.io/collector/config/internal - go.opentelemetry.io/collector/connector + - go.opentelemetry.io/collector/connector/connectorprofiles - go.opentelemetry.io/collector/connector/forwardconnector - go.opentelemetry.io/collector/consumer - go.opentelemetry.io/collector/consumer/consumerprofiles