Skip to content

Commit

Permalink
Enable filter processor as a default processor (open-telemetry#1085)
Browse files Browse the repository at this point in the history
* Enable filter processor as a default processor

* Fix test
  • Loading branch information
anniefu authored and wyTrivail committed Jul 13, 2020
1 parent 83bb7c7 commit 746d884
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
13 changes: 5 additions & 8 deletions processor/filterprocessor/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
package filterprocessor

import (
"context"

"go.uber.org/zap"

"go.opentelemetry.io/collector/component"
Expand Down Expand Up @@ -50,12 +48,11 @@ func (f Factory) CreateDefaultConfig() configmodels.Processor {
}

// CreateTraceProcessor creates a trace processor based on this config.
func (f *Factory) CreateTraceProcessor(
ctx context.Context,
params component.ProcessorCreateParams,
nextConsumer consumer.TraceConsumer,
cfg configmodels.Processor,
) (component.TraceProcessor, error) {
func (f Factory) CreateTraceProcessor(
logger *zap.Logger,
nextConsumer consumer.TraceConsumerOld,
c configmodels.Processor,
) (component.TraceProcessorOld, error) {
return nil, configerror.ErrDataTypeIsNotSupported
}

Expand Down
5 changes: 1 addition & 4 deletions processor/filterprocessor/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,13 @@
package filterprocessor

import (
"context"
"fmt"
"path"
"testing"

"github.com/stretchr/testify/assert"
"go.uber.org/zap"

"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/config"
"go.opentelemetry.io/collector/config/configcheck"
"go.opentelemetry.io/collector/config/configmodels"
Expand Down Expand Up @@ -77,9 +75,8 @@ func TestCreateProcessors(t *testing.T) {
for name, cfg := range config.Processors {
t.Run(fmt.Sprintf("%s/%s", test.configName, name), func(t *testing.T) {
factory := &Factory{}
creationParams := component.ProcessorCreateParams{Logger: zap.NewNop()}

tp, tErr := factory.CreateTraceProcessor(context.Background(), creationParams, nil, cfg)
tp, tErr := factory.CreateTraceProcessor(zap.NewNop(), nil, cfg)
// Not implemented error
assert.NotNil(t, tErr)
assert.Nil(t, tp)
Expand Down
2 changes: 2 additions & 0 deletions service/defaultcomponents/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
"go.opentelemetry.io/collector/extension/zpagesextension"
"go.opentelemetry.io/collector/processor/attributesprocessor"
"go.opentelemetry.io/collector/processor/batchprocessor"
"go.opentelemetry.io/collector/processor/filterprocessor"
"go.opentelemetry.io/collector/processor/memorylimiter"
"go.opentelemetry.io/collector/processor/queuedprocessor"
"go.opentelemetry.io/collector/processor/resourceprocessor"
Expand Down Expand Up @@ -98,6 +99,7 @@ func Components() (
&tailsamplingprocessor.Factory{},
&probabilisticsamplerprocessor.Factory{},
&spanprocessor.Factory{},
&filterprocessor.Factory{},
)
if err != nil {
errs = append(errs, err)
Expand Down
2 changes: 2 additions & 0 deletions service/defaultcomponents/defaults_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import (
"go.opentelemetry.io/collector/extension/zpagesextension"
"go.opentelemetry.io/collector/processor/attributesprocessor"
"go.opentelemetry.io/collector/processor/batchprocessor"
"go.opentelemetry.io/collector/processor/filterprocessor"
"go.opentelemetry.io/collector/processor/memorylimiter"
"go.opentelemetry.io/collector/processor/queuedprocessor"
"go.opentelemetry.io/collector/processor/resourceprocessor"
Expand Down Expand Up @@ -74,6 +75,7 @@ func TestDefaultComponents(t *testing.T) {
"tail_sampling": &tailsamplingprocessor.Factory{},
"probabilistic_sampler": &probabilisticsamplerprocessor.Factory{},
"span": &spanprocessor.Factory{},
"filter": &filterprocessor.Factory{},
}
expectedExporters := map[configmodels.Type]component.ExporterFactoryBase{
"opencensus": &opencensusexporter.Factory{},
Expand Down

0 comments on commit 746d884

Please sign in to comment.