-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Upgrade for "Use configoptional.Optional for exporterhelper QueueBatchConfig" #44320
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
base: main
Are you sure you want to change the base?
Conversation
axw
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall.
|
|
||
| replace github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/ecsutil => ../../internal/aws/ecsutil | ||
|
|
||
| replace go.opentelemetry.io/config/configoptional => /home/jmacd/src/otel/opentelemetry-collector/config/configoptional |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needs reverting
|
|
||
| // Wrap async implementation of sendMetricsAsync into a sync-callable API. | ||
| s.sync2Async = internal.NewSync2Async(s.set.Logger, s.cfg.QueueConfig.NumConsumers, s.sendMetricsAsync) | ||
| s.sync2Async = internal.NewSync2Async(s.set.Logger, s.cfg.QueueConfig.Get().NumConsumers, s.sendMetricsAsync) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Get() will return nil if the config is unset, right? So does this need changing to prevent a nil dereference panic?
| } | ||
| if cfg.QueueBatchConfig.Batch.HasValue() { | ||
| qbCfg := cfg.QueueBatchConfig.Batch.Get() | ||
| fmt.Println("DANGER DANGER") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| fmt.Println("DANGER DANGER") |
high voltage!
| qbCfg.MaxSize = int64(cfg.Flush.Bytes) | ||
| } | ||
| } | ||
| fmt.Println("END (DANGER DANGER)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| fmt.Println("END (DANGER DANGER)") |
| cm, err := confmaptest.LoadConf(filepath.Join("testdata", tt.configFile)) | ||
| require.NoError(t, err) | ||
|
|
||
| fmt.Println("START HERE") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| fmt.Println("START HERE") |
| fmt.Println("START HERE") | ||
| sub, err := cm.Sub(tt.id.String()) | ||
| require.NoError(t, err) | ||
| fmt.Println("ONE CALL") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| fmt.Println("ONE CALL") |
| require.NoError(t, err) | ||
| fmt.Println("ONE CALL") | ||
| require.NoError(t, sub.Unmarshal(cfg)) | ||
| fmt.Println("FINISH") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| fmt.Println("FINISH") |
|
|
||
| fmt.Println("HEY", cfg.(*Config).QueueBatchConfig.HasValue()) | ||
| fmt.Println("BATCH", cfg.(*Config).QueueBatchConfig.HasValue()) | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| fmt.Println("HEY", cfg.(*Config).QueueBatchConfig.HasValue()) | |
| fmt.Println("BATCH", cfg.(*Config).QueueBatchConfig.HasValue()) |
MovieStoreGuy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure I understand why there some types are being marked as optional like QueueSettings, when there is always a default being applied?
If this configuration type hinting for users, wouldn't struct tags be easier to adopt and less of a breaking change?
We want to have a consistent way of enabling and disabling an optional section, there were, for the most part, two mechanisms (otlp receiver protocols section and enabled), we are trying to be consistent by representing this in the same way everywhere
Struct tags do not allow for custom unmarshaling behavior which is necessary for some use cases of configoptional |
Description
Aims to fix the contrib build following open-telemetry/opentelemetry-collector#14155.