Skip to content

Commit

Permalink
Lint fixes for OTel-Arrow receiver in OTel-Collector-Contrib (#167)
Browse files Browse the repository at this point in the history
Lint fixes required for OpenTelemetry Collector Contrib in the
otelarrowreceiver package.

From a
[branch](https://github.com/open-telemetry/opentelemetry-collector-contrib/compare/main...jmacd:opentelemetry-collector-contrib:jmacd/arrow_receiver?expand=1).
  • Loading branch information
jmacd authored Mar 27, 2024
1 parent 788a435 commit f846b28
Show file tree
Hide file tree
Showing 29 changed files with 97 additions and 225 deletions.
11 changes: 0 additions & 11 deletions collector/cmd/otelarrowcol/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,3 @@ require (
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)











20 changes: 20 additions & 0 deletions collector/cmd/otelarrowcol/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,26 @@ github.com/open-telemetry/opentelemetry-collector-contrib/extension/pprofextensi
github.com/open-telemetry/opentelemetry-collector-contrib/extension/pprofextension v0.97.0/go.mod h1:ngGZOyaajaHv4EkBh1f2h+hqfkqBojLjn8c8XcluF2Q=
github.com/open-telemetry/opentelemetry-collector-contrib/internal/common v0.97.0 h1:jPhm8t6pJcxgng2DaEhPZ3sY44KBoM0W32j6aI+hMgU=
github.com/open-telemetry/opentelemetry-collector-contrib/internal/common v0.97.0/go.mod h1:PAJCWmb9gEZh1OhazzHrvUGQeu31Rzqm8OJQVfxlLwU=
github.com/open-telemetry/otel-arrow v0.20.0 h1:MWm//AMwchAXBtTpPM4qbp8c4qFYpZNNJnEPyl7EvoQ=
github.com/open-telemetry/otel-arrow v0.20.0/go.mod h1:lCYR/TB4fYeKGVkwwDPIHRVW7KcoF3e+mTF164p6uoo=
github.com/open-telemetry/otel-arrow/collector v0.20.0 h1:DWo3OK2kvmGXcgoTc7dRBrADuwu0PKX31KcG/q7fElk=
github.com/open-telemetry/otel-arrow/collector v0.20.0/go.mod h1:MDDGj7VCOA6ya0d+xbPneynT5gC7TCHV3vVeXDEo41g=
github.com/open-telemetry/otel-arrow/collector/connector/validationconnector v0.20.0 h1:nZ0zAYh9RUTRmIEigY+4OMt/mNVmkKhk6QAWLsTk5pM=
github.com/open-telemetry/otel-arrow/collector/connector/validationconnector v0.20.0/go.mod h1:UdVJl2OoCOdvjvjcBcpNzw/oCs22DTZs8sqX/frUjw4=
github.com/open-telemetry/otel-arrow/collector/exporter/fileexporter v0.20.0 h1:cwpBST2VxZ/fInOmj2x0IokmRfX+eeimpap2b2SPaRw=
github.com/open-telemetry/otel-arrow/collector/exporter/fileexporter v0.20.0/go.mod h1:ruDh+tsLVYyaKhGuinIs96sb9uvXRl4lEy7m7VDE9+s=
github.com/open-telemetry/otel-arrow/collector/exporter/otelarrowexporter v0.20.0 h1:N9R19/ascPkyzACWYpmnJD+fGtJyV+xddmYStjO/EvA=
github.com/open-telemetry/otel-arrow/collector/exporter/otelarrowexporter v0.20.0/go.mod h1:ID/YmgkHY+fEUO1ZoraUHWROFecZnSWDo2BH2AWpwV8=
github.com/open-telemetry/otel-arrow/collector/processor/concurrentbatchprocessor v0.20.0 h1:1OwSAt/Mgws9BjYeWJIYohizyIiuPTQb14H6vqk2joQ=
github.com/open-telemetry/otel-arrow/collector/processor/concurrentbatchprocessor v0.20.0/go.mod h1:jhxhrxEviCFlBdso59LS7aeNDfE+U5EEgSPYvsjE+f0=
github.com/open-telemetry/otel-arrow/collector/processor/experimentprocessor v0.20.0 h1:jB6d8VzWGEY1Vqmo2dOO6WzTjGxsym8g1pRTKIl6o5Y=
github.com/open-telemetry/otel-arrow/collector/processor/experimentprocessor v0.20.0/go.mod h1:qtboHJOOcDLLo5m9BkakGnEha/7tZRRfUjTSnL+VLB8=
github.com/open-telemetry/otel-arrow/collector/processor/obfuscationprocessor v0.20.0 h1:0kCHmlwCWh3spFpXhCt5WLWImRAmuAvHjld5kUJoCfM=
github.com/open-telemetry/otel-arrow/collector/processor/obfuscationprocessor v0.20.0/go.mod h1:5aucYwnpl0uZDR5gU4kDPxQn5Cx5njNqG1ZsS9FNKo8=
github.com/open-telemetry/otel-arrow/collector/receiver/filereceiver v0.20.0 h1:YSDbPz8HWS8WsYREEBgU6BQ+4mD3iP5zA3jVJwx14h8=
github.com/open-telemetry/otel-arrow/collector/receiver/filereceiver v0.20.0/go.mod h1:+b7cyHH/e0v7DxXV8vipYDtnEflWsI/HBb2+35FjC+4=
github.com/open-telemetry/otel-arrow/collector/receiver/otelarrowreceiver v0.20.0 h1:UVGTHve4UGW+ffAvu1Z5M6jcufHfJBeIUQEVJS/wI2U=
github.com/open-telemetry/otel-arrow/collector/receiver/otelarrowreceiver v0.20.0/go.mod h1:h0zvjU/w/an91AQWELeoD9EzbrCAhljeSUuKSy6T1dI=
github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
github.com/opentracing/opentracing-go v1.0.3-0.20180606204148-bd9c31933947/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
Expand Down
11 changes: 0 additions & 11 deletions collector/connector/validationconnector/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,3 @@ require (
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)











2 changes: 2 additions & 0 deletions collector/connector/validationconnector/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/open-telemetry/otel-arrow v0.20.0 h1:MWm//AMwchAXBtTpPM4qbp8c4qFYpZNNJnEPyl7EvoQ=
github.com/open-telemetry/otel-arrow v0.20.0/go.mod h1:lCYR/TB4fYeKGVkwwDPIHRVW7KcoF3e+mTF164p6uoo=
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/prometheus/client_golang v1.19.0 h1:ygXvpU1AoN1MhdzckN+PyD9QJOSD4x7kmXYlnfbA6JU=
Expand Down
11 changes: 0 additions & 11 deletions collector/examples/printer/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,3 @@ require (
google.golang.org/grpc v1.62.1 // indirect
google.golang.org/protobuf v1.33.0 // indirect
)











11 changes: 0 additions & 11 deletions collector/exporter/fileexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,3 @@ require (
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)











2 changes: 2 additions & 0 deletions collector/exporter/fileexporter/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/open-telemetry/otel-arrow/collector v0.20.0 h1:DWo3OK2kvmGXcgoTc7dRBrADuwu0PKX31KcG/q7fElk=
github.com/open-telemetry/otel-arrow/collector v0.20.0/go.mod h1:MDDGj7VCOA6ya0d+xbPneynT5gC7TCHV3vVeXDEo41g=
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/prometheus/client_golang v1.19.0 h1:ygXvpU1AoN1MhdzckN+PyD9QJOSD4x7kmXYlnfbA6JU=
Expand Down
11 changes: 0 additions & 11 deletions collector/exporter/otelarrowexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,3 @@ require (
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)











4 changes: 4 additions & 0 deletions collector/exporter/otelarrowexporter/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjY
github.com/mostynb/go-grpc-compression v1.2.2 h1:XaDbnRvt2+1vgr0b/l0qh4mJAfIxE0bKXtz2Znl3GGI=
github.com/mostynb/go-grpc-compression v1.2.2/go.mod h1:GOCr2KBxXcblCuczg3YdLQlcin1/NfyDA348ckuCH6w=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/open-telemetry/otel-arrow v0.20.0 h1:MWm//AMwchAXBtTpPM4qbp8c4qFYpZNNJnEPyl7EvoQ=
github.com/open-telemetry/otel-arrow v0.20.0/go.mod h1:lCYR/TB4fYeKGVkwwDPIHRVW7KcoF3e+mTF164p6uoo=
github.com/open-telemetry/otel-arrow/collector v0.20.0 h1:DWo3OK2kvmGXcgoTc7dRBrADuwu0PKX31KcG/q7fElk=
github.com/open-telemetry/otel-arrow/collector v0.20.0/go.mod h1:MDDGj7VCOA6ya0d+xbPneynT5gC7TCHV3vVeXDEo41g=
github.com/pierrec/lz4/v4 v4.1.18 h1:xaKrnTkyoqfh1YItXl56+6KJNVYWlEEPuAQW9xsplYQ=
github.com/pierrec/lz4/v4 v4.1.18/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
Expand Down
11 changes: 0 additions & 11 deletions collector/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,3 @@ require (
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)











11 changes: 0 additions & 11 deletions collector/processor/concurrentbatchprocessor/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,3 @@ require (
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)











11 changes: 0 additions & 11 deletions collector/processor/experimentprocessor/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,3 @@ require (
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)











11 changes: 0 additions & 11 deletions collector/processor/obfuscationprocessor/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,3 @@ require (
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)











11 changes: 0 additions & 11 deletions collector/receiver/filereceiver/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,3 @@ require (
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)











30 changes: 5 additions & 25 deletions collector/receiver/otelarrowreceiver/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"github.com/open-telemetry/otel-arrow/collector/compression/zstd"
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/config/configgrpc"
"go.opentelemetry.io/collector/confmap"
)

const (
Expand All @@ -21,11 +20,11 @@ const (
// Protocols is the configuration for the supported protocols.
type Protocols struct {
GRPC configgrpc.ServerConfig `mapstructure:"grpc"`
Arrow ArrowSettings `mapstructure:"arrow"`
Arrow ArrowConfig `mapstructure:"arrow"`
}

// ArrowSettings support configuring the Arrow receiver.
type ArrowSettings struct {
// ArrowConfig support configuring the Arrow receiver.
type ArrowConfig struct {
// MemoryLimitMiB is the size of a shared memory region used
// by all Arrow streams, in MiB. When too much load is
// passing through, they will see ResourceExhausted errors.
Expand All @@ -42,30 +41,11 @@ type Config struct {
}

var _ component.Config = (*Config)(nil)
var _ confmap.Unmarshaler = (*Config)(nil)
var _ component.ConfigValidator = (*ArrowConfig)(nil)

// Validate checks the receiver configuration is valid
func (cfg *Config) Validate() error {
if err := cfg.Arrow.Validate(); err != nil {
return err
}
return nil
}

func (cfg *ArrowSettings) Validate() error {
func (cfg *ArrowConfig) Validate() error {
if err := cfg.Zstd.Validate(); err != nil {
return fmt.Errorf("zstd decoder: invalid configuration: %w", err)
}
return nil
}

// Unmarshal a confmap.Conf into the config struct.
func (cfg *Config) Unmarshal(conf *confmap.Conf) error {
// first load the config normally
err := conf.Unmarshal(cfg)
if err != nil {
return err
}

return nil
}
5 changes: 2 additions & 3 deletions collector/receiver/otelarrowreceiver/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/config/configgrpc"
"go.opentelemetry.io/collector/config/confignet"
Expand Down Expand Up @@ -77,7 +76,7 @@ func TestUnmarshalConfig(t *testing.T) {
},
},
},
Arrow: ArrowSettings{
Arrow: ArrowConfig{
MemoryLimitMiB: 123,
},
},
Expand All @@ -101,7 +100,7 @@ func TestUnmarshalConfigUnix(t *testing.T) {
},
ReadBufferSize: 512 * 1024,
},
Arrow: ArrowSettings{
Arrow: ArrowConfig{
MemoryLimitMiB: defaultMemoryLimitMiB,
},
},
Expand Down
3 changes: 1 addition & 2 deletions collector/receiver/otelarrowreceiver/encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@ import (

"github.com/gogo/protobuf/jsonpb"
"github.com/gogo/protobuf/proto"
spb "google.golang.org/genproto/googleapis/rpc/status"

"go.opentelemetry.io/collector/pdata/plog/plogotlp"
"go.opentelemetry.io/collector/pdata/pmetric/pmetricotlp"
"go.opentelemetry.io/collector/pdata/ptrace/ptraceotlp"
spb "google.golang.org/genproto/googleapis/rpc/status"
)

const (
Expand Down
5 changes: 3 additions & 2 deletions collector/receiver/otelarrowreceiver/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ package otelarrowreceiver // import "github.com/open-telemetry/otel-arrow/collec
import (
"context"

"github.com/open-telemetry/otel-arrow/collector/receiver/otelarrowreceiver/internal/metadata"
"github.com/open-telemetry/otel-arrow/collector/sharedcomponent"
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/config/configgrpc"
"go.opentelemetry.io/collector/config/confignet"
"go.opentelemetry.io/collector/consumer"
"go.opentelemetry.io/collector/receiver"

"github.com/open-telemetry/otel-arrow/collector/receiver/otelarrowreceiver/internal/metadata"
)

const (
Expand Down Expand Up @@ -43,7 +44,7 @@ func createDefaultConfig() component.Config {
// We almost write 0 bytes, so no need to tune WriteBufferSize.
ReadBufferSize: 512 * 1024,
},
Arrow: ArrowSettings{
Arrow: ArrowConfig{
MemoryLimitMiB: defaultMemoryLimitMiB,
},
},
Expand Down
3 changes: 1 addition & 2 deletions collector/receiver/otelarrowreceiver/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ import (
"context"
"testing"

"github.com/open-telemetry/otel-arrow/collector/testutil"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/open-telemetry/otel-arrow/collector/testutil"
"go.opentelemetry.io/collector/component/componenttest"
"go.opentelemetry.io/collector/config/configgrpc"
"go.opentelemetry.io/collector/config/confignet"
Expand Down
11 changes: 0 additions & 11 deletions collector/receiver/otelarrowreceiver/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,3 @@ require (
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)











4 changes: 4 additions & 0 deletions collector/receiver/otelarrowreceiver/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjY
github.com/mostynb/go-grpc-compression v1.2.2 h1:XaDbnRvt2+1vgr0b/l0qh4mJAfIxE0bKXtz2Znl3GGI=
github.com/mostynb/go-grpc-compression v1.2.2/go.mod h1:GOCr2KBxXcblCuczg3YdLQlcin1/NfyDA348ckuCH6w=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/open-telemetry/otel-arrow v0.20.0 h1:MWm//AMwchAXBtTpPM4qbp8c4qFYpZNNJnEPyl7EvoQ=
github.com/open-telemetry/otel-arrow v0.20.0/go.mod h1:lCYR/TB4fYeKGVkwwDPIHRVW7KcoF3e+mTF164p6uoo=
github.com/open-telemetry/otel-arrow/collector v0.20.0 h1:DWo3OK2kvmGXcgoTc7dRBrADuwu0PKX31KcG/q7fElk=
github.com/open-telemetry/otel-arrow/collector v0.20.0/go.mod h1:MDDGj7VCOA6ya0d+xbPneynT5gC7TCHV3vVeXDEo41g=
github.com/pierrec/lz4/v4 v4.1.18 h1:xaKrnTkyoqfh1YItXl56+6KJNVYWlEEPuAQW9xsplYQ=
github.com/pierrec/lz4/v4 v4.1.18/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
Expand Down
Loading

0 comments on commit f846b28

Please sign in to comment.