Skip to content

Commit

Permalink
[chore] Move to non-deprecated symbols for configcompression (#31112)
Browse files Browse the repository at this point in the history
**Description:** Moves `configcompression` types to non-deprecated
symbols.

**Link to tracking Issue:** Needed for
open-telemetry/opentelemetry-collector/pull/9517
  • Loading branch information
mx-psi authored Feb 8, 2024
1 parent 3d5124e commit 6f353c5
Show file tree
Hide file tree
Showing 12 changed files with 36 additions and 36 deletions.
16 changes: 8 additions & 8 deletions exporter/coralogixexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,20 @@ func TestLoadConfig(t *testing.T) {
SubSystem: "SUBSYSTEM_NAME",
TimeoutSettings: exporterhelper.NewDefaultTimeoutSettings(),
DomainSettings: configgrpc.ClientConfig{
Compression: configcompression.Gzip,
Compression: configcompression.TypeGzip,
},
Metrics: configgrpc.ClientConfig{
Endpoint: "https://",
Compression: configcompression.Gzip,
Compression: configcompression.TypeGzip,
WriteBufferSize: 512 * 1024,
},
Logs: configgrpc.ClientConfig{
Endpoint: "https://",
Compression: configcompression.Gzip,
Compression: configcompression.TypeGzip,
},
Traces: configgrpc.ClientConfig{
Endpoint: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
Compression: configcompression.Gzip,
Compression: configcompression.TypeGzip,
TLSSetting: configtls.TLSClientSetting{
TLSSetting: configtls.TLSSetting{},
Insecure: false,
Expand Down Expand Up @@ -101,20 +101,20 @@ func TestLoadConfig(t *testing.T) {
SubSystem: "SUBSYSTEM_NAME",
TimeoutSettings: exporterhelper.NewDefaultTimeoutSettings(),
DomainSettings: configgrpc.ClientConfig{
Compression: configcompression.Gzip,
Compression: configcompression.TypeGzip,
},
Metrics: configgrpc.ClientConfig{
Endpoint: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
Compression: configcompression.Gzip,
Compression: configcompression.TypeGzip,
WriteBufferSize: 512 * 1024,
},
Logs: configgrpc.ClientConfig{
Endpoint: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
Compression: configcompression.Gzip,
Compression: configcompression.TypeGzip,
},
Traces: configgrpc.ClientConfig{
Endpoint: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
Compression: configcompression.Gzip,
Compression: configcompression.TypeGzip,
TLSSetting: configtls.TLSClientSetting{
TLSSetting: configtls.TLSSetting{},
Insecure: false,
Expand Down
8 changes: 4 additions & 4 deletions exporter/coralogixexporter/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,25 @@ func createDefaultConfig() component.Config {
BackOffConfig: configretry.NewDefaultBackOffConfig(),
TimeoutSettings: exporterhelper.NewDefaultTimeoutSettings(),
DomainSettings: configgrpc.ClientConfig{
Compression: configcompression.Gzip,
Compression: configcompression.TypeGzip,
},
ClientConfig: configgrpc.ClientConfig{
Endpoint: "https://",
},
// Traces GRPC client
Traces: configgrpc.ClientConfig{
Endpoint: "https://",
Compression: configcompression.Gzip,
Compression: configcompression.TypeGzip,
},
Metrics: configgrpc.ClientConfig{
Endpoint: "https://",
// Default to gzip compression
Compression: configcompression.Gzip,
Compression: configcompression.TypeGzip,
WriteBufferSize: 512 * 1024,
},
Logs: configgrpc.ClientConfig{
Endpoint: "https://",
Compression: configcompression.Gzip,
Compression: configcompression.TypeGzip,
},
PrivateKey: "",
AppName: "",
Expand Down
6 changes: 3 additions & 3 deletions exporter/coralogixexporter/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func TestCreateTracesExporter(t *testing.T) {
config: &Config{
Traces: configgrpc.ClientConfig{
Endpoint: endpoint,
Compression: configcompression.Gzip,
Compression: configcompression.TypeGzip,
},
},
},
Expand All @@ -132,7 +132,7 @@ func TestCreateTracesExporter(t *testing.T) {
config: &Config{
Traces: configgrpc.ClientConfig{
Endpoint: endpoint,
Compression: configcompression.Snappy,
Compression: configcompression.TypeSnappy,
},
},
},
Expand All @@ -141,7 +141,7 @@ func TestCreateTracesExporter(t *testing.T) {
config: &Config{
Traces: configgrpc.ClientConfig{
Endpoint: endpoint,
Compression: configcompression.Zstd,
Compression: configcompression.TypeZstd,
},
},
},
Expand Down
8 changes: 4 additions & 4 deletions exporter/logzioexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func TestLoadConfig(t *testing.T) {
Timeout: 30 * time.Second,
Headers: map[string]configopaque.String{},
// Default to gzip compression
Compression: configcompression.Gzip,
Compression: configcompression.TypeGzip,
// We almost read 0 bytes, so no need to tune ReadBufferSize.
WriteBufferSize: 512 * 1024,
}
Expand All @@ -72,7 +72,7 @@ func TestDefaultLoadConfig(t *testing.T) {
Timeout: 30 * time.Second,
Headers: map[string]configopaque.String{},
// Default to gzip compression
Compression: configcompression.Gzip,
Compression: configcompression.TypeGzip,
// We almost read 0 bytes, so no need to tune ReadBufferSize.
WriteBufferSize: 512 * 1024,
}
Expand All @@ -93,7 +93,7 @@ func TestCheckAndWarnDeprecatedOptions(t *testing.T) {
Timeout: 10 * time.Second,
Headers: map[string]configopaque.String{},
// Default to gzip compression
Compression: configcompression.Gzip,
Compression: configcompression.TypeGzip,
// We almost read 0 bytes, so no need to tune ReadBufferSize.
WriteBufferSize: 512 * 1024,
},
Expand All @@ -117,7 +117,7 @@ func TestCheckAndWarnDeprecatedOptions(t *testing.T) {
Timeout: 10 * time.Second,
Headers: map[string]configopaque.String{},
// Default to gzip compression
Compression: configcompression.Gzip,
Compression: configcompression.TypeGzip,
// We almost read 0 bytes, so no need to tune ReadBufferSize.
WriteBufferSize: 512 * 1024,
},
Expand Down
4 changes: 2 additions & 2 deletions exporter/logzioexporter/exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ func TestPushTraceData(tester *testing.T) {
Region: "",
ClientConfig: confighttp.ClientConfig{
Endpoint: server.URL,
Compression: configcompression.Gzip,
Compression: configcompression.TypeGzip,
},
}
defer server.Close()
Expand Down Expand Up @@ -279,7 +279,7 @@ func TestPushLogsData(tester *testing.T) {
Region: "",
ClientConfig: confighttp.ClientConfig{
Endpoint: server.URL,
Compression: configcompression.Gzip,
Compression: configcompression.TypeGzip,
},
}
defer server.Close()
Expand Down
2 changes: 1 addition & 1 deletion exporter/logzioexporter/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func createDefaultConfig() component.Config {
Timeout: 30 * time.Second,
Headers: map[string]configopaque.String{},
// Default to gzip compression
Compression: configcompression.Gzip,
Compression: configcompression.TypeGzip,
// We almost read 0 bytes, so no need to tune ReadBufferSize.
WriteBufferSize: 512 * 1024,
},
Expand Down
2 changes: 1 addition & 1 deletion exporter/logzioexporter/jsonlog_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func TestSetTimeStamp(t *testing.T) {
Token: "token",
ClientConfig: confighttp.ClientConfig{
Endpoint: server.URL,
Compression: configcompression.Gzip,
Compression: configcompression.TypeGzip,
},
}
var err error
Expand Down
6 changes: 3 additions & 3 deletions exporter/otelarrowexporter/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ type ArrowSettings struct {
// gRPC-level compression is enabled by default. This can be
// set to "zstd" to turn on Arrow-Zstd compression.
// Note that `Zstd` applies to gRPC, not Arrow compression.
PayloadCompression configcompression.CompressionType `mapstructure:"payload_compression"`
PayloadCompression configcompression.Type `mapstructure:"payload_compression"`

// Disabled prevents using OTel Arrow streams. The exporter
// falls back to standard OTLP.
Expand Down Expand Up @@ -106,7 +106,7 @@ func (cfg *ArrowSettings) Validate() error {
// The cfg.PayloadCompression field is validated by the underlying library,
// but we only support Zstd or none.
switch cfg.PayloadCompression {
case "none", "", configcompression.Zstd:
case "none", "", configcompression.TypeZstd:
default:
return fmt.Errorf("unsupported payload compression: %s", cfg.PayloadCompression)
}
Expand All @@ -115,7 +115,7 @@ func (cfg *ArrowSettings) Validate() error {

func (cfg *ArrowSettings) toArrowProducerOptions() (arrowOpts []config.Option) {
switch cfg.PayloadCompression {
case configcompression.Zstd:
case configcompression.TypeZstd:
arrowOpts = append(arrowOpts, config.WithZstd())
case "none", "":
arrowOpts = append(arrowOpts, config.WithNoZstd())
Expand Down
6 changes: 3 additions & 3 deletions exporter/otelarrowexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func TestUnmarshalConfig(t *testing.T) {
Arrow: ArrowSettings{
NumStreams: 2,
MaxStreamLifetime: 2 * time.Hour,
PayloadCompression: configcompression.Zstd,
PayloadCompression: configcompression.TypeZstd,
Zstd: zstd.DefaultEncoderConfig(),
},
}, cfg)
Expand Down Expand Up @@ -128,7 +128,7 @@ func TestDefaultSettingsValid(t *testing.T) {

func TestArrowSettingsPayloadCompressionZstd(t *testing.T) {
settings := ArrowSettings{
PayloadCompression: configcompression.Zstd,
PayloadCompression: configcompression.TypeZstd,
}
var config config.Config
for _, opt := range settings.toArrowProducerOptions() {
Expand All @@ -140,7 +140,7 @@ func TestArrowSettingsPayloadCompressionZstd(t *testing.T) {
func TestArrowSettingsPayloadCompressionNone(t *testing.T) {
for _, value := range []string{"", "none"} {
settings := ArrowSettings{
PayloadCompression: configcompression.CompressionType(value),
PayloadCompression: configcompression.Type(value),
}
var config config.Config
for _, opt := range settings.toArrowProducerOptions() {
Expand Down
2 changes: 1 addition & 1 deletion exporter/otelarrowexporter/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func createDefaultConfig() component.Config {
ClientConfig: configgrpc.ClientConfig{
Headers: map[string]configopaque.String{},
// Default to zstd compression
Compression: configcompression.Zstd,
Compression: configcompression.TypeZstd,
// We almost read 0 bytes, so no need to tune ReadBufferSize.
WriteBufferSize: 512 * 1024,
// The `configgrpc` default is pick_first,
Expand Down
8 changes: 4 additions & 4 deletions exporter/otelarrowexporter/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func TestCreateDefaultConfig(t *testing.T) {
assert.Equal(t, ocfg.RetrySettings, configretry.NewDefaultBackOffConfig())
assert.Equal(t, ocfg.QueueSettings, exporterhelper.NewDefaultQueueSettings())
assert.Equal(t, ocfg.TimeoutSettings, exporterhelper.NewDefaultTimeoutSettings())
assert.Equal(t, ocfg.Compression, configcompression.Zstd)
assert.Equal(t, ocfg.Compression, configcompression.TypeZstd)
assert.Equal(t, ocfg.Arrow, ArrowSettings{
Disabled: false,
NumStreams: runtime.NumCPU(),
Expand Down Expand Up @@ -110,7 +110,7 @@ func TestCreateTracesExporter(t *testing.T) {
config: Config{
ClientConfig: configgrpc.ClientConfig{
Endpoint: endpoint,
Compression: configcompression.Gzip,
Compression: configcompression.TypeGzip,
},
},
},
Expand All @@ -119,7 +119,7 @@ func TestCreateTracesExporter(t *testing.T) {
config: Config{
ClientConfig: configgrpc.ClientConfig{
Endpoint: endpoint,
Compression: configcompression.Snappy,
Compression: configcompression.TypeSnappy,
},
},
},
Expand All @@ -128,7 +128,7 @@ func TestCreateTracesExporter(t *testing.T) {
config: Config{
ClientConfig: configgrpc.ClientConfig{
Endpoint: endpoint,
Compression: configcompression.Zstd,
Compression: configcompression.TypeZstd,
},
},
},
Expand Down
4 changes: 2 additions & 2 deletions testbed/testbed/senders.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (dsb *DataSenderBase) Flush() {

type otlpHTTPDataSender struct {
DataSenderBase
compression configcompression.CompressionType
compression configcompression.Type
}

func (ods *otlpHTTPDataSender) fillConfig(cfg *otlphttpexporter.Config) *otlphttpexporter.Config {
Expand Down Expand Up @@ -114,7 +114,7 @@ type otlpHTTPTraceDataSender struct {
}

// NewOTLPHTTPTraceDataSender creates a new TraceDataSender for OTLP/HTTP traces exporter.
func NewOTLPHTTPTraceDataSender(host string, port int, compression configcompression.CompressionType) TraceDataSender {
func NewOTLPHTTPTraceDataSender(host string, port int, compression configcompression.Type) TraceDataSender {
return &otlpHTTPTraceDataSender{
otlpHTTPDataSender: otlpHTTPDataSender{
DataSenderBase: DataSenderBase{
Expand Down

0 comments on commit 6f353c5

Please sign in to comment.