Skip to content

Commit 364a3f3

Browse files
authored
Remove two deprecated fields [chore] (#129)
Simply remove two deprecated fields. The v0.13 release includes support for the old and new fields to support migration.
1 parent c43e40a commit 364a3f3

File tree

7 files changed

+19
-74
lines changed

7 files changed

+19
-74
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
66

77
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
88

9+
- Remove two deprecated fields, both concurrent batch processor `max_in_flight_bytes`
10+
and otelarrow receiver `memory_limit` fields have corresponding `_mib` field names
11+
for consistency.
12+
913
## [0.13.0](https://github.com/open-telemetry/otel-arrow/releases/tag/v0.13.0) - 2023-12-20
1014

1115
- Concurrent batch processor: Fail fast for large batch sizes. [#126](https://github.com/open-telemetry/otel-arrow/pull/126)

collector/processor/concurrentbatchprocessor/config.go

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,6 @@ type Config struct {
4848
// MaxInFlightSizeMiB limits the number of bytes in queue waiting to be
4949
// processed by the senders.
5050
MaxInFlightSizeMiB uint32 `mapstructure:"max_in_flight_size_mib"`
51-
52-
// Deprecated: Use MaxInFlightSizeMiB instead.
53-
MaxInFlightBytes uint32 `mapstructure:"max_in_flight_bytes"`
5451
}
5552

5653
var _ component.Config = (*Config)(nil)
@@ -71,19 +68,8 @@ func (cfg *Config) Validate() error {
7168
if cfg.Timeout < 0 {
7269
return errors.New("timeout must be greater or equal to 0")
7370
}
74-
75-
if cfg.MaxInFlightBytes != 0 && cfg.MaxInFlightSizeMiB != 0 {
76-
return errors.New("max_in_flight_bytes is deprecated, use only max_in_flight_size_mib instead")
77-
}
78-
79-
if cfg.MaxInFlightBytes > 0 {
80-
// Round up
81-
cfg.MaxInFlightSizeMiB = (cfg.MaxInFlightBytes - 1 + 1<<20) >> 20
82-
cfg.MaxInFlightBytes = 0
83-
}
84-
85-
if cfg.MaxInFlightSizeMiB < 0 {
86-
return errors.New("max_in_flight_size_mib must be greater than or equal to 0")
71+
if cfg.MaxInFlightSizeMiB <= 0 {
72+
return errors.New("max_in_flight_size_mib must be greater than 0")
8773
}
8874
return nil
8975
}

collector/processor/concurrentbatchprocessor/config_test.go

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,37 +41,41 @@ func TestUnmarshalConfig(t *testing.T) {
4141

4242
func TestValidateConfig_DefaultBatchMaxSize(t *testing.T) {
4343
cfg := &Config{
44-
SendBatchSize: 100,
45-
SendBatchMaxSize: 0,
44+
SendBatchSize: 100,
45+
SendBatchMaxSize: 0,
46+
MaxInFlightSizeMiB: 1,
4647
}
4748
assert.NoError(t, cfg.Validate())
4849
}
4950

5051
func TestValidateConfig_ValidBatchSizes(t *testing.T) {
5152
cfg := &Config{
52-
SendBatchSize: 100,
53-
SendBatchMaxSize: 1000,
53+
SendBatchSize: 100,
54+
SendBatchMaxSize: 1000,
55+
MaxInFlightSizeMiB: 1,
5456
}
5557
assert.NoError(t, cfg.Validate())
5658

5759
}
5860

5961
func TestValidateConfig_InvalidBatchSize(t *testing.T) {
6062
cfg := &Config{
61-
SendBatchSize: 1000,
62-
SendBatchMaxSize: 100,
63+
SendBatchSize: 1000,
64+
SendBatchMaxSize: 100,
65+
MaxInFlightSizeMiB: 1,
6366
}
6467
assert.Error(t, cfg.Validate())
6568
}
6669

6770
func TestValidateConfig_InvalidTimeout(t *testing.T) {
6871
cfg := &Config{
69-
Timeout: -time.Second,
72+
Timeout: -time.Second,
73+
MaxInFlightSizeMiB: 1,
7074
}
7175
assert.Error(t, cfg.Validate())
7276
}
7377

74-
func TestValidateConfig_ValidZero(t *testing.T) {
78+
func TestValidateConfig_InvalidZero(t *testing.T) {
7579
cfg := &Config{}
76-
assert.NoError(t, cfg.Validate())
80+
assert.Error(t, cfg.Validate())
7781
}

collector/receiver/otelarrowreceiver/config.go

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
package otelarrowreceiver // import "github.com/open-telemetry/otel-arrow/collector/receiver/otelarrowreceiver"
55

66
import (
7-
"errors"
87
"fmt"
98

109
"github.com/open-telemetry/otel-arrow/collector/compression/zstd"
@@ -16,7 +15,6 @@ import (
1615
const (
1716
// Confmap values.
1817
protoGRPC = "protocols::grpc"
19-
protoArrowOldMemoryLimit = "protocols::arrow::memory_limit"
2018
protoArrowMemoryLimitMiB = "protocols::arrow::memory_limit_mib"
2119
)
2220

@@ -28,9 +26,6 @@ type Protocols struct {
2826

2927
// ArrowSettings support configuring the Arrow receiver.
3028
type ArrowSettings struct {
31-
// DeprecatedMemoryLimit is deprecated, use MemoryLimitMiB.
32-
DeprecatedMemoryLimit uint64 `mapstructure:"memory_limit"`
33-
3429
// MemoryLimitMiB is the size of a shared memory region used
3530
// by all Arrow streams, in MiB. When too much load is
3631
// passing through, they will see ResourceExhausted errors.
@@ -58,14 +53,6 @@ func (cfg *Config) Validate() error {
5853
}
5954

6055
func (cfg *ArrowSettings) Validate() error {
61-
if cfg.DeprecatedMemoryLimit != 0 && cfg.MemoryLimitMiB != 0 {
62-
return errors.New("memory_limit is deprecated, use only memory_limit_mib")
63-
}
64-
if cfg.DeprecatedMemoryLimit != 0 {
65-
// Round up
66-
cfg.MemoryLimitMiB = (cfg.DeprecatedMemoryLimit - 1 + 1<<20) >> 20
67-
cfg.DeprecatedMemoryLimit = 0
68-
}
6956
if err := cfg.Zstd.Validate(); err != nil {
7057
return fmt.Errorf("zstd decoder: invalid configuration: %w", err)
7158
}
@@ -80,11 +67,5 @@ func (cfg *Config) Unmarshal(conf *confmap.Conf) error {
8067
return err
8168
}
8269

83-
// Allow the deprecated field, when explicitly set, to unset
84-
// the new default value.
85-
if conf.IsSet(protoArrowOldMemoryLimit) && !conf.IsSet(protoArrowMemoryLimitMiB) {
86-
cfg.Arrow.MemoryLimitMiB = 0
87-
}
88-
8970
return nil
9071
}

collector/receiver/otelarrowreceiver/config_test.go

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -39,28 +39,6 @@ func TestUnmarshalConfigOnlyGRPC(t *testing.T) {
3939
assert.Equal(t, defaultOnlyGRPC, cfg)
4040
}
4141

42-
func TestUnmarshalOldMemoryLimitConfig(t *testing.T) {
43-
cm, err := confmaptest.LoadConf(filepath.Join("testdata", "oldmemlimit.yaml"))
44-
require.NoError(t, err)
45-
factory := NewFactory()
46-
cfg := factory.CreateDefaultConfig()
47-
assert.NoError(t, component.UnmarshalConfig(cm, cfg))
48-
expectCfg := factory.CreateDefaultConfig().(*Config)
49-
// The number in config is <1MB, so Validate() rounds up.
50-
expectCfg.Arrow.MemoryLimitMiB = 1
51-
assert.NoError(t, cfg.(*Config).Validate())
52-
assert.Equal(t, expectCfg, cfg)
53-
}
54-
55-
func TestUnmarshalBothMemoryLimitConfig(t *testing.T) {
56-
cm, err := confmaptest.LoadConf(filepath.Join("testdata", "bothmemlimit.yaml"))
57-
require.NoError(t, err)
58-
factory := NewFactory()
59-
cfg := factory.CreateDefaultConfig()
60-
assert.NoError(t, component.UnmarshalConfig(cm, cfg))
61-
assert.Error(t, cfg.(*Config).Validate())
62-
}
63-
6442
func TestUnmarshalConfig(t *testing.T) {
6543
cm, err := confmaptest.LoadConf(filepath.Join("testdata", "config.yaml"))
6644
require.NoError(t, err)

collector/receiver/otelarrowreceiver/testdata/bothmemlimit.yaml

Lines changed: 0 additions & 4 deletions
This file was deleted.

collector/receiver/otelarrowreceiver/testdata/oldmemlimit.yaml

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)