Skip to content

Commit

Permalink
fix linting
Browse files Browse the repository at this point in the history
Signed-off-by: Florian Bacher <[email protected]>
  • Loading branch information
bacherfl committed Dec 19, 2024
1 parent 13ccb38 commit 34485ac
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 23 deletions.
25 changes: 12 additions & 13 deletions processor/resourceprocessor/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@ package resourceprocessor // import "github.com/open-telemetry/opentelemetry-col

import (
"context"

"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/consumer"
"go.opentelemetry.io/collector/consumer/consumerprofiles"
"go.opentelemetry.io/collector/consumer/xconsumer"
"go.opentelemetry.io/collector/processor"
"go.opentelemetry.io/collector/processor/processorhelper"
"go.opentelemetry.io/collector/processor/processorhelper/processorhelperprofiles"
"go.opentelemetry.io/collector/processor/processorprofiles"
"go.opentelemetry.io/collector/processor/processorhelper/xprocessorhelper"
"go.opentelemetry.io/collector/processor/xprocessor"

"github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal/attraction"
"github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourceprocessor/internal/metadata"
Expand All @@ -22,13 +21,13 @@ var processorCapabilities = consumer.Capabilities{MutatesData: true}

// NewFactory returns a new factory for the Resource processor.
func NewFactory() processor.Factory {
return processorprofiles.NewFactory(
return xprocessor.NewFactory(
metadata.Type,
createDefaultConfig,
processorprofiles.WithTraces(createTracesProcessor, metadata.TracesStability),
processorprofiles.WithMetrics(createMetricsProcessor, metadata.MetricsStability),
processorprofiles.WithLogs(createLogsProcessor, metadata.LogsStability),
processorprofiles.WithProfiles(createProfilesProcessor, metadata.ProfilesStability),
xprocessor.WithTraces(createTracesProcessor, metadata.TracesStability),
xprocessor.WithMetrics(createMetricsProcessor, metadata.MetricsStability),
xprocessor.WithLogs(createLogsProcessor, metadata.LogsStability),
xprocessor.WithProfiles(createProfilesProcessor, metadata.ProfilesStability),
)
}

Expand Down Expand Up @@ -101,18 +100,18 @@ func createProfilesProcessor(
ctx context.Context,
set processor.Settings,
cfg component.Config,
nextConsumer consumerprofiles.Profiles,
) (processorprofiles.Profiles, error) {
nextConsumer xconsumer.Profiles,
) (xprocessor.Profiles, error) {
attrProc, err := attraction.NewAttrProc(&attraction.Settings{Actions: cfg.(*Config).AttributesActions})
if err != nil {
return nil, err
}
proc := resourceProcessor{logger: set.Logger, attrProc: attrProc}
return processorhelperprofiles.NewProfiles(
return xprocessorhelper.NewProfiles(
ctx,
set,
cfg,
nextConsumer,
proc.processProfiles,
processorhelperprofiles.WithCapabilities(processorCapabilities))
xprocessorhelper.WithCapabilities(processorCapabilities))
}
3 changes: 2 additions & 1 deletion processor/resourceprocessor/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package resourceprocessor

import (
"context"
"go.opentelemetry.io/collector/processor/xprocessor"
"testing"

"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -65,6 +66,6 @@ func TestInvalidAttributeActions(t *testing.T) {
_, err = factory.CreateLogs(context.Background(), processortest.NewNopSettings(), cfg, nil)
assert.Error(t, err)

_, err = factory.(processorprofiles.Factory).CreateProfiles(context.Background(), processortest.NewNopSettings(), cfg, nil)
_, err = factory.(xprocessor.Factory).CreateProfiles(context.Background(), processortest.NewNopSettings(), cfg, nil)
assert.Error(t, err)
}
8 changes: 3 additions & 5 deletions processor/resourceprocessor/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ require (
go.opentelemetry.io/collector/component/componenttest v0.116.0
go.opentelemetry.io/collector/confmap v1.22.0
go.opentelemetry.io/collector/consumer v1.22.0
go.opentelemetry.io/collector/consumer/consumerprofiles v0.116.0
go.opentelemetry.io/collector/consumer/consumertest v0.116.0
go.opentelemetry.io/collector/consumer/xconsumer v0.116.0
go.opentelemetry.io/collector/pdata v1.22.0
go.opentelemetry.io/collector/pdata/pprofile v0.116.0
go.opentelemetry.io/collector/processor v0.116.0
go.opentelemetry.io/collector/processor/processorhelper/processorhelperprofiles v0.116.0
go.opentelemetry.io/collector/processor/processorhelper/xprocessorhelper v0.116.0
go.opentelemetry.io/collector/processor/processorprofiles v0.116.0
go.opentelemetry.io/collector/processor/processortest v0.116.0
go.opentelemetry.io/collector/processor/xprocessor v0.116.0
go.uber.org/goleak v1.3.0
go.uber.org/zap v1.27.0
)
Expand All @@ -44,11 +45,8 @@ require (
go.opentelemetry.io/collector/client v1.22.0 // indirect
go.opentelemetry.io/collector/component/componentstatus v0.116.0 // indirect
go.opentelemetry.io/collector/config/configtelemetry v0.116.0 // indirect
go.opentelemetry.io/collector/consumer/xconsumer v0.116.0 // indirect
go.opentelemetry.io/collector/pdata/testdata v0.116.0 // indirect
go.opentelemetry.io/collector/pipeline v0.116.0 // indirect
go.opentelemetry.io/collector/processor/processorhelper/xprocessorhelper v0.116.0 // indirect
go.opentelemetry.io/collector/processor/xprocessor v0.116.0 // indirect
go.opentelemetry.io/otel v1.32.0 // indirect
go.opentelemetry.io/otel/metric v1.32.0 // indirect
go.opentelemetry.io/otel/sdk v1.32.0 // indirect
Expand Down
4 changes: 0 additions & 4 deletions processor/resourceprocessor/go.sum

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

0 comments on commit 34485ac

Please sign in to comment.