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

Bump opentelemetry to v0.15.0 #2634

Merged
merged 3 commits into from
Nov 21, 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
10 changes: 6 additions & 4 deletions cmd/opentelemetry/app/defaultconfig/default_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,13 +206,15 @@ func createExporters(component ComponentType, storageTypes string, factories com

func enableAgentUDPEndpoints(jaeger *jaegerreceiver.Config) {
if jaeger.ThriftCompact == nil {
jaeger.ThriftCompact = &confignet.TCPAddr{
Endpoint: udpThriftCompactEndpoint,
jaeger.ThriftCompact = &jaegerreceiver.ProtocolUDP{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. This will allow us to support max udp packet size in the Jaeger otel collectors.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it is already configurable in otel receiver config

Copy link
Contributor Author

@pkositsyn pkositsyn Nov 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alongwith socket buffer size, number of workers and server queue size

Endpoint: udpThriftCompactEndpoint,
ServerConfigUDP: jaegerreceiver.DefaultServerConfigUDP(),
}
}
if jaeger.ThriftBinary == nil {
jaeger.ThriftBinary = &confignet.TCPAddr{
Endpoint: udpThriftBinaryEndpoint,
jaeger.ThriftBinary = &jaegerreceiver.ProtocolUDP{
Endpoint: udpThriftBinaryEndpoint,
ServerConfigUDP: jaegerreceiver.DefaultServerConfigUDP(),
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions cmd/opentelemetry/app/defaultconfig/default_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,11 @@ func TestService(t *testing.T) {
cfg, err := createDefaultConfig(viper.New(), factories)
if test.err != "" {
require.Nil(t, cfg)
assert.Error(t, err)
assert.Contains(t, err.Error(), test.err)
return
}
require.NoError(t, err)
sort.Strings(test.service.Pipelines["traces"].Exporters)
sort.Strings(cfg.Service.Pipelines["traces"].Exporters)
sort.Strings(test.service.Pipelines["traces"].Receivers)
Expand Down
16 changes: 14 additions & 2 deletions cmd/opentelemetry/app/defaultconfig/merge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,14 @@ func TestMergeConfigs(t *testing.T) {
Endpoint: "def",
},
},
ThriftCompact: &confignet.TCPAddr{
ThriftCompact: &jaegerreceiver.ProtocolUDP{
Endpoint: "def",
ServerConfigUDP: jaegerreceiver.ServerConfigUDP{
QueueSize: 100,
MaxPacketSize: 65_536,
Workers: 10,
SocketBufferSize: 65_536,
},
},
},
},
Expand Down Expand Up @@ -128,8 +134,14 @@ func TestMergeConfigs(t *testing.T) {
Endpoint: "master_jaeger_url",
},
},
ThriftCompact: &confignet.TCPAddr{
ThriftCompact: &jaegerreceiver.ProtocolUDP{
Endpoint: "def",
ServerConfigUDP: jaegerreceiver.ServerConfigUDP{
QueueSize: 100,
MaxPacketSize: 65_536,
Workers: 10,
SocketBufferSize: 65_536,
},
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ func TestCreateTraceExporter(t *testing.T) {
}}
exporter, err := factory.CreateTracesExporter(context.Background(), component.ExporterCreateParams{}, factory.CreateDefaultConfig())
require.Nil(t, exporter)
require.Error(t, err)
assert.Contains(t, err.Error(), "gocql: unable to create session")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ func traceIDToString(high, low uint64) string {
}

func (c *Translator) process(resource pdata.Resource) *dbmodel.Process {
if resource.IsNil() || resource.Attributes().Len() == 0 {
if resource.Attributes().Len() == 0 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that IsNil() was removed and the resource is guaranteed to never be nil?

I find these generate proto wrappers very confusing. Do you have any insight into why this was removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, that went from my issue about panic in marshalling open-telemetry/opentelemetry-collector#1985. Then gradually all proto things became non-nullable. I believe, that using pointers was a mistake from the very beginning

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you're right, resource now cannot be nil

return nil
}
p := &dbmodel.Process{}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,6 @@ func traces(serviceName string) pdata.Traces {
traces := pdata.NewTraces()
traces.ResourceSpans().Resize(1)
traces.ResourceSpans().At(0).InstrumentationLibrarySpans().Resize(1)
traces.ResourceSpans().At(0).Resource().InitEmpty()
traces.ResourceSpans().At(0).Resource().Attributes().InitFromMap(map[string]pdata.AttributeValue{conventions.AttributeServiceName: pdata.NewAttributeValueString(serviceName)})
return traces
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,15 @@ func TestCreateTraceExporter(t *testing.T) {
config.Primary.Servers = []string{"http://foobardoesnotexists.test"}
exporter, err := factory.CreateTracesExporter(context.Background(), component.ExporterCreateParams{Logger: zap.NewNop()}, config)
require.Nil(t, exporter)
require.Error(t, err)
assert.Contains(t, err.Error(), "no such host")
}

func TestCreateTraceExporter_nilConfig(t *testing.T) {
factory := &Factory{}
exporter, err := factory.CreateTracesExporter(context.Background(), component.ExporterCreateParams{}, nil)
require.Nil(t, exporter)
require.Error(t, err)
assert.Contains(t, err.Error(), "could not cast configuration to jaeger_elasticsearch")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,7 @@ func bulkItemsToTraces(bulkItems []bulkItem) pdata.Traces {
for i, op := range bulkItems {
spanData := op.spanData
rss := traces.ResourceSpans().At(i)
if !spanData.Resource.IsNil() {
rss.Resource().InitEmpty()
spanData.Resource.Attributes().CopyTo(rss.Resource().Attributes())
}
spanData.Resource.Attributes().CopyTo(rss.Resource().Attributes())
rss.InstrumentationLibrarySpans().Resize(1)
ispans := rss.InstrumentationLibrarySpans().At(0)
ispans.InitEmpty()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ func TestBulkItemsToTraces(t *testing.T) {
span.InitEmpty()
span.SetName("name")
resource := pdata.NewResource()
resource.InitEmpty()
resource.Attributes().Insert("key", pdata.NewAttributeValueString("val"))
inst := pdata.NewInstrumentationLibrary()
inst.InitEmpty()
Expand Down Expand Up @@ -176,7 +175,6 @@ func TestWriteSpans(t *testing.T) {
span.InitEmpty()
span.SetName("name")
resource := pdata.NewResource()
resource.InitEmpty()
resource.Attributes().Insert("key", pdata.NewAttributeValueString("val"))
inst := pdata.NewInstrumentationLibrary()
inst.InitEmpty()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ func TestCreateTraceExporter(t *testing.T) {
}}
exporter, err := factory.CreateTracesExporter(context.Background(), component.ExporterCreateParams{}, factory.CreateDefaultConfig())
require.Nil(t, exporter)
require.Error(t, err)
assert.Contains(t, err.Error(), "error attempting to connect to plugin rpc client: fork/exec : no such file or directory")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ func TestLoadConfigAndFlags(t *testing.T) {
}

factories, err := componenttest.ExampleComponents()
require.NoError(t, err)
factories.Exporters[TypeStr] = factory
cfg, err := configtest.LoadConfigFile(t, path.Join(".", "testdata", "config.yaml"), factories)
require.NoError(t, err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ func TestCreateTraceExporter_nilConfig(t *testing.T) {
factory := &Factory{}
exporter, err := factory.CreateTracesExporter(context.Background(), component.ExporterCreateParams{}, nil)
require.Nil(t, exporter)
require.Error(t, err)
assert.Contains(t, err.Error(), "could not cast configuration to jaeger_memory")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ func TestStore(t *testing.T) {
dropped, err := test.storage.traceDataPusher(context.Background(), test.data)
assert.Equal(t, test.dropped, dropped)
if test.err != "" {
assert.Error(t, err)
assert.Contains(t, err.Error(), test.err)
} else {
require.NoError(t, err)
Expand Down
1 change: 1 addition & 0 deletions cmd/opentelemetry/app/internal/esclient/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ func testBulk(t *testing.T, clientFactory func(tripper http.RoundTripper) (Elast

bulkResp, err := client.Bulk(context.Background(), strings.NewReader("data"))
if test.err != "" {
assert.Error(t, err)
assert.Contains(t, err.Error(), test.err)
return
}
Expand Down
1 change: 1 addition & 0 deletions cmd/opentelemetry/app/internal/esclient/ping_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ func TestPing(t *testing.T) {
esPing := elasticsearchPing{}
version, err := esPing.getVersion(ts.URL)
if test.err != "" {
assert.Error(t, err)
assert.Contains(t, err.Error(), test.err)
assert.Equal(t, 0, version)
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ func TestGetDependencies_err_unmarshall(t *testing.T) {
}
store := NewDependencyStore(client, zap.NewNop(), "foo", defaultMaxDocCount)
dependencies, err := store.GetDependencies(context.Background(), tsNow, time.Hour)
require.Error(t, err)
require.Contains(t, err.Error(), "invalid character")
assert.Nil(t, dependencies)
}
Expand Down
10 changes: 6 additions & 4 deletions cmd/opentelemetry/app/receiver/jaegerreceiver/jaeger_receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,15 @@ func configureAgent(v *viper.Viper, cfg *jaegerreceiver.Config) {
aOpts := agentApp.Builder{}
aOpts.InitFromViper(v)
if v.IsSet(thriftBinaryHostPort) {
cfg.ThriftBinary = &confignet.TCPAddr{
Endpoint: v.GetString(thriftBinaryHostPort),
cfg.ThriftBinary = &jaegerreceiver.ProtocolUDP{
Endpoint: v.GetString(thriftBinaryHostPort),
ServerConfigUDP: jaegerreceiver.DefaultServerConfigUDP(),
}
}
if v.IsSet(thriftCompactHostPort) {
cfg.ThriftCompact = &confignet.TCPAddr{
Endpoint: v.GetString(thriftCompactHostPort),
cfg.ThriftCompact = &jaegerreceiver.ProtocolUDP{
Endpoint: v.GetString(thriftCompactHostPort),
ServerConfigUDP: jaegerreceiver.DefaultServerConfigUDP(),
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ func TestDefaultValueFromViper(t *testing.T) {
flags: []string{fmt.Sprintf("--%s=%s", thriftCompactHostPort, "localhost:9999")},
expected: &jaegerreceiver.Config{
Protocols: jaegerreceiver.Protocols{
ThriftCompact: &confignet.TCPAddr{
Endpoint: "localhost:9999",
ThriftCompact: &jaegerreceiver.ProtocolUDP{
Endpoint: "localhost:9999",
ServerConfigUDP: jaegerreceiver.DefaultServerConfigUDP(),
},
},
},
Expand All @@ -83,8 +84,9 @@ func TestDefaultValueFromViper(t *testing.T) {
flags: []string{fmt.Sprintf("--%s=%s", thriftBinaryHostPort, "localhost:8888")},
expected: &jaegerreceiver.Config{
Protocols: jaegerreceiver.Protocols{
ThriftBinary: &confignet.TCPAddr{
Endpoint: "localhost:8888",
ThriftBinary: &jaegerreceiver.ProtocolUDP{
Endpoint: "localhost:8888",
ServerConfigUDP: jaegerreceiver.DefaultServerConfigUDP(),
},
},
},
Expand Down Expand Up @@ -121,8 +123,9 @@ func TestDefaultValueFromViper(t *testing.T) {
ThriftHTTP: &confighttp.HTTPServerSettings{
Endpoint: "localhost:8089",
},
ThriftBinary: &confignet.TCPAddr{
Endpoint: "localhost:2222",
ThriftBinary: &jaegerreceiver.ProtocolUDP{
Endpoint: "localhost:2222",
ServerConfigUDP: jaegerreceiver.DefaultServerConfigUDP(),
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ func TestLoadConfigAndFlags(t *testing.T) {
}

factories, err := componenttest.ExampleComponents()
require.NoError(t, err)
factories.Receivers[TypeStr] = factory
cfg, err := configtest.LoadConfigFile(t, path.Join(".", "testdata", "config.yaml"), factories)
require.NoError(t, err)
Expand Down
8 changes: 4 additions & 4 deletions cmd/opentelemetry/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ go 1.14
replace github.com/jaegertracing/jaeger => ./../../

require (
github.com/Shopify/sarama v1.27.0
github.com/Shopify/sarama v1.27.2
github.com/elastic/go-elasticsearch/v6 v6.8.10
github.com/elastic/go-elasticsearch/v7 v7.0.0
github.com/imdario/mergo v0.3.9
github.com/jaegertracing/jaeger v1.20.0
github.com/jaegertracing/jaeger v1.21.0
github.com/opentracing/opentracing-go v1.2.0
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.7.1
github.com/stretchr/testify v1.6.1
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.14.0
go.opencensus.io v0.22.5
go.opentelemetry.io/collector v0.15.0
go.uber.org/zap v1.16.0
)
Loading