Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename component.TraceExporter to component.TracesExporter #2027

Merged
merged 1 commit into from
Oct 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

- Rename consumer.TraceConsumer to consumer.TracesConsumer #1974
- Rename component.TraceProcessor to component.TracesProcessor #1976
- Rename component.TraceExporter to component.TracesExporter #1975

## v0.13.0 Beta

Expand Down
4 changes: 2 additions & 2 deletions component/componenttest/example_factories.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,11 +288,11 @@ func (f *ExampleExporterFactory) CustomUnmarshaler() component.CustomUnmarshaler
}

// CreateTraceExporter creates a trace exporter based on this config.
func (f *ExampleExporterFactory) CreateTraceExporter(
func (f *ExampleExporterFactory) CreateTracesExporter(
_ context.Context,
_ component.ExporterCreateParams,
_ configmodels.Exporter,
) (component.TraceExporter, error) {
) (component.TracesExporter, error) {
return &ExampleExporterConsumer{}, nil
}

Expand Down
12 changes: 6 additions & 6 deletions component/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ type Exporter interface {
Component
}

// TraceExporter is a Exporter that can consume traces.
type TraceExporter interface {
// TracesExporter is a Exporter that can consume traces.
type TracesExporter interface {
Exporter
consumer.TracesConsumer
}
Expand All @@ -56,7 +56,7 @@ type ExporterCreateParams struct {
ApplicationStartInfo ApplicationStartInfo
}

// ExporterFactory can create TraceExporter and MetricsExporter. This is the
// ExporterFactory can create TracesExporter and MetricsExporter. This is the
// new factory type that can create new style exporters.
type ExporterFactory interface {
Factory
Expand All @@ -70,14 +70,14 @@ type ExporterFactory interface {
// tests of any implementation of the Factory interface.
CreateDefaultConfig() configmodels.Exporter

// CreateTraceExporter creates a trace exporter based on this config.
// CreateTracesExporter creates a trace exporter based on this config.
// If the exporter type does not support tracing or if the config is not valid
// error will be returned instead.
CreateTraceExporter(
CreateTracesExporter(
ctx context.Context,
params ExporterCreateParams,
cfg configmodels.Exporter,
) (TraceExporter, error)
) (TracesExporter, error)

// CreateMetricsExporter creates a metrics exporter based on this config.
// If the exporter type does not support metrics or if the config is not valid
Expand Down
2 changes: 1 addition & 1 deletion component/exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (f *TestExporterFactory) CreateDefaultConfig() configmodels.Exporter {
}

// CreateTraceExporter creates a trace exporter based on this config.
func (f *TestExporterFactory) CreateTraceExporter(context.Context, ExporterCreateParams, configmodels.Exporter) (TraceExporter, error) {
func (f *TestExporterFactory) CreateTracesExporter(context.Context, ExporterCreateParams, configmodels.Exporter) (TracesExporter, error) {
return nil, configerror.ErrDataTypeIsNotSupported
}

Expand Down
10 changes: 5 additions & 5 deletions exporter/exporterhelper/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ type FactoryOption func(o *factory)
// CreateDefaultConfig is the equivalent of component.ExporterFactory.CreateDefaultConfig()
type CreateDefaultConfig func() configmodels.Exporter

// CreateTraceExporter is the equivalent of component.ExporterFactory.CreateTraceExporter()
type CreateTraceExporter func(context.Context, component.ExporterCreateParams, configmodels.Exporter) (component.TraceExporter, error)
// CreateTraceExporter is the equivalent of component.ExporterFactory.CreateTracesExporter()
type CreateTraceExporter func(context.Context, component.ExporterCreateParams, configmodels.Exporter) (component.TracesExporter, error)

// CreateMetricsExporter is the equivalent of component.ExporterFactory.CreateMetricsExporter()
type CreateMetricsExporter func(context.Context, component.ExporterCreateParams, configmodels.Exporter) (component.MetricsExporter, error)
Expand Down Expand Up @@ -107,11 +107,11 @@ func (f *factory) CreateDefaultConfig() configmodels.Exporter {
return f.createDefaultConfig()
}

// CreateTraceExporter creates a component.TraceExporter based on this config.
func (f *factory) CreateTraceExporter(
// CreateTraceExporter creates a component.TracesExporter based on this config.
func (f *factory) CreateTracesExporter(
ctx context.Context,
params component.ExporterCreateParams,
cfg configmodels.Exporter) (component.TraceExporter, error) {
cfg configmodels.Exporter) (component.TracesExporter, error) {
if f.createTraceExporter != nil {
return f.createTraceExporter(ctx, params, cfg)
}
Expand Down
6 changes: 3 additions & 3 deletions exporter/exporterhelper/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func TestNewFactory(t *testing.T) {
assert.EqualValues(t, defaultCfg, factory.CreateDefaultConfig())
_, ok := factory.(component.ConfigUnmarshaler)
assert.False(t, ok)
_, err := factory.CreateTraceExporter(context.Background(), component.ExporterCreateParams{Logger: zap.NewNop()}, defaultCfg)
_, err := factory.CreateTracesExporter(context.Background(), component.ExporterCreateParams{Logger: zap.NewNop()}, defaultCfg)
assert.Equal(t, configerror.ErrDataTypeIsNotSupported, err)
_, err = factory.CreateMetricsExporter(context.Background(), component.ExporterCreateParams{Logger: zap.NewNop()}, defaultCfg)
assert.Equal(t, configerror.ErrDataTypeIsNotSupported, err)
Expand All @@ -78,7 +78,7 @@ func TestNewFactory_WithConstructors(t *testing.T) {
assert.True(t, ok)
assert.Equal(t, errors.New("my error"), fu.Unmarshal(nil, nil))

te, err := factory.CreateTraceExporter(context.Background(), component.ExporterCreateParams{Logger: zap.NewNop()}, defaultCfg)
te, err := factory.CreateTracesExporter(context.Background(), component.ExporterCreateParams{Logger: zap.NewNop()}, defaultCfg)
assert.NoError(t, err)
assert.Same(t, nopTracesExporter, te)

Expand All @@ -95,7 +95,7 @@ func defaultConfig() configmodels.Exporter {
return defaultCfg
}

func createTraceExporter(context.Context, component.ExporterCreateParams, configmodels.Exporter) (component.TraceExporter, error) {
func createTraceExporter(context.Context, component.ExporterCreateParams, configmodels.Exporter) (component.TracesExporter, error) {
return nopTracesExporter, nil
}

Expand Down
4 changes: 2 additions & 2 deletions exporter/exporterhelper/tracehelper.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ func (texp *traceExporter) ConsumeTraces(ctx context.Context, td pdata.Traces) e
return err
}

// NewTraceExporter creates a TraceExporter that records observability metrics and wraps every request with a Span.
// NewTraceExporter creates a TracesExporter that records observability metrics and wraps every request with a Span.
func NewTraceExporter(
cfg configmodels.Exporter,
logger *zap.Logger,
dataPusher traceDataPusher,
options ...ExporterOption,
) (component.TraceExporter, error) {
) (component.TracesExporter, error) {

if cfg == nil {
return nil, errNilConfig
Expand Down
6 changes: 3 additions & 3 deletions exporter/exporterhelper/tracehelper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func newTraceDataPusher(droppedSpans int, retError error) traceDataPusher {
}
}

func checkRecordedMetricsForTraceExporter(t *testing.T, te component.TraceExporter, wantError error, droppedSpans int) {
func checkRecordedMetricsForTraceExporter(t *testing.T, te component.TracesExporter, wantError error, droppedSpans int) {
doneFn, err := obsreporttest.SetupRecordedMetricsTest()
require.NoError(t, err)
defer doneFn()
Expand All @@ -196,7 +196,7 @@ func checkRecordedMetricsForTraceExporter(t *testing.T, te component.TraceExport
}
}

func generateTraceTraffic(t *testing.T, te component.TraceExporter, numRequests int, wantError error) {
func generateTraceTraffic(t *testing.T, te component.TracesExporter, numRequests int, wantError error) {
td := pdata.NewTraces()
rs := td.ResourceSpans()
rs.Resize(1)
Expand All @@ -209,7 +209,7 @@ func generateTraceTraffic(t *testing.T, te component.TraceExporter, numRequests
}
}

func checkWrapSpanForTraceExporter(t *testing.T, te component.TraceExporter, wantError error, numSpans int64) {
func checkWrapSpanForTraceExporter(t *testing.T, te component.TracesExporter, wantError error, numSpans int64) {
ocSpansSaver := new(testOCTraceExporter)
trace.RegisterExporter(ocSpansSaver)
defer trace.UnregisterExporter(ocSpansSaver)
Expand Down
4 changes: 2 additions & 2 deletions exporter/exportertest/nop_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ func (ne *nopExporter) Shutdown(context.Context) error {
return nil
}

// NewNopTraceExporter creates an TraceExporter that just drops the received data.
// NewNopTraceExporter creates an TracesExporter that just drops the received data.
// Deprecated: Use consumertest.NewNopTraces.
func NewNopTraceExporter() component.TraceExporter {
func NewNopTraceExporter() component.TracesExporter {
return &nopExporter{}
}

Expand Down
2 changes: 1 addition & 1 deletion exporter/fileexporter/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func createTraceExporter(
_ context.Context,
_ component.ExporterCreateParams,
cfg configmodels.Exporter,
) (component.TraceExporter, error) {
) (component.TracesExporter, error) {
return createExporter(cfg)
}

Expand Down
2 changes: 1 addition & 1 deletion exporter/jaegerexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func TestLoadConfig(t *testing.T) {
})

params := component.ExporterCreateParams{Logger: zap.NewNop()}
te, err := factory.CreateTraceExporter(context.Background(), params, e1)
te, err := factory.CreateTracesExporter(context.Background(), params, e1)
require.NoError(t, err)
require.NotNil(t, te)
}
2 changes: 1 addition & 1 deletion exporter/jaegerexporter/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (
// newTraceExporter returns a new Jaeger gRPC exporter.
// The exporter name is the name to be used in the observability of the exporter.
// The collectorEndpoint should be of the form "hostname:14250" (a gRPC target).
func newTraceExporter(cfg *Config, logger *zap.Logger) (component.TraceExporter, error) {
func newTraceExporter(cfg *Config, logger *zap.Logger) (component.TracesExporter, error) {

opts, err := cfg.GRPCClientSettings.ToDialOptions()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion exporter/jaegerexporter/exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ func TestMutualTLS(t *testing.T) {
ServerName: "localhost",
},
}
exporter, err := factory.CreateTraceExporter(context.Background(), component.ExporterCreateParams{Logger: zap.NewNop()}, cfg)
exporter, err := factory.CreateTracesExporter(context.Background(), component.ExporterCreateParams{Logger: zap.NewNop()}, cfg)
require.NoError(t, err)
err = exporter.Start(context.Background(), nil)
require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion exporter/jaegerexporter/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func createTraceExporter(
_ context.Context,
params component.ExporterCreateParams,
config configmodels.Exporter,
) (component.TraceExporter, error) {
) (component.TracesExporter, error) {

expCfg := config.(*Config)
if expCfg.Endpoint == "" {
Expand Down
4 changes: 2 additions & 2 deletions exporter/jaegerexporter/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ func TestCreateInstanceViaFactory(t *testing.T) {
// Default config doesn't have default endpoint so creating from it should
// fail.
params := component.ExporterCreateParams{Logger: zap.NewNop()}
exp, err := factory.CreateTraceExporter(context.Background(), params, cfg)
exp, err := factory.CreateTracesExporter(context.Background(), params, cfg)
assert.NotNil(t, err)
assert.Equal(t, "\"jaeger\" config requires a non-empty \"endpoint\"", err.Error())
assert.Nil(t, exp)

// Endpoint doesn't have a default value so set it directly.
expCfg := cfg.(*Config)
expCfg.Endpoint = "some.target.org:12345"
exp, err = factory.CreateTraceExporter(context.Background(), params, cfg)
exp, err = factory.CreateTracesExporter(context.Background(), params, cfg)
assert.NoError(t, err)
assert.NotNil(t, exp)

Expand Down
2 changes: 1 addition & 1 deletion exporter/kafkaexporter/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func (f *kafkaExporterFactory) createTraceExporter(
_ context.Context,
params component.ExporterCreateParams,
cfg configmodels.Exporter,
) (component.TraceExporter, error) {
) (component.TracesExporter, error) {
oCfg := cfg.(*Config)
exp, err := newExporter(*oCfg, params, f.marshallers)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions exporter/kafkaexporter/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ func TestWithMarshallers(t *testing.T) {

t.Run("custom_encoding", func(t *testing.T) {
cfg.Encoding = cm.Encoding()
exporter, err := f.CreateTraceExporter(context.Background(), component.ExporterCreateParams{Logger: zap.NewNop()}, cfg)
exporter, err := f.CreateTracesExporter(context.Background(), component.ExporterCreateParams{Logger: zap.NewNop()}, cfg)
require.NoError(t, err)
require.NotNil(t, exporter)
})
t.Run("default_encoding", func(t *testing.T) {
cfg.Encoding = new(otlpProtoMarshaller).Encoding()
exporter, err := f.CreateTraceExporter(context.Background(), component.ExporterCreateParams{Logger: zap.NewNop()}, cfg)
exporter, err := f.CreateTracesExporter(context.Background(), component.ExporterCreateParams{Logger: zap.NewNop()}, cfg)
require.NoError(t, err)
assert.NotNil(t, exporter)
})
Expand Down
2 changes: 1 addition & 1 deletion exporter/loggingexporter/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func createDefaultConfig() configmodels.Exporter {
}
}

func createTraceExporter(_ context.Context, _ component.ExporterCreateParams, config configmodels.Exporter) (component.TraceExporter, error) {
func createTraceExporter(_ context.Context, _ component.ExporterCreateParams, config configmodels.Exporter) (component.TracesExporter, error) {
cfg := config.(*Config)

exporterLogger, err := createLogger(cfg)
Expand Down
2 changes: 1 addition & 1 deletion exporter/loggingexporter/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func TestCreateTraceExporter(t *testing.T) {
factory := NewFactory()
cfg := factory.CreateDefaultConfig()

te, err := factory.CreateTraceExporter(context.Background(), component.ExporterCreateParams{Logger: zap.NewNop()}, cfg)
te, err := factory.CreateTracesExporter(context.Background(), component.ExporterCreateParams{Logger: zap.NewNop()}, cfg)
assert.NoError(t, err)
assert.NotNil(t, te)
}
Expand Down
6 changes: 3 additions & 3 deletions exporter/loggingexporter/logging_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ func (s *loggingExporter) pushTraceData(
td pdata.Traces,
) (int, error) {

s.logger.Info("TraceExporter", zap.Int("#spans", td.SpanCount()))
s.logger.Info("TracesExporter", zap.Int("#spans", td.SpanCount()))

if !s.debug {
return 0, nil
Expand Down Expand Up @@ -425,9 +425,9 @@ func (s *loggingExporter) pushMetricsData(
return 0, nil
}

// newTraceExporter creates an exporter.TraceExporter that just drops the
// newTraceExporter creates an exporter.TracesExporter that just drops the
// received data and logs debugging messages.
func newTraceExporter(config configmodels.Exporter, level string, logger *zap.Logger) (component.TraceExporter, error) {
func newTraceExporter(config configmodels.Exporter, level string, logger *zap.Logger) (component.TracesExporter, error) {
s := &loggingExporter{
debug: level == "debug",
logger: logger,
Expand Down
2 changes: 1 addition & 1 deletion exporter/opencensusexporter/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func createDefaultConfig() configmodels.Exporter {
}
}

func createTraceExporter(ctx context.Context, params component.ExporterCreateParams, config configmodels.Exporter) (component.TraceExporter, error) {
func createTraceExporter(ctx context.Context, params component.ExporterCreateParams, config configmodels.Exporter) (component.TracesExporter, error) {
oCfg := config.(*Config)
return newTraceExporter(ctx, oCfg, params.Logger)
}
Expand Down
2 changes: 1 addition & 1 deletion exporter/opencensusexporter/opencensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func (oce *ocExporter) shutdown(context.Context) error {
return oce.grpcClientConn.Close()
}

func newTraceExporter(ctx context.Context, cfg *Config, logger *zap.Logger) (component.TraceExporter, error) {
func newTraceExporter(ctx context.Context, cfg *Config, logger *zap.Logger) (component.TracesExporter, error) {
oce, err := newOcExporter(ctx, cfg)
if err != nil {
return nil, err
Expand Down
6 changes: 3 additions & 3 deletions exporter/opencensusexporter/opencensus_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func TestSendTraces(t *testing.T) {
},
}
cfg.NumWorkers = 1
exp, err := factory.CreateTraceExporter(context.Background(), component.ExporterCreateParams{Logger: zap.NewNop()}, cfg)
exp, err := factory.CreateTracesExporter(context.Background(), component.ExporterCreateParams{Logger: zap.NewNop()}, cfg)
require.NoError(t, err)
require.NotNil(t, exp)
host := componenttest.NewNopHost()
Expand Down Expand Up @@ -97,7 +97,7 @@ func TestSendTraces_NoBackend(t *testing.T) {
Insecure: true,
},
}
exp, err := factory.CreateTraceExporter(context.Background(), component.ExporterCreateParams{Logger: zap.NewNop()}, cfg)
exp, err := factory.CreateTracesExporter(context.Background(), component.ExporterCreateParams{Logger: zap.NewNop()}, cfg)
require.NoError(t, err)
require.NotNil(t, exp)
host := componenttest.NewNopHost()
Expand All @@ -121,7 +121,7 @@ func TestSendTraces_AfterStop(t *testing.T) {
Insecure: true,
},
}
exp, err := factory.CreateTraceExporter(context.Background(), component.ExporterCreateParams{Logger: zap.NewNop()}, cfg)
exp, err := factory.CreateTracesExporter(context.Background(), component.ExporterCreateParams{Logger: zap.NewNop()}, cfg)
require.NoError(t, err)
require.NotNil(t, exp)
host := componenttest.NewNopHost()
Expand Down
2 changes: 1 addition & 1 deletion exporter/otlpexporter/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func createTraceExporter(
_ context.Context,
params component.ExporterCreateParams,
cfg configmodels.Exporter,
) (component.TraceExporter, error) {
) (component.TracesExporter, error) {
oce, err := newExporter(cfg)
if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion exporter/otlpexporter/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ func TestCreateTraceExporter(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
factory := NewFactory()
creationParams := component.ExporterCreateParams{Logger: zap.NewNop()}
consumer, err := factory.CreateTraceExporter(context.Background(), creationParams, &tt.config)
consumer, err := factory.CreateTracesExporter(context.Background(), creationParams, &tt.config)

if tt.mustFail {
assert.NotNil(t, err)
Expand Down
Loading