From 64633e15f884c0da6ec8577fe93af584f00a1a49 Mon Sep 17 00:00:00 2001 From: Pavel Kositsyn Date: Fri, 6 Nov 2020 22:15:34 +0300 Subject: [PATCH 1/5] bump opentelemetry-collector to v0.14.0 Signed-off-by: Pavel Kositsyn --- .../app/exporter/badgerexporter/factory.go | 6 +-- .../exporter/badgerexporter/factory_test.go | 2 +- .../exporter/cassandraexporter/exporter.go | 4 +- .../app/exporter/cassandraexporter/factory.go | 4 +- .../cassandraexporter/factory_test.go | 2 +- .../esmodeltranslator/modeltranslator.go | 10 +--- .../esmodeltranslator/modeltranslator_test.go | 46 +++++++++++-------- .../elasticsearchexporter/exporter.go | 3 +- .../exporter/elasticsearchexporter/factory.go | 4 +- .../elasticsearchexporter/factory_test.go | 4 +- .../elasticsearchexporter/spanstore.go | 3 +- .../exporter/grpcpluginexporter/exporter.go | 4 +- .../exporter/grpcpluginexporter/factory.go | 4 +- .../grpcpluginexporter/factory_test.go | 2 +- .../jaegerexporter/jaeger_exporter.go | 6 +-- .../jaegerexporter/jaeger_exporter_test.go | 1 - .../exporter/kafkaexporter/kafka_exporter.go | 6 +-- .../app/exporter/memoryexporter/factory.go | 6 +-- .../exporter/memoryexporter/factory_test.go | 8 ++-- .../app/exporter/span_writer_exporter.go | 3 +- .../app/exporter/span_writer_exporter_test.go | 25 +++++++--- .../internal/reader/es/esspanreader/query.go | 2 +- .../resourceprocessor/resource_processor.go | 8 ++-- .../resource_processor_test.go | 6 +-- .../jaegerreceiver/jaeger_receiver.go | 8 ++-- .../receiver/kafkareceiver/kafka_receiver.go | 8 ++-- .../zipkinreceiver/zipkin_receiver.go | 8 ++-- cmd/opentelemetry/go.mod | 2 +- cmd/opentelemetry/go.sum | 30 ++++++++++++ 29 files changed, 133 insertions(+), 92 deletions(-) diff --git a/cmd/opentelemetry/app/exporter/badgerexporter/factory.go b/cmd/opentelemetry/app/exporter/badgerexporter/factory.go index 1114f9936c8..0bd125cd174 100644 --- a/cmd/opentelemetry/app/exporter/badgerexporter/factory.go +++ b/cmd/opentelemetry/app/exporter/badgerexporter/factory.go @@ -91,17 +91,17 @@ func (f Factory) CreateDefaultConfig() configmodels.Exporter { // CreateTraceExporter creates Jaeger Cassandra trace exporter. // This function implements OTEL component.ExporterFactory interface. -func (f Factory) CreateTraceExporter( +func (f Factory) CreateTracesExporter( _ context.Context, params component.ExporterCreateParams, cfg configmodels.Exporter, -) (component.TraceExporter, error) { +) (component.TracesExporter, error) { config := cfg.(*Config) factory, err := f.createStorageFactory(params, config) if err != nil { return nil, err } - return exporter.NewSpanWriterExporter(cfg, factory, + return exporter.NewSpanWriterExporter(cfg, params, factory, exporterhelper.WithTimeout(config.TimeoutSettings), exporterhelper.WithQueue(config.QueueSettings), exporterhelper.WithRetry(config.RetrySettings)) diff --git a/cmd/opentelemetry/app/exporter/badgerexporter/factory_test.go b/cmd/opentelemetry/app/exporter/badgerexporter/factory_test.go index ef280f64699..be65541eca4 100644 --- a/cmd/opentelemetry/app/exporter/badgerexporter/factory_test.go +++ b/cmd/opentelemetry/app/exporter/badgerexporter/factory_test.go @@ -37,7 +37,7 @@ func TestCreateTraceExporter(t *testing.T) { factory := NewFactory(func() *badger.Options { return opts }) - exporter, err := factory.CreateTraceExporter(context.Background(), component.ExporterCreateParams{Logger: zap.NewNop()}, factory.CreateDefaultConfig()) + exporter, err := factory.CreateTracesExporter(context.Background(), component.ExporterCreateParams{Logger: zap.NewNop()}, factory.CreateDefaultConfig()) require.NoError(t, err) assert.NotNil(t, exporter) } diff --git a/cmd/opentelemetry/app/exporter/cassandraexporter/exporter.go b/cmd/opentelemetry/app/exporter/cassandraexporter/exporter.go index 74234e0bf32..2e5b1406b59 100644 --- a/cmd/opentelemetry/app/exporter/cassandraexporter/exporter.go +++ b/cmd/opentelemetry/app/exporter/cassandraexporter/exporter.go @@ -24,7 +24,7 @@ import ( ) // new creates Cassandra exporter/storage -func new(config *Config, params component.ExporterCreateParams) (component.TraceExporter, error) { +func new(config *Config, params component.ExporterCreateParams) (component.TracesExporter, error) { f := cassandra.NewFactory() f.InitFromOptions(&config.Options) @@ -32,7 +32,7 @@ func new(config *Config, params component.ExporterCreateParams) (component.Trace if err != nil { return nil, err } - return exporter.NewSpanWriterExporter(config, f, + return exporter.NewSpanWriterExporter(config, params, f, exporterhelper.WithTimeout(config.TimeoutSettings), exporterhelper.WithQueue(config.QueueSettings), exporterhelper.WithRetry(config.RetrySettings)) diff --git a/cmd/opentelemetry/app/exporter/cassandraexporter/factory.go b/cmd/opentelemetry/app/exporter/cassandraexporter/factory.go index f9c4f16327a..72f0ab6bd62 100644 --- a/cmd/opentelemetry/app/exporter/cassandraexporter/factory.go +++ b/cmd/opentelemetry/app/exporter/cassandraexporter/factory.go @@ -73,11 +73,11 @@ func (f Factory) CreateDefaultConfig() configmodels.Exporter { // CreateTraceExporter creates Jaeger Cassandra trace exporter. // This function implements OTEL component.ExporterFactory interface. -func (f Factory) CreateTraceExporter( +func (f Factory) CreateTracesExporter( _ context.Context, params component.ExporterCreateParams, cfg configmodels.Exporter, -) (component.TraceExporter, error) { +) (component.TracesExporter, error) { config := cfg.(*Config) return new(config, params) } diff --git a/cmd/opentelemetry/app/exporter/cassandraexporter/factory_test.go b/cmd/opentelemetry/app/exporter/cassandraexporter/factory_test.go index 7e6bea83f12..ea17c875eea 100644 --- a/cmd/opentelemetry/app/exporter/cassandraexporter/factory_test.go +++ b/cmd/opentelemetry/app/exporter/cassandraexporter/factory_test.go @@ -37,7 +37,7 @@ func TestCreateTraceExporter(t *testing.T) { factory := Factory{OptionsFactory: func() *cassandra.Options { return opts }} - exporter, err := factory.CreateTraceExporter(context.Background(), component.ExporterCreateParams{}, factory.CreateDefaultConfig()) + exporter, err := factory.CreateTracesExporter(context.Background(), component.ExporterCreateParams{}, factory.CreateDefaultConfig()) require.Nil(t, exporter) assert.Contains(t, err.Error(), "gocql: unable to create session") } diff --git a/cmd/opentelemetry/app/exporter/elasticsearchexporter/esmodeltranslator/modeltranslator.go b/cmd/opentelemetry/app/exporter/elasticsearchexporter/esmodeltranslator/modeltranslator.go index 7939802aa41..0c6335795ad 100644 --- a/cmd/opentelemetry/app/exporter/elasticsearchexporter/esmodeltranslator/modeltranslator.go +++ b/cmd/opentelemetry/app/exporter/elasticsearchexporter/esmodeltranslator/modeltranslator.go @@ -222,10 +222,7 @@ func references(links pdata.SpanLinkSlice, parentSpanID pdata.SpanID, traceID db } func convertSpanID(spanID pdata.SpanID) (dbmodel.SpanID, error) { - spanIDInt, err := tracetranslator.BytesToUInt64SpanID(spanID.Bytes()) - if err != nil { - return "", err - } + spanIDInt := tracetranslator.BytesToUInt64SpanID(spanID.Bytes()) if spanIDInt == 0 { return "", errZeroSpanID } @@ -233,10 +230,7 @@ func convertSpanID(spanID pdata.SpanID) (dbmodel.SpanID, error) { } func convertTraceID(traceID pdata.TraceID) (dbmodel.TraceID, error) { - high, low, err := tracetranslator.BytesToUInt64TraceID(traceID.Bytes()) - if err != nil { - return "", err - } + high, low := tracetranslator.BytesToUInt64TraceID(traceID.Bytes()) if low == 0 && high == 0 { return "", errZeroTraceID } diff --git a/cmd/opentelemetry/app/exporter/elasticsearchexporter/esmodeltranslator/modeltranslator_test.go b/cmd/opentelemetry/app/exporter/elasticsearchexporter/esmodeltranslator/modeltranslator_test.go index 75d65756503..585a3f735fa 100644 --- a/cmd/opentelemetry/app/exporter/elasticsearchexporter/esmodeltranslator/modeltranslator_test.go +++ b/cmd/opentelemetry/app/exporter/elasticsearchexporter/esmodeltranslator/modeltranslator_test.go @@ -15,7 +15,6 @@ package esmodeltranslator import ( - "encoding/binary" "fmt" "testing" "time" @@ -30,8 +29,8 @@ import ( ) var ( - traceID = pdata.NewTraceID([]byte("0123456789abcdef")) - spanID = pdata.NewSpanID([]byte("01234567")) + traceID = pdata.NewTraceID(Byte16ArrayFromString("0123456789abcdef")) + spanID = pdata.NewSpanID(Byte8ArrayFromString("01234567")) ) func TestAttributeToKeyValue(t *testing.T) { @@ -151,7 +150,7 @@ func TestConvertSpan(t *testing.T) { StartTimeMillis: 1, Tags: []dbmodel.KeyValue{ {Key: "span.kind", Type: dbmodel.StringType, Value: "client"}, - {Key: "status.code", Type: dbmodel.StringType, Value: "STATUS_CODE_CANCELLED"}, + {Key: "status.code", Type: dbmodel.StringType, Value: "STATUS_CODE_OK"}, {Key: "error", Type: dbmodel.BoolType, Value: "true"}, {Key: "status.message", Type: dbmodel.StringType, Value: "messagetext"}, {Key: "foo", Type: dbmodel.BoolType, Value: "true"}, @@ -196,9 +195,15 @@ func TestSpanEmptyRef(t *testing.T) { Duration: 1000, OperationName: "root", StartTimeMillis: 1, - Tags: []dbmodel.KeyValue{}, // should not be nil - Logs: []dbmodel.Log{}, // should not be nil - References: []dbmodel.Reference{}, // should not be nil + Tags: []dbmodel.KeyValue{}, // should not be nil + Logs: []dbmodel.Log{}, // should not be nil + References: []dbmodel.Reference{ + { + RefType: "CHILD_OF", + TraceID: "30313233343536373839616263646566", + SpanID: "3031323334353637", + }, + }, Process: dbmodel.Process{ ServiceName: "myservice", Tags: nil, @@ -215,26 +220,16 @@ func TestEmpty(t *testing.T) { } func TestErrorIDs(t *testing.T) { - zero64Bytes := make([]byte, 16) - binary.LittleEndian.PutUint64(zero64Bytes, 0) - binary.LittleEndian.PutUint64(zero64Bytes, 0) + var zero64Bytes [16]byte + var zero32Bytes [8]byte tests := []struct { spanID pdata.SpanID traceID pdata.TraceID err string }{ - { - traceID: pdata.NewTraceID([]byte("invalid-%")), - err: "TraceID does not have 16 bytes", - }, - { - traceID: traceID, - spanID: pdata.NewSpanID([]byte("invalid-%")), - err: "SpanID does not have 8 bytes", - }, { traceID: traceID, - spanID: pdata.NewSpanID(zero64Bytes[:8]), + spanID: pdata.NewSpanID(zero32Bytes), err: errZeroSpanID.Error(), }, { @@ -274,7 +269,18 @@ func addSpan(traces pdata.Traces, name string, traceID pdata.TraceID, spanID pda span.SetName(name) span.SetTraceID(traceID) span.SetSpanID(spanID) + span.SetParentSpanID(spanID) span.SetStartTime(pdata.TimestampUnixNano(time.Now().UnixNano())) span.SetEndTime(pdata.TimestampUnixNano(time.Now().UnixNano())) return span } + +func Byte16ArrayFromString(s string) (result [16]byte) { + copy(result[:], s) + return +} + +func Byte8ArrayFromString(s string) (result [8]byte) { + copy(result[:], s) + return +} diff --git a/cmd/opentelemetry/app/exporter/elasticsearchexporter/exporter.go b/cmd/opentelemetry/app/exporter/elasticsearchexporter/exporter.go index d330452472a..d9118c984b5 100644 --- a/cmd/opentelemetry/app/exporter/elasticsearchexporter/exporter.go +++ b/cmd/opentelemetry/app/exporter/elasticsearchexporter/exporter.go @@ -24,7 +24,7 @@ import ( ) // newExporter creates Elasticsearch exporter/storage. -func newExporter(ctx context.Context, config *Config, params component.ExporterCreateParams) (component.TraceExporter, error) { +func newExporter(ctx context.Context, config *Config, params component.ExporterCreateParams) (component.TracesExporter, error) { esCfg := config.GetPrimary() w, err := newEsSpanWriter(*esCfg, params.Logger, false, config.Name()) if err != nil { @@ -38,6 +38,7 @@ func newExporter(ctx context.Context, config *Config, params component.ExporterC } return exporterhelper.NewTraceExporter( config, + params.Logger, w.WriteTraces, exporterhelper.WithTimeout(config.TimeoutSettings), exporterhelper.WithQueue(config.QueueSettings), diff --git a/cmd/opentelemetry/app/exporter/elasticsearchexporter/factory.go b/cmd/opentelemetry/app/exporter/elasticsearchexporter/factory.go index 75b9580843f..f5e0cee2970 100644 --- a/cmd/opentelemetry/app/exporter/elasticsearchexporter/factory.go +++ b/cmd/opentelemetry/app/exporter/elasticsearchexporter/factory.go @@ -74,11 +74,11 @@ func (f Factory) CreateDefaultConfig() configmodels.Exporter { // CreateTraceExporter creates Jaeger Elasticsearch trace exporter. // This function implements OTEL component.ExporterFactory interface. -func (Factory) CreateTraceExporter( +func (Factory) CreateTracesExporter( ctx context.Context, params component.ExporterCreateParams, cfg configmodels.Exporter, -) (component.TraceExporter, error) { +) (component.TracesExporter, error) { esCfg, ok := cfg.(*Config) if !ok { return nil, fmt.Errorf("could not cast configuration to %s", TypeStr) diff --git a/cmd/opentelemetry/app/exporter/elasticsearchexporter/factory_test.go b/cmd/opentelemetry/app/exporter/elasticsearchexporter/factory_test.go index e3dec84610a..13f30b298d7 100644 --- a/cmd/opentelemetry/app/exporter/elasticsearchexporter/factory_test.go +++ b/cmd/opentelemetry/app/exporter/elasticsearchexporter/factory_test.go @@ -40,14 +40,14 @@ func TestCreateTraceExporter(t *testing.T) { }} config := factory.CreateDefaultConfig().(*Config) config.Primary.Servers = []string{"http://foobardoesnotexists.test"} - exporter, err := factory.CreateTraceExporter(context.Background(), component.ExporterCreateParams{Logger: zap.NewNop()}, config) + exporter, err := factory.CreateTracesExporter(context.Background(), component.ExporterCreateParams{Logger: zap.NewNop()}, config) require.Nil(t, exporter) assert.Contains(t, err.Error(), "no such host") } func TestCreateTraceExporter_nilConfig(t *testing.T) { factory := &Factory{} - exporter, err := factory.CreateTraceExporter(context.Background(), component.ExporterCreateParams{}, nil) + exporter, err := factory.CreateTracesExporter(context.Background(), component.ExporterCreateParams{}, nil) require.Nil(t, exporter) assert.Contains(t, err.Error(), "could not cast configuration to jaeger_elasticsearch") } diff --git a/cmd/opentelemetry/app/exporter/elasticsearchexporter/spanstore.go b/cmd/opentelemetry/app/exporter/elasticsearchexporter/spanstore.go index bdb6c4ed120..b8905eae28b 100644 --- a/cmd/opentelemetry/app/exporter/elasticsearchexporter/spanstore.go +++ b/cmd/opentelemetry/app/exporter/elasticsearchexporter/spanstore.go @@ -46,7 +46,6 @@ const ( serviceIndexBaseName = "jaeger-service" spanTypeName = "span" serviceTypeName = "service" - indexDateFormat = "2006-01-02" // date format for index e.g. 2020-01-20 ) // esSpanWriter holds components required for ES span writer @@ -245,7 +244,7 @@ func bulkItemsToTraces(bulkItems []bulkItem) pdata.Traces { rss := traces.ResourceSpans().At(i) if !spanData.Resource.IsNil() { rss.Resource().InitEmpty() - rss.Resource().Attributes().InitFromAttributeMap(spanData.Resource.Attributes()) + spanData.Resource.Attributes().CopyTo(rss.Resource().Attributes()) } rss.InstrumentationLibrarySpans().Resize(1) ispans := rss.InstrumentationLibrarySpans().At(0) diff --git a/cmd/opentelemetry/app/exporter/grpcpluginexporter/exporter.go b/cmd/opentelemetry/app/exporter/grpcpluginexporter/exporter.go index c9ba8dda60b..85c17073551 100644 --- a/cmd/opentelemetry/app/exporter/grpcpluginexporter/exporter.go +++ b/cmd/opentelemetry/app/exporter/grpcpluginexporter/exporter.go @@ -24,14 +24,14 @@ import ( ) // new creates gRPC exporter/storage. -func new(config *Config, params component.ExporterCreateParams) (component.TraceExporter, error) { +func new(config *Config, params component.ExporterCreateParams) (component.TracesExporter, error) { factory := storageGrpc.NewFactory() factory.InitFromOptions(config.Options) err := factory.Initialize(metrics.NullFactory, params.Logger) if err != nil { return nil, err } - return storageOtelExporter.NewSpanWriterExporter(&config.ExporterSettings, factory, + return storageOtelExporter.NewSpanWriterExporter(&config.ExporterSettings, params, factory, exporterhelper.WithTimeout(config.TimeoutSettings), exporterhelper.WithQueue(config.QueueSettings), exporterhelper.WithRetry(config.RetrySettings)) diff --git a/cmd/opentelemetry/app/exporter/grpcpluginexporter/factory.go b/cmd/opentelemetry/app/exporter/grpcpluginexporter/factory.go index 129fa5b0933..d935ddb2133 100644 --- a/cmd/opentelemetry/app/exporter/grpcpluginexporter/factory.go +++ b/cmd/opentelemetry/app/exporter/grpcpluginexporter/factory.go @@ -67,11 +67,11 @@ func (f Factory) CreateDefaultConfig() configmodels.Exporter { // CreateTraceExporter creates Jaeger gRPC trace exporter. // This function implements OTEL component.ExporterFactory interface. -func (f Factory) CreateTraceExporter( +func (f Factory) CreateTracesExporter( _ context.Context, params component.ExporterCreateParams, cfg configmodels.Exporter, -) (component.TraceExporter, error) { +) (component.TracesExporter, error) { grpcCfg := cfg.(*Config) return new(grpcCfg, params) } diff --git a/cmd/opentelemetry/app/exporter/grpcpluginexporter/factory_test.go b/cmd/opentelemetry/app/exporter/grpcpluginexporter/factory_test.go index b0d1b649520..1e9eea80527 100644 --- a/cmd/opentelemetry/app/exporter/grpcpluginexporter/factory_test.go +++ b/cmd/opentelemetry/app/exporter/grpcpluginexporter/factory_test.go @@ -36,7 +36,7 @@ func TestCreateTraceExporter(t *testing.T) { factory := &Factory{OptionsFactory: func() *storageGrpc.Options { return opts }} - exporter, err := factory.CreateTraceExporter(context.Background(), component.ExporterCreateParams{}, factory.CreateDefaultConfig()) + exporter, err := factory.CreateTracesExporter(context.Background(), component.ExporterCreateParams{}, factory.CreateDefaultConfig()) require.Nil(t, exporter) assert.Contains(t, err.Error(), "error attempting to connect to plugin rpc client: fork/exec : no such file or directory") } diff --git a/cmd/opentelemetry/app/exporter/jaegerexporter/jaeger_exporter.go b/cmd/opentelemetry/app/exporter/jaegerexporter/jaeger_exporter.go index 8bba30ac831..c89a54ca39d 100644 --- a/cmd/opentelemetry/app/exporter/jaegerexporter/jaeger_exporter.go +++ b/cmd/opentelemetry/app/exporter/jaegerexporter/jaeger_exporter.go @@ -60,12 +60,12 @@ func (f Factory) CreateDefaultConfig() configmodels.Exporter { // CreateTraceExporter creates Jaeger trace exporter. // This function implements OTEL component.ExporterFactory interface. -func (f Factory) CreateTraceExporter( +func (f Factory) CreateTracesExporter( ctx context.Context, params component.ExporterCreateParams, cfg configmodels.Exporter, -) (component.TraceExporter, error) { - return f.Wrapped.CreateTraceExporter(ctx, params, cfg) +) (component.TracesExporter, error) { + return f.Wrapped.CreateTracesExporter(ctx, params, cfg) } // CreateMetricsExporter creates a metrics exporter based on provided config. diff --git a/cmd/opentelemetry/app/exporter/jaegerexporter/jaeger_exporter_test.go b/cmd/opentelemetry/app/exporter/jaegerexporter/jaeger_exporter_test.go index 1c49540bb66..006fbbd09ba 100644 --- a/cmd/opentelemetry/app/exporter/jaegerexporter/jaeger_exporter_test.go +++ b/cmd/opentelemetry/app/exporter/jaegerexporter/jaeger_exporter_test.go @@ -64,7 +64,6 @@ func TestDefaultValueFromViper(t *testing.T) { cfg := f.CreateDefaultConfig().(*jaegerexporter.Config) qs := exporterhelper.CreateDefaultQueueSettings() - qs.Enabled = false assert.Equal(t, &jaegerexporter.Config{ ExporterSettings: configmodels.ExporterSettings{ TypeVal: "jaeger", diff --git a/cmd/opentelemetry/app/exporter/kafkaexporter/kafka_exporter.go b/cmd/opentelemetry/app/exporter/kafkaexporter/kafka_exporter.go index 288331450f0..db916fc1822 100644 --- a/cmd/opentelemetry/app/exporter/kafkaexporter/kafka_exporter.go +++ b/cmd/opentelemetry/app/exporter/kafkaexporter/kafka_exporter.go @@ -99,12 +99,12 @@ func (f Factory) CreateDefaultConfig() configmodels.Exporter { // CreateTraceExporter creates Jaeger trace exporter. // This function implements OTEL component.ExporterFactory interface. -func (f Factory) CreateTraceExporter( +func (f Factory) CreateTracesExporter( ctx context.Context, params component.ExporterCreateParams, cfg configmodels.Exporter, -) (component.TraceExporter, error) { - return f.Wrapped.CreateTraceExporter(ctx, params, cfg) +) (component.TracesExporter, error) { + return f.Wrapped.CreateTracesExporter(ctx, params, cfg) } // CreateMetricsExporter creates a metrics exporter based on provided config. diff --git a/cmd/opentelemetry/app/exporter/memoryexporter/factory.go b/cmd/opentelemetry/app/exporter/memoryexporter/factory.go index 7bb5491cd75..c45d5881f10 100644 --- a/cmd/opentelemetry/app/exporter/memoryexporter/factory.go +++ b/cmd/opentelemetry/app/exporter/memoryexporter/factory.go @@ -80,16 +80,16 @@ func (f Factory) CreateDefaultConfig() configmodels.Exporter { // CreateTraceExporter creates Jaeger Kafka trace exporter. // This function implements OTEL component.ExporterFactory interface. -func (f Factory) CreateTraceExporter( +func (f Factory) CreateTracesExporter( _ context.Context, params component.ExporterCreateParams, cfg configmodels.Exporter, -) (component.TraceExporter, error) { +) (component.TracesExporter, error) { factory, err := f.createStorageFactory(params, cfg) if err != nil { return nil, err } - return exporter.NewSpanWriterExporter(cfg, factory) + return exporter.NewSpanWriterExporter(cfg, params, factory) } // CreateMetricsExporter is not implemented. diff --git a/cmd/opentelemetry/app/exporter/memoryexporter/factory_test.go b/cmd/opentelemetry/app/exporter/memoryexporter/factory_test.go index 32d8fa18ff4..2d4f28ee02e 100644 --- a/cmd/opentelemetry/app/exporter/memoryexporter/factory_test.go +++ b/cmd/opentelemetry/app/exporter/memoryexporter/factory_test.go @@ -39,7 +39,7 @@ func TestCreateTraceExporter(t *testing.T) { v, _ := jConfig.Viperize(AddFlags) factory := NewFactory(v) - exporter, err := factory.CreateTraceExporter(context.Background(), component.ExporterCreateParams{Logger: zap.NewNop()}, factory.CreateDefaultConfig()) + exporter, err := factory.CreateTracesExporter(context.Background(), component.ExporterCreateParams{Logger: zap.NewNop()}, factory.CreateDefaultConfig()) require.NoError(t, err) require.NotNil(t, exporter) } @@ -48,7 +48,7 @@ func TestCreateTraceExporter_nilConfig(t *testing.T) { defer cleanup() factory := &Factory{} - exporter, err := factory.CreateTraceExporter(context.Background(), component.ExporterCreateParams{}, nil) + exporter, err := factory.CreateTracesExporter(context.Background(), component.ExporterCreateParams{}, nil) require.Nil(t, exporter) assert.Contains(t, err.Error(), "could not cast configuration to jaeger_memory") } @@ -84,11 +84,11 @@ func TestSingleton(t *testing.T) { f := NewFactory(viper.New()) logger := zap.NewNop() assert.Nil(t, instance) - exp, err := f.CreateTraceExporter(context.Background(), component.ExporterCreateParams{Logger: logger}, &Config{}) + exp, err := f.CreateTracesExporter(context.Background(), component.ExporterCreateParams{Logger: logger}, &Config{}) require.NoError(t, err) require.NotNil(t, exp) previousInstance := instance - exp, err = f.CreateTraceExporter(context.Background(), component.ExporterCreateParams{Logger: logger}, &Config{}) + exp, err = f.CreateTracesExporter(context.Background(), component.ExporterCreateParams{Logger: logger}, &Config{}) require.NoError(t, err) require.NotNil(t, exp) assert.Equal(t, previousInstance, instance) diff --git a/cmd/opentelemetry/app/exporter/span_writer_exporter.go b/cmd/opentelemetry/app/exporter/span_writer_exporter.go index ab0c885d776..e5616b4a575 100644 --- a/cmd/opentelemetry/app/exporter/span_writer_exporter.go +++ b/cmd/opentelemetry/app/exporter/span_writer_exporter.go @@ -33,7 +33,7 @@ import ( ) // NewSpanWriterExporter returns component.TraceExporter -func NewSpanWriterExporter(config configmodels.Exporter, factory storage.Factory, opts ...exporterhelper.ExporterOption) (component.TraceExporter, error) { +func NewSpanWriterExporter(config configmodels.Exporter, params component.ExporterCreateParams, factory storage.Factory, opts ...exporterhelper.ExporterOption) (component.TracesExporter, error) { spanWriter, err := factory.CreateSpanWriter() if err != nil { return nil, err @@ -41,6 +41,7 @@ func NewSpanWriterExporter(config configmodels.Exporter, factory storage.Factory storage := store{Writer: spanWriter, storageNameTag: tag.Insert(storagemetrics.TagExporterName(), config.Name())} return exporterhelper.NewTraceExporter( config, + params.Logger, storage.traceDataPusher, opts...) } diff --git a/cmd/opentelemetry/app/exporter/span_writer_exporter_test.go b/cmd/opentelemetry/app/exporter/span_writer_exporter_test.go index f02e5226353..e086ae72062 100644 --- a/cmd/opentelemetry/app/exporter/span_writer_exporter_test.go +++ b/cmd/opentelemetry/app/exporter/span_writer_exporter_test.go @@ -24,6 +24,7 @@ import ( "github.com/uber/jaeger-lib/metrics" "go.opencensus.io/stats/view" "go.opencensus.io/tag" + "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/config/configmodels" "go.opentelemetry.io/collector/consumer/pdata" "go.uber.org/zap" @@ -35,21 +36,21 @@ import ( ) func TestNew_closableWriter(t *testing.T) { - exporter, err := NewSpanWriterExporter(&configmodels.ExporterSettings{}, mockStorageFactory{spanWriter: spanWriter{}}) + exporter, err := NewSpanWriterExporter(&configmodels.ExporterSettings{}, component.ExporterCreateParams{Logger: zap.NewNop()}, mockStorageFactory{spanWriter: spanWriter{}}) require.NoError(t, err) assert.NotNil(t, exporter) assert.Nil(t, exporter.Shutdown(context.Background())) } func TestNew_noClosableWriter(t *testing.T) { - exporter, err := NewSpanWriterExporter(&configmodels.ExporterSettings{}, mockStorageFactory{spanWriter: noClosableWriter{}}) + exporter, err := NewSpanWriterExporter(&configmodels.ExporterSettings{}, component.ExporterCreateParams{Logger: zap.NewNop()}, mockStorageFactory{spanWriter: noClosableWriter{}}) require.NoError(t, err) assert.NotNil(t, exporter) assert.Nil(t, exporter.Shutdown(context.Background())) } func TestNew_failedToCreateWriter(t *testing.T) { - exporter, err := NewSpanWriterExporter(&configmodels.ExporterSettings{}, mockStorageFactory{err: errors.New("failed to create writer"), spanWriter: spanWriter{}}) + exporter, err := NewSpanWriterExporter(&configmodels.ExporterSettings{}, component.ExporterCreateParams{Logger: zap.NewNop()}, mockStorageFactory{err: errors.New("failed to create writer"), spanWriter: spanWriter{}}) require.Nil(t, exporter) assert.Error(t, err, "failed to create writer") } @@ -74,8 +75,8 @@ func AddSpan(traces pdata.Traces, name string, traceID pdata.TraceID, spanID pda } func TestStore(t *testing.T) { - traceID := pdata.NewTraceID([]byte("0123456789abcdef")) - spanID := pdata.NewSpanID([]byte("01234567")) + traceID := pdata.NewTraceID(Byte16ArrayFromString("0123456789abcdef")) + spanID := pdata.NewSpanID(Byte8ArrayFromString("01234567")) tests := []struct { storage store data pdata.Traces @@ -94,8 +95,8 @@ func TestStore(t *testing.T) { { caption: "wrong data", storage: store{Writer: spanWriter{}, storageNameTag: tag.Insert(storagemetrics.TagExporterName(), "memory")}, - data: AddSpan(traces(), "", pdata.NewTraceID(nil), pdata.NewSpanID(nil)), - err: "TraceID is nil", + data: AddSpan(traces(), "", pdata.NewTraceID([16]byte{}), pdata.NewSpanID([8]byte{})), + err: "Permanent error: OC span has an all zeros trace ID", dropped: 1, }, { @@ -187,3 +188,13 @@ func (mockStorageFactory) CreateDependencyReader() (dependencystore.Reader, erro func (mockStorageFactory) Initialize(metrics.Factory, *zap.Logger) error { return nil } + +func Byte16ArrayFromString(s string) (result [16]byte) { + copy(result[:], s) + return +} + +func Byte8ArrayFromString(s string) (result [8]byte) { + copy(result[:], s) + return +} diff --git a/cmd/opentelemetry/app/internal/reader/es/esspanreader/query.go b/cmd/opentelemetry/app/internal/reader/es/esspanreader/query.go index f015320beb9..3793101c93e 100644 --- a/cmd/opentelemetry/app/internal/reader/es/esspanreader/query.go +++ b/cmd/opentelemetry/app/internal/reader/es/esspanreader/query.go @@ -97,7 +97,7 @@ func addOperationNameQuery(operationName string, query esclient.Query) { } func addTagQuery(converter dbmodel.ToDomain, tags map[string]string, query esclient.Query) { - if tags == nil || len(tags) == 0 { + if len(tags) == 0 { return } diff --git a/cmd/opentelemetry/app/processor/resourceprocessor/resource_processor.go b/cmd/opentelemetry/app/processor/resourceprocessor/resource_processor.go index 38995b39b37..d613f4c551b 100644 --- a/cmd/opentelemetry/app/processor/resourceprocessor/resource_processor.go +++ b/cmd/opentelemetry/app/processor/resourceprocessor/resource_processor.go @@ -69,12 +69,12 @@ func (f Factory) GetTags() map[string]string { // CreateTraceProcessor creates resource processor. // This function implements OTEL component.ProcessorFactoryOld interface. -func (f Factory) CreateTraceProcessor( +func (f Factory) CreateTracesProcessor( ctx context.Context, params component.ProcessorCreateParams, cfg configmodels.Processor, - nextConsumer consumer.TraceConsumer, -) (component.TraceProcessor, error) { + nextConsumer consumer.TracesConsumer, +) (component.TracesProcessor, error) { c := cfg.(*resourceprocessor.Config) attributeKeys := map[string]bool{} for _, kv := range c.AttributesActions { @@ -91,7 +91,7 @@ func (f Factory) CreateTraceProcessor( }) } } - return f.Wrapped.CreateTraceProcessor(ctx, params, cfg, nextConsumer) + return f.Wrapped.CreateTracesProcessor(ctx, params, cfg, nextConsumer) } // CreateMetricsProcessor creates a resource processor. diff --git a/cmd/opentelemetry/app/processor/resourceprocessor/resource_processor_test.go b/cmd/opentelemetry/app/processor/resourceprocessor/resource_processor_test.go index 21eca222ae3..31496ac880b 100644 --- a/cmd/opentelemetry/app/processor/resourceprocessor/resource_processor_test.go +++ b/cmd/opentelemetry/app/processor/resourceprocessor/resource_processor_test.go @@ -56,7 +56,7 @@ func TestDefaultValueFromViper(t *testing.T) { } cfg := f.CreateDefaultConfig().(*resourceprocessor.Config) - p, err := f.CreateTraceProcessor(context.Background(), component.ProcessorCreateParams{Logger: zap.NewNop()}, cfg, &componenttest.ExampleExporterConsumer{}) + p, err := f.CreateTracesProcessor(context.Background(), component.ProcessorCreateParams{Logger: zap.NewNop()}, cfg, &componenttest.ExampleExporterConsumer{}) require.NoError(t, err) assert.NotNil(t, p) @@ -81,7 +81,7 @@ func TestLegacyJaegerTagsOnly(t *testing.T) { } cfg := f.CreateDefaultConfig().(*resourceprocessor.Config) - p, err := f.CreateTraceProcessor(context.Background(), component.ProcessorCreateParams{Logger: zap.NewNop()}, cfg, &componenttest.ExampleExporterConsumer{}) + p, err := f.CreateTracesProcessor(context.Background(), component.ProcessorCreateParams{Logger: zap.NewNop()}, cfg, &componenttest.ExampleExporterConsumer{}) require.NoError(t, err) assert.NotNil(t, p) @@ -116,7 +116,7 @@ func TestLoadConfigAndFlags(t *testing.T) { require.NotNil(t, colConfig) cfg := colConfig.Processors[string(f.Type())].(*resourceprocessor.Config) - p, err := f.CreateTraceProcessor(context.Background(), component.ProcessorCreateParams{Logger: zap.NewNop()}, cfg, &componenttest.ExampleExporterConsumer{}) + p, err := f.CreateTracesProcessor(context.Background(), component.ProcessorCreateParams{Logger: zap.NewNop()}, cfg, &componenttest.ExampleExporterConsumer{}) require.NoError(t, err) assert.NotNil(t, p) assert.Equal(t, []processorhelper.ActionKeyValue{ diff --git a/cmd/opentelemetry/app/receiver/jaegerreceiver/jaeger_receiver.go b/cmd/opentelemetry/app/receiver/jaegerreceiver/jaeger_receiver.go index ee3cbafe079..a6d045d14f1 100644 --- a/cmd/opentelemetry/app/receiver/jaegerreceiver/jaeger_receiver.go +++ b/cmd/opentelemetry/app/receiver/jaegerreceiver/jaeger_receiver.go @@ -149,13 +149,13 @@ func createDefaultSamplingConfig(v *viper.Viper) *jaegerreceiver.RemoteSamplingC // CreateTraceReceiver creates Jaeger receiver trace receiver. // This function implements OTEL component.ReceiverFactory interface. -func (f *Factory) CreateTraceReceiver( +func (f *Factory) CreateTracesReceiver( ctx context.Context, params component.ReceiverCreateParams, cfg configmodels.Receiver, - nextConsumer consumer.TraceConsumer, -) (component.TraceReceiver, error) { - return f.Wrapped.CreateTraceReceiver(ctx, params, cfg, nextConsumer) + nextConsumer consumer.TracesConsumer, +) (component.TracesReceiver, error) { + return f.Wrapped.CreateTracesReceiver(ctx, params, cfg, nextConsumer) } // CreateMetricsReceiver creates a metrics receiver based on provided config. diff --git a/cmd/opentelemetry/app/receiver/kafkareceiver/kafka_receiver.go b/cmd/opentelemetry/app/receiver/kafkareceiver/kafka_receiver.go index ad68851c6c1..a3d5a327735 100644 --- a/cmd/opentelemetry/app/receiver/kafkareceiver/kafka_receiver.go +++ b/cmd/opentelemetry/app/receiver/kafkareceiver/kafka_receiver.go @@ -106,13 +106,13 @@ func (f *Factory) CreateDefaultConfig() configmodels.Receiver { // CreateTraceReceiver creates Jaeger receiver trace receiver. // This function implements OTEL component.ReceiverFactory interface. -func (f *Factory) CreateTraceReceiver( +func (f *Factory) CreateTracesReceiver( ctx context.Context, params component.ReceiverCreateParams, cfg configmodels.Receiver, - nextConsumer consumer.TraceConsumer, -) (component.TraceReceiver, error) { - return f.Wrapped.CreateTraceReceiver(ctx, params, cfg, nextConsumer) + nextConsumer consumer.TracesConsumer, +) (component.TracesReceiver, error) { + return f.Wrapped.CreateTracesReceiver(ctx, params, cfg, nextConsumer) } // CreateMetricsReceiver creates a metrics receiver based on provided config. diff --git a/cmd/opentelemetry/app/receiver/zipkinreceiver/zipkin_receiver.go b/cmd/opentelemetry/app/receiver/zipkinreceiver/zipkin_receiver.go index 2dc852f6fe2..cabbe49dc74 100644 --- a/cmd/opentelemetry/app/receiver/zipkinreceiver/zipkin_receiver.go +++ b/cmd/opentelemetry/app/receiver/zipkinreceiver/zipkin_receiver.go @@ -57,13 +57,13 @@ func (f Factory) CreateDefaultConfig() configmodels.Receiver { // CreateTraceReceiver creates Zipkin receiver trace receiver. // This function implements OTEL component.ReceiverFactoryOld interface. -func (f Factory) CreateTraceReceiver( +func (f Factory) CreateTracesReceiver( ctx context.Context, params component.ReceiverCreateParams, cfg configmodels.Receiver, - nextConsumer consumer.TraceConsumer, -) (component.TraceReceiver, error) { - return f.Wrapped.CreateTraceReceiver(ctx, params, cfg, nextConsumer) + nextConsumer consumer.TracesConsumer, +) (component.TracesReceiver, error) { + return f.Wrapped.CreateTracesReceiver(ctx, params, cfg, nextConsumer) } // CreateMetricsReceiver creates a metrics receiver based on provided config. diff --git a/cmd/opentelemetry/go.mod b/cmd/opentelemetry/go.mod index 3fbf590c715..3208ecba1bc 100644 --- a/cmd/opentelemetry/go.mod +++ b/cmd/opentelemetry/go.mod @@ -17,6 +17,6 @@ require ( github.com/uber/jaeger-client-go v2.25.0+incompatible github.com/uber/jaeger-lib v2.4.0+incompatible go.opencensus.io v0.22.4 - go.opentelemetry.io/collector v0.12.0 + go.opentelemetry.io/collector v0.14.0 go.uber.org/zap v1.16.0 ) diff --git a/cmd/opentelemetry/go.sum b/cmd/opentelemetry/go.sum index a127a1d938e..5aa864706ab 100644 --- a/cmd/opentelemetry/go.sum +++ b/cmd/opentelemetry/go.sum @@ -122,6 +122,8 @@ github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo github.com/andybalholm/brotli v1.0.0/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y= github.com/antihax/optional v0.0.0-20180407024304-ca021399b1a6/go.mod h1:V8iCPQYkqmusNa815XgQio277wI47sdRh1dUOLdyC6Q= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/antonmedv/expr v1.8.9 h1:O9stiHmHHww9b4ozhPx7T6BK7fXfOCHJ8ybxf0833zw= +github.com/antonmedv/expr v1.8.9/go.mod h1:5qsM3oLGDND7sDmQGDXHkYfkjYMUX14qsgqmHhwGEk8= github.com/apache/arrow/go/arrow v0.0.0-20191024131854-af6fa24be0db/go.mod h1:VTxUBvSJ3s3eHAg65PNgrsn5BtqCRPdmyXh6rAfdxN0= github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/apache/thrift v0.13.0 h1:5hryIiq9gtn+MiLVn0wP37kb/uTeRZgN08WoCsAhIhI= @@ -189,6 +191,7 @@ github.com/containerd/containerd v1.3.4/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMX github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= github.com/coreos/go-oidc v2.2.1+incompatible h1:mh48q/BqXqgjVHpy2ZY7WnWAbenxRjsz9N1i1YxjHAk= github.com/coreos/go-oidc v2.2.1+incompatible/go.mod h1:CgnwVTmzoESiwO9qyAFEMiHoZ1nMCKZlZ9V6mm3/LKc= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= @@ -206,6 +209,7 @@ github.com/crossdock/crossdock-go v0.0.0-20160816171116-049aabb0122b/go.mod h1:v github.com/daixiang0/gci v0.2.4 h1:BUCKk5nlK2m+kRIsoj+wb/5hazHvHeZieBKWd9Afa8Q= github.com/daixiang0/gci v0.2.4/go.mod h1:+AV8KmHTGxxwp/pY84TLQfFKp2vuKXXJVzF3kD/hfR4= github.com/dave/jennifer v1.2.0/go.mod h1:fIb+770HOpJ2fmN9EPPKOqm1vMGhB+TwXKMZhrIygKg= +github.com/davecgh/go-spew v0.0.0-20161028175848-04cdfd42973b/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 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= @@ -213,6 +217,8 @@ github.com/denis-tingajkin/go-header v0.3.1 h1:ymEpSiFjeItCy1FOP+x0M2KdCELdEAHUs github.com/denis-tingajkin/go-header v0.3.1/go.mod h1:sq/2IxMhaZX+RRcgHfCRx/m0M5na0fBt4/CRe7Lrji0= github.com/dgraph-io/badger v1.5.3 h1:5oWIuRvwn93cie+OSt1zSnkaIQ1JFQM8bGlIv6O6Sts= github.com/dgraph-io/badger v1.5.3/go.mod h1:VZxzAIRPHRVNRKRo6AXrX9BJegn6il06VMTZVJYCIjQ= +github.com/dgraph-io/badger v1.6.2 h1:mNw0qs90GVgGGWylh0umH5iag1j6n/PeJtNvL6KY/x8= +github.com/dgraph-io/badger v1.6.2/go.mod h1:JW2yswe3V058sS0kZ2h/AXeDSqFjxnZcRrVH//y2UQE= github.com/dgraph-io/ristretto v0.0.1/go.mod h1:T40EBc7CJke8TkpiYfGGKAeFjSaxuFXhuXRyumBd6RE= github.com/dgraph-io/ristretto v0.0.2 h1:a5WaUrDa0qm0YrAAS1tUykT5El3kt62KNZZeMxQn3po= github.com/dgraph-io/ristretto v0.0.2/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= @@ -238,6 +244,8 @@ github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDD github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM= github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= +github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= github.com/eapache/go-resiliency v1.2.0 h1:v7g92e/KSN71Rq7vSThKaWIq68fL4YHvWyiUKorFR1Q= github.com/eapache/go-resiliency v1.2.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= @@ -276,6 +284,8 @@ github.com/frankban/quicktest v1.10.0/go.mod h1:ui7WezCLWMWxVWr1GETZY3smRy0G4KWq github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/gdamore/encoding v1.0.0/go.mod h1:alR0ol34c49FCSBLjhosxzcPHQbf2trDkoo5dl+VrEg= +github.com/gdamore/tcell v1.3.0/go.mod h1:Hjvr+Ofd+gLglo7RYKxxnzCBmev3BzsS67MebKS4zMM= github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/globalsign/mgo v0.0.0-20180905125535-1ca0a4f7cbcb/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q= @@ -579,6 +589,8 @@ github.com/grpc-ecosystem/grpc-gateway v1.14.5/go.mod h1:UJ0EZAp832vCd54Wev9N1BM github.com/grpc-ecosystem/grpc-gateway v1.14.6/go.mod h1:zdiPV4Yse/1gnckTHtghG4GkDEdKCRJduHpTxT3/jcw= github.com/grpc-ecosystem/grpc-gateway v1.15.0 h1:ntPNC9TD/6l2XDenJZe6T5lSMg95thpV9sGAqHX4WU8= github.com/grpc-ecosystem/grpc-gateway v1.15.0/go.mod h1:vO11I9oWA+KsxmfFQPhLnnIb1VDE24M+pdxZFiuZcA8= +github.com/grpc-ecosystem/grpc-gateway v1.15.2 h1:HC+hWRWf+v5zTMPyoaYTKIJih+4sd4XRWmj0qlG87Co= +github.com/grpc-ecosystem/grpc-gateway v1.15.2/go.mod h1:vO11I9oWA+KsxmfFQPhLnnIb1VDE24M+pdxZFiuZcA8= github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645/go.mod h1:6iZfnjpejD4L/4DwD7NryNaJyCQdzwWwH2MWhCA90Kw= github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed h1:5upAirOpQc1Q53c0bnx2ufif5kANL7bfZWcc6VJWJd8= github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed/go.mod h1:tMWxXQ9wFIaZeTI9F+hmhFiGpFmhOHzyShyFUhRm0H4= @@ -737,6 +749,8 @@ github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= github.com/logrusorgru/aurora v0.0.0-20181002194514-a7b3b318ed4e/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= +github.com/lucasb-eyer/go-colorful v1.0.2/go.mod h1:0MS4r+7BZKSJ5mw4/S5MPN+qHFF1fYclkSPilDOKW0s= +github.com/lucasb-eyer/go-colorful v1.0.3/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= @@ -771,6 +785,8 @@ github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHX github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/mattn/go-runewidth v0.0.8/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/mattn/go-sqlite3 v1.11.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/mattn/go-tty v0.0.0-20180907095812-13ff1204f104/go.mod h1:XPvLUNfbS4fJH25nqRHfWLMa1ONC8Amw+mIA639KxkE= @@ -924,6 +940,7 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= github.com/pkg/term v0.0.0-20180730021639-bffc007b7fd5/go.mod h1:eCbImbZ95eXtAUIbLAuAVnBnwf83mjf6QIVH8SHYwqQ= +github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 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/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= @@ -990,6 +1007,8 @@ github.com/rcrowley/go-metrics v0.0.0-20190826022208-cac0b30c2563/go.mod h1:bCqn github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 h1:MkV+77GLUNo5oJ0jf870itWm3D0Sjh7+Za9gazKc5LQ= github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/retailnext/hllpp v1.0.1-0.20180308014038-101a6d2f8b52/go.mod h1:RDpi1RftBQPUCDRw6SmxeaREsAaRKnOclghuzp/WRzc= +github.com/rivo/tview v0.0.0-20200219210816-cd38d7432498/go.mod h1:6lkG1x+13OShEf0EaOCaTQYyB7d5nSbb181KtjlS+84= +github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= @@ -1010,6 +1029,7 @@ github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da h1:p3Vo3i64TCL github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= github.com/samuel/go-zookeeper v0.0.0-20200724154423-2164a8ac840e h1:CGjiMQ0wMH4wtNWrlj6kiTbkPt2F3rbYnhGX6TWLfco= github.com/samuel/go-zookeeper v0.0.0-20200724154423-2164a8ac840e/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= +github.com/sanity-io/litter v1.2.0/go.mod h1:JF6pZUFgu2Q0sBZ+HSV35P8TVPI1TTzEwyu9FXAw2W4= github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= github.com/satori/go.uuid v1.2.1-0.20181028125025-b2ce2384e17b/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= github.com/sclevine/agouti v3.0.0+incompatible/go.mod h1:b4WX9W9L1sfQKXeJf1mUTLZKJ48R1S7H23Ji7oFO5Bw= @@ -1063,6 +1083,7 @@ github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkU github.com/spf13/cast v1.3.1 h1:nFm6S0SMdyzrzcmThSipiEubIDy8WEXKNZ0UOgiRpng= github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= +github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= github.com/spf13/cobra v1.0.0 h1:6m/oheQuQ13N9ks4hubMG6BnvwOeaJrqSPLahSnczz8= github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= @@ -1073,6 +1094,7 @@ github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnIn github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= github.com/spf13/viper v1.6.2/go.mod h1:t3iDnF5Jlj76alVNuyFBk5oUMCvsrkbvZK0WQdfDi5k= github.com/spf13/viper v1.7.1 h1:pM5oEahlgWv/WnHXpgbKz7iLIxRf65tye2Ci+XFK5sk= @@ -1086,6 +1108,7 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= +github.com/stretchr/testify v0.0.0-20161117074351-18a02ba4a312/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.0/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= @@ -1127,6 +1150,7 @@ github.com/uber/jaeger-lib v2.2.0+incompatible/go.mod h1:ComeNDZlWwrWnDv8aPp0Ba6 github.com/uber/jaeger-lib v2.4.0+incompatible h1:fY7QsGQWiCt8pajv4r7JEvmATdCVaWxXbjwyYwsNaLQ= github.com/uber/jaeger-lib v2.4.0+incompatible/go.mod h1:ComeNDZlWwrWnDv8aPp0Ba6+uUTzImX/AauajbLI56U= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= +github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/ultraware/funlen v0.0.3 h1:5ylVWm8wsNwH5aWo9438pwvsK0QiqVuUrt9bn7S/iLA= github.com/ultraware/funlen v0.0.3/go.mod h1:Dp4UiAus7Wdb9KUZsYWZEWiRzGuM2kXM1lPbfaF6xhA= github.com/ultraware/whitespace v0.0.4 h1:If7Va4cM03mpgrNH9k49/VOicWpGoG70XPBFFODYDsg= @@ -1172,6 +1196,8 @@ go.opencensus.io v0.22.4 h1:LYy1Hy3MJdrCdMwwzxA/dRok4ejH+RwNGbuoD9fCjto= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opentelemetry.io/collector v0.12.0 h1:SQFxSQBqD8P0ki29xrH+LaB1gBpLxAWcnmUL9/yaDKE= go.opentelemetry.io/collector v0.12.0/go.mod h1:mKQha2MeRhJi0rHS8yvZlzFk28ZVBCf6qMTsjGX0n1Y= +go.opentelemetry.io/collector v0.14.0 h1:ZAMJPY89SizyvRGBnKLKOIOMm26eKhJtmfnc+GthryU= +go.opentelemetry.io/collector v0.14.0/go.mod h1:itblxiZ5r454TNNQVvcAp7vj7LbwCdeNRtodo2t+lGM= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= @@ -1195,6 +1221,7 @@ go.uber.org/zap v1.16.0 h1:uFRZXykJGK9lLY4HtgSw44DnIcAM+kRBP7x5m+NpAOM= go.uber.org/zap v1.16.0/go.mod h1:MA8QOfq0BHJwdXa996Y4dYkAqRKB8/1K1QMMZVaNZjQ= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190320223903-b7391e95e576/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= @@ -1318,6 +1345,7 @@ golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190129075346-302c3dd5f1cc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190209173611-3b5209105503/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1335,6 +1363,8 @@ golang.org/x/sys v0.0.0-20190531175056-4c3a928424d2/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190626150813-e07cf5db2756/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= From fc8f5d3741f6c1191a4e699a53e65d932c831f09 Mon Sep 17 00:00:00 2001 From: Pavel Kositsyn Date: Fri, 6 Nov 2020 23:08:58 +0300 Subject: [PATCH 2/5] initialize traceid and spanid explicitly Signed-off-by: Pavel Kositsyn --- .../esmodeltranslator/modeltranslator_test.go | 15 +++------------ .../app/exporter/span_writer_exporter_test.go | 15 +++------------ 2 files changed, 6 insertions(+), 24 deletions(-) diff --git a/cmd/opentelemetry/app/exporter/elasticsearchexporter/esmodeltranslator/modeltranslator_test.go b/cmd/opentelemetry/app/exporter/elasticsearchexporter/esmodeltranslator/modeltranslator_test.go index 585a3f735fa..ee7885a0353 100644 --- a/cmd/opentelemetry/app/exporter/elasticsearchexporter/esmodeltranslator/modeltranslator_test.go +++ b/cmd/opentelemetry/app/exporter/elasticsearchexporter/esmodeltranslator/modeltranslator_test.go @@ -29,8 +29,9 @@ import ( ) var ( - traceID = pdata.NewTraceID(Byte16ArrayFromString("0123456789abcdef")) - spanID = pdata.NewSpanID(Byte8ArrayFromString("01234567")) + traceID = pdata.NewTraceID([16]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F}) + spanID = pdata.NewSpanID([8]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}) ) func TestAttributeToKeyValue(t *testing.T) { @@ -274,13 +275,3 @@ func addSpan(traces pdata.Traces, name string, traceID pdata.TraceID, spanID pda span.SetEndTime(pdata.TimestampUnixNano(time.Now().UnixNano())) return span } - -func Byte16ArrayFromString(s string) (result [16]byte) { - copy(result[:], s) - return -} - -func Byte8ArrayFromString(s string) (result [8]byte) { - copy(result[:], s) - return -} diff --git a/cmd/opentelemetry/app/exporter/span_writer_exporter_test.go b/cmd/opentelemetry/app/exporter/span_writer_exporter_test.go index e086ae72062..c863c1c2112 100644 --- a/cmd/opentelemetry/app/exporter/span_writer_exporter_test.go +++ b/cmd/opentelemetry/app/exporter/span_writer_exporter_test.go @@ -75,8 +75,9 @@ func AddSpan(traces pdata.Traces, name string, traceID pdata.TraceID, spanID pda } func TestStore(t *testing.T) { - traceID := pdata.NewTraceID(Byte16ArrayFromString("0123456789abcdef")) - spanID := pdata.NewSpanID(Byte8ArrayFromString("01234567")) + traceID := pdata.NewTraceID([16]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F}) + spanID := pdata.NewSpanID([8]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}) tests := []struct { storage store data pdata.Traces @@ -188,13 +189,3 @@ func (mockStorageFactory) CreateDependencyReader() (dependencystore.Reader, erro func (mockStorageFactory) Initialize(metrics.Factory, *zap.Logger) error { return nil } - -func Byte16ArrayFromString(s string) (result [16]byte) { - copy(result[:], s) - return -} - -func Byte8ArrayFromString(s string) (result [8]byte) { - copy(result[:], s) - return -} From f6a0e29b13ec5360e693b73e284781d64c4e52e8 Mon Sep 17 00:00:00 2001 From: Pavel Kositsyn Date: Mon, 9 Nov 2020 14:05:45 +0300 Subject: [PATCH 3/5] fix comments and empty parent span check Signed-off-by: Pavel Kositsyn --- .../app/exporter/badgerexporter/factory.go | 2 +- .../app/exporter/cassandraexporter/factory.go | 2 +- .../esmodeltranslator/modeltranslator.go | 2 +- .../esmodeltranslator/modeltranslator_test.go | 25 +++++++------------ .../exporter/elasticsearchexporter/factory.go | 2 +- .../exporter/grpcpluginexporter/factory.go | 2 +- .../jaegerexporter/jaeger_exporter.go | 2 +- .../exporter/kafkaexporter/kafka_exporter.go | 2 +- .../app/exporter/memoryexporter/factory.go | 2 +- .../resourceprocessor/resource_processor.go | 2 +- .../jaegerreceiver/jaeger_receiver.go | 2 +- .../receiver/kafkareceiver/kafka_receiver.go | 2 +- .../zipkinreceiver/zipkin_receiver.go | 2 +- 13 files changed, 21 insertions(+), 28 deletions(-) diff --git a/cmd/opentelemetry/app/exporter/badgerexporter/factory.go b/cmd/opentelemetry/app/exporter/badgerexporter/factory.go index 0bd125cd174..dcd1cc1ec26 100644 --- a/cmd/opentelemetry/app/exporter/badgerexporter/factory.go +++ b/cmd/opentelemetry/app/exporter/badgerexporter/factory.go @@ -89,7 +89,7 @@ func (f Factory) CreateDefaultConfig() configmodels.Exporter { } } -// CreateTraceExporter creates Jaeger Cassandra trace exporter. +// CreateTracesExporter creates Jaeger Cassandra trace exporter. // This function implements OTEL component.ExporterFactory interface. func (f Factory) CreateTracesExporter( _ context.Context, diff --git a/cmd/opentelemetry/app/exporter/cassandraexporter/factory.go b/cmd/opentelemetry/app/exporter/cassandraexporter/factory.go index 72f0ab6bd62..9209bcb9cb0 100644 --- a/cmd/opentelemetry/app/exporter/cassandraexporter/factory.go +++ b/cmd/opentelemetry/app/exporter/cassandraexporter/factory.go @@ -71,7 +71,7 @@ func (f Factory) CreateDefaultConfig() configmodels.Exporter { } } -// CreateTraceExporter creates Jaeger Cassandra trace exporter. +// CreateTracesExporter creates Jaeger Cassandra trace exporter. // This function implements OTEL component.ExporterFactory interface. func (f Factory) CreateTracesExporter( _ context.Context, diff --git a/cmd/opentelemetry/app/exporter/elasticsearchexporter/esmodeltranslator/modeltranslator.go b/cmd/opentelemetry/app/exporter/elasticsearchexporter/esmodeltranslator/modeltranslator.go index 0c6335795ad..9c99b7137ea 100644 --- a/cmd/opentelemetry/app/exporter/elasticsearchexporter/esmodeltranslator/modeltranslator.go +++ b/cmd/opentelemetry/app/exporter/elasticsearchexporter/esmodeltranslator/modeltranslator.go @@ -167,7 +167,7 @@ func toTime(nano pdata.TimestampUnixNano) time.Time { } func references(links pdata.SpanLinkSlice, parentSpanID pdata.SpanID, traceID dbmodel.TraceID) ([]dbmodel.Reference, error) { - parentSpanIDSet := len(parentSpanID.Bytes()) != 0 + parentSpanIDSet := parentSpanID.IsValid() if !parentSpanIDSet && links.Len() == 0 { return emptyReferenceList, nil } diff --git a/cmd/opentelemetry/app/exporter/elasticsearchexporter/esmodeltranslator/modeltranslator_test.go b/cmd/opentelemetry/app/exporter/elasticsearchexporter/esmodeltranslator/modeltranslator_test.go index ee7885a0353..d173d787dd6 100644 --- a/cmd/opentelemetry/app/exporter/elasticsearchexporter/esmodeltranslator/modeltranslator_test.go +++ b/cmd/opentelemetry/app/exporter/elasticsearchexporter/esmodeltranslator/modeltranslator_test.go @@ -143,8 +143,8 @@ func TestConvertSpan(t *testing.T) { Resource: resource, InstrumentationLibrary: traces.ResourceSpans().At(0).InstrumentationLibrarySpans().At(0).InstrumentationLibrary(), DBSpan: &dbmodel.Span{ - TraceID: "30313233343536373839616263646566", - SpanID: "3031323334353637", + TraceID: "000102030405060708090a0b0c0d0e0f", + SpanID: "0001020304050607", StartTime: 1000, Duration: 1000, OperationName: "root", @@ -163,8 +163,8 @@ func TestConvertSpan(t *testing.T) { {Key: "event", Value: "eventName", Type: dbmodel.StringType}, {Key: "foo", Value: "bar", Type: dbmodel.StringType}}, Timestamp: 500}}, References: []dbmodel.Reference{ - {SpanID: "3031323334353637", TraceID: "30313233343536373839616263646566", RefType: dbmodel.ChildOf}, - {SpanID: "3031323334353637", TraceID: "30313233343536373839616263646566", RefType: dbmodel.FollowsFrom}}, + {SpanID: "0001020304050607", TraceID: "000102030405060708090a0b0c0d0e0f", RefType: dbmodel.ChildOf}, + {SpanID: "0001020304050607", TraceID: "000102030405060708090a0b0c0d0e0f", RefType: dbmodel.FollowsFrom}}, Process: dbmodel.Process{ ServiceName: "myservice", Tags: []dbmodel.KeyValue{{Key: "num", Value: "16.66", Type: dbmodel.Float64Type}}, @@ -190,21 +190,15 @@ func TestSpanEmptyRef(t *testing.T) { Resource: traces.ResourceSpans().At(0).Resource(), InstrumentationLibrary: traces.ResourceSpans().At(0).InstrumentationLibrarySpans().At(0).InstrumentationLibrary(), DBSpan: &dbmodel.Span{ - TraceID: "30313233343536373839616263646566", - SpanID: "3031323334353637", + TraceID: "000102030405060708090a0b0c0d0e0f", + SpanID: "0001020304050607", StartTime: 1000, Duration: 1000, OperationName: "root", StartTimeMillis: 1, - Tags: []dbmodel.KeyValue{}, // should not be nil - Logs: []dbmodel.Log{}, // should not be nil - References: []dbmodel.Reference{ - { - RefType: "CHILD_OF", - TraceID: "30313233343536373839616263646566", - SpanID: "3031323334353637", - }, - }, + Tags: []dbmodel.KeyValue{}, // should not be nil + Logs: []dbmodel.Log{}, // should not be nil + References: []dbmodel.Reference{}, // should not be nil Process: dbmodel.Process{ ServiceName: "myservice", Tags: nil, @@ -270,7 +264,6 @@ func addSpan(traces pdata.Traces, name string, traceID pdata.TraceID, spanID pda span.SetName(name) span.SetTraceID(traceID) span.SetSpanID(spanID) - span.SetParentSpanID(spanID) span.SetStartTime(pdata.TimestampUnixNano(time.Now().UnixNano())) span.SetEndTime(pdata.TimestampUnixNano(time.Now().UnixNano())) return span diff --git a/cmd/opentelemetry/app/exporter/elasticsearchexporter/factory.go b/cmd/opentelemetry/app/exporter/elasticsearchexporter/factory.go index f5e0cee2970..c254e45eddc 100644 --- a/cmd/opentelemetry/app/exporter/elasticsearchexporter/factory.go +++ b/cmd/opentelemetry/app/exporter/elasticsearchexporter/factory.go @@ -72,7 +72,7 @@ func (f Factory) CreateDefaultConfig() configmodels.Exporter { } } -// CreateTraceExporter creates Jaeger Elasticsearch trace exporter. +// CreateTracesExporter creates Jaeger Elasticsearch trace exporter. // This function implements OTEL component.ExporterFactory interface. func (Factory) CreateTracesExporter( ctx context.Context, diff --git a/cmd/opentelemetry/app/exporter/grpcpluginexporter/factory.go b/cmd/opentelemetry/app/exporter/grpcpluginexporter/factory.go index d935ddb2133..741c90878eb 100644 --- a/cmd/opentelemetry/app/exporter/grpcpluginexporter/factory.go +++ b/cmd/opentelemetry/app/exporter/grpcpluginexporter/factory.go @@ -65,7 +65,7 @@ func (f Factory) CreateDefaultConfig() configmodels.Exporter { } } -// CreateTraceExporter creates Jaeger gRPC trace exporter. +// CreateTracesExporter creates Jaeger gRPC trace exporter. // This function implements OTEL component.ExporterFactory interface. func (f Factory) CreateTracesExporter( _ context.Context, diff --git a/cmd/opentelemetry/app/exporter/jaegerexporter/jaeger_exporter.go b/cmd/opentelemetry/app/exporter/jaegerexporter/jaeger_exporter.go index c89a54ca39d..e8ff5d87f31 100644 --- a/cmd/opentelemetry/app/exporter/jaegerexporter/jaeger_exporter.go +++ b/cmd/opentelemetry/app/exporter/jaegerexporter/jaeger_exporter.go @@ -58,7 +58,7 @@ func (f Factory) CreateDefaultConfig() configmodels.Exporter { return cfg } -// CreateTraceExporter creates Jaeger trace exporter. +// CreateTracesExporter creates Jaeger trace exporter. // This function implements OTEL component.ExporterFactory interface. func (f Factory) CreateTracesExporter( ctx context.Context, diff --git a/cmd/opentelemetry/app/exporter/kafkaexporter/kafka_exporter.go b/cmd/opentelemetry/app/exporter/kafkaexporter/kafka_exporter.go index db916fc1822..4cf4c583b66 100644 --- a/cmd/opentelemetry/app/exporter/kafkaexporter/kafka_exporter.go +++ b/cmd/opentelemetry/app/exporter/kafkaexporter/kafka_exporter.go @@ -97,7 +97,7 @@ func (f Factory) CreateDefaultConfig() configmodels.Exporter { return cfg } -// CreateTraceExporter creates Jaeger trace exporter. +// CreateTracesExporter creates Jaeger trace exporter. // This function implements OTEL component.ExporterFactory interface. func (f Factory) CreateTracesExporter( ctx context.Context, diff --git a/cmd/opentelemetry/app/exporter/memoryexporter/factory.go b/cmd/opentelemetry/app/exporter/memoryexporter/factory.go index c45d5881f10..968b09a3bb6 100644 --- a/cmd/opentelemetry/app/exporter/memoryexporter/factory.go +++ b/cmd/opentelemetry/app/exporter/memoryexporter/factory.go @@ -78,7 +78,7 @@ func (f Factory) CreateDefaultConfig() configmodels.Exporter { } } -// CreateTraceExporter creates Jaeger Kafka trace exporter. +// CreateTracesExporter creates Jaeger Kafka trace exporter. // This function implements OTEL component.ExporterFactory interface. func (f Factory) CreateTracesExporter( _ context.Context, diff --git a/cmd/opentelemetry/app/processor/resourceprocessor/resource_processor.go b/cmd/opentelemetry/app/processor/resourceprocessor/resource_processor.go index d613f4c551b..b7630576c45 100644 --- a/cmd/opentelemetry/app/processor/resourceprocessor/resource_processor.go +++ b/cmd/opentelemetry/app/processor/resourceprocessor/resource_processor.go @@ -67,7 +67,7 @@ func (f Factory) GetTags() map[string]string { return tags } -// CreateTraceProcessor creates resource processor. +// CreateTracesProcessor creates resource processor. // This function implements OTEL component.ProcessorFactoryOld interface. func (f Factory) CreateTracesProcessor( ctx context.Context, diff --git a/cmd/opentelemetry/app/receiver/jaegerreceiver/jaeger_receiver.go b/cmd/opentelemetry/app/receiver/jaegerreceiver/jaeger_receiver.go index a6d045d14f1..0f293dabeb9 100644 --- a/cmd/opentelemetry/app/receiver/jaegerreceiver/jaeger_receiver.go +++ b/cmd/opentelemetry/app/receiver/jaegerreceiver/jaeger_receiver.go @@ -147,7 +147,7 @@ func createDefaultSamplingConfig(v *viper.Viper) *jaegerreceiver.RemoteSamplingC return samplingConf } -// CreateTraceReceiver creates Jaeger receiver trace receiver. +// CreateTracesReceiver creates Jaeger receiver trace receiver. // This function implements OTEL component.ReceiverFactory interface. func (f *Factory) CreateTracesReceiver( ctx context.Context, diff --git a/cmd/opentelemetry/app/receiver/kafkareceiver/kafka_receiver.go b/cmd/opentelemetry/app/receiver/kafkareceiver/kafka_receiver.go index a3d5a327735..912dc906de9 100644 --- a/cmd/opentelemetry/app/receiver/kafkareceiver/kafka_receiver.go +++ b/cmd/opentelemetry/app/receiver/kafkareceiver/kafka_receiver.go @@ -104,7 +104,7 @@ func (f *Factory) CreateDefaultConfig() configmodels.Receiver { return cfg } -// CreateTraceReceiver creates Jaeger receiver trace receiver. +// CreateTracesReceiver creates Jaeger receiver trace receiver. // This function implements OTEL component.ReceiverFactory interface. func (f *Factory) CreateTracesReceiver( ctx context.Context, diff --git a/cmd/opentelemetry/app/receiver/zipkinreceiver/zipkin_receiver.go b/cmd/opentelemetry/app/receiver/zipkinreceiver/zipkin_receiver.go index cabbe49dc74..8746b0cd195 100644 --- a/cmd/opentelemetry/app/receiver/zipkinreceiver/zipkin_receiver.go +++ b/cmd/opentelemetry/app/receiver/zipkinreceiver/zipkin_receiver.go @@ -55,7 +55,7 @@ func (f Factory) CreateDefaultConfig() configmodels.Receiver { return cfg } -// CreateTraceReceiver creates Zipkin receiver trace receiver. +// CreateTracesReceiver creates Zipkin receiver trace receiver. // This function implements OTEL component.ReceiverFactoryOld interface. func (f Factory) CreateTracesReceiver( ctx context.Context, From a78e91849a2aa8793d4e18755578ebf4c4a929b2 Mon Sep 17 00:00:00 2001 From: Pavel Kositsyn Date: Mon, 9 Nov 2020 16:33:02 +0300 Subject: [PATCH 4/5] fasten convert traceID/spanID Signed-off-by: Pavel Kositsyn --- .../esmodeltranslator/modeltranslator.go | 24 +++++++++---------- .../esmodeltranslator/modeltranslator_test.go | 6 +++++ 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/cmd/opentelemetry/app/exporter/elasticsearchexporter/esmodeltranslator/modeltranslator.go b/cmd/opentelemetry/app/exporter/elasticsearchexporter/esmodeltranslator/modeltranslator.go index 9c99b7137ea..315a944a9c7 100644 --- a/cmd/opentelemetry/app/exporter/elasticsearchexporter/esmodeltranslator/modeltranslator.go +++ b/cmd/opentelemetry/app/exporter/elasticsearchexporter/esmodeltranslator/modeltranslator.go @@ -15,6 +15,7 @@ package esmodeltranslator import ( + "encoding/hex" "errors" "fmt" "strconv" @@ -222,26 +223,23 @@ func references(links pdata.SpanLinkSlice, parentSpanID pdata.SpanID, traceID db } func convertSpanID(spanID pdata.SpanID) (dbmodel.SpanID, error) { - spanIDInt := tracetranslator.BytesToUInt64SpanID(spanID.Bytes()) - if spanIDInt == 0 { + if !spanID.IsValid() { return "", errZeroSpanID } - return dbmodel.SpanID(fmt.Sprintf("%016x", spanIDInt)), nil + src := spanID.Bytes() + dst := make([]byte, hex.EncodedLen(len(src))) + hex.Encode(dst, src[:]) + return dbmodel.SpanID(dst), nil } func convertTraceID(traceID pdata.TraceID) (dbmodel.TraceID, error) { - high, low := tracetranslator.BytesToUInt64TraceID(traceID.Bytes()) - if low == 0 && high == 0 { + if !traceID.IsValid() { return "", errZeroTraceID } - return dbmodel.TraceID(traceIDToString(high, low)), nil -} - -func traceIDToString(high, low uint64) string { - if high == 0 { - return fmt.Sprintf("%016x", low) - } - return fmt.Sprintf("%016x%016x", high, low) + src := traceID.Bytes() + dst := make([]byte, hex.EncodedLen(len(src))) + hex.Encode(dst, src[:]) + return dbmodel.TraceID(dst), nil } func (c *Translator) process(resource pdata.Resource) *dbmodel.Process { diff --git a/cmd/opentelemetry/app/exporter/elasticsearchexporter/esmodeltranslator/modeltranslator_test.go b/cmd/opentelemetry/app/exporter/elasticsearchexporter/esmodeltranslator/modeltranslator_test.go index d173d787dd6..4150439e548 100644 --- a/cmd/opentelemetry/app/exporter/elasticsearchexporter/esmodeltranslator/modeltranslator_test.go +++ b/cmd/opentelemetry/app/exporter/elasticsearchexporter/esmodeltranslator/modeltranslator_test.go @@ -173,6 +173,12 @@ func TestConvertSpan(t *testing.T) { }, spansData[0]) } +func BenchmarkConvertSpanID(b *testing.B) { + for i := 0; i < b.N; i++ { + _, _ = convertSpanID(spanID) + } +} + func TestSpanEmptyRef(t *testing.T) { traces := traces("myservice") span := addSpan(traces, "root", traceID, spanID) From 5b5e72e093d79f3007d6bc8ae2a3412d218cb9e9 Mon Sep 17 00:00:00 2001 From: Pavel Kositsyn Date: Tue, 10 Nov 2020 01:18:44 +0300 Subject: [PATCH 5/5] fix convertTraceID + fix tests Signed-off-by: Pavel Kositsyn --- .../esmodeltranslator/modeltranslator.go | 13 +++++++++---- .../esmodeltranslator/modeltranslator_test.go | 6 ++++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/cmd/opentelemetry/app/exporter/elasticsearchexporter/esmodeltranslator/modeltranslator.go b/cmd/opentelemetry/app/exporter/elasticsearchexporter/esmodeltranslator/modeltranslator.go index 315a944a9c7..ef016bbb104 100644 --- a/cmd/opentelemetry/app/exporter/elasticsearchexporter/esmodeltranslator/modeltranslator.go +++ b/cmd/opentelemetry/app/exporter/elasticsearchexporter/esmodeltranslator/modeltranslator.go @@ -236,10 +236,15 @@ func convertTraceID(traceID pdata.TraceID) (dbmodel.TraceID, error) { if !traceID.IsValid() { return "", errZeroTraceID } - src := traceID.Bytes() - dst := make([]byte, hex.EncodedLen(len(src))) - hex.Encode(dst, src[:]) - return dbmodel.TraceID(dst), nil + high, low := tracetranslator.BytesToUInt64TraceID(traceID.Bytes()) + return dbmodel.TraceID(traceIDToString(high, low)), nil +} + +func traceIDToString(high, low uint64) string { + if high == 0 { + return fmt.Sprintf("%016x", low) + } + return fmt.Sprintf("%016x%016x", high, low) } func (c *Translator) process(resource pdata.Resource) *dbmodel.Process { diff --git a/cmd/opentelemetry/app/exporter/elasticsearchexporter/esmodeltranslator/modeltranslator_test.go b/cmd/opentelemetry/app/exporter/elasticsearchexporter/esmodeltranslator/modeltranslator_test.go index 4150439e548..3713c4609d5 100644 --- a/cmd/opentelemetry/app/exporter/elasticsearchexporter/esmodeltranslator/modeltranslator_test.go +++ b/cmd/opentelemetry/app/exporter/elasticsearchexporter/esmodeltranslator/modeltranslator_test.go @@ -129,7 +129,9 @@ func TestConvertSpan(t *testing.T) { span.Links().Resize(1) span.Links().At(0).InitEmpty() span.Links().At(0).SetSpanID(spanID) - span.Links().At(0).SetTraceID(traceID) + traceIDZeroHigh := pdata.NewTraceID([16]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}) + span.Links().At(0).SetTraceID(traceIDZeroHigh) c := &Translator{ tagKeysAsFields: map[string]bool{"toTagMap": true}, @@ -164,7 +166,7 @@ func TestConvertSpan(t *testing.T) { {Key: "foo", Value: "bar", Type: dbmodel.StringType}}, Timestamp: 500}}, References: []dbmodel.Reference{ {SpanID: "0001020304050607", TraceID: "000102030405060708090a0b0c0d0e0f", RefType: dbmodel.ChildOf}, - {SpanID: "0001020304050607", TraceID: "000102030405060708090a0b0c0d0e0f", RefType: dbmodel.FollowsFrom}}, + {SpanID: "0001020304050607", TraceID: "0001020304050607", RefType: dbmodel.FollowsFrom}}, Process: dbmodel.Process{ ServiceName: "myservice", Tags: []dbmodel.KeyValue{{Key: "num", Value: "16.66", Type: dbmodel.Float64Type}},