Skip to content

Conversation

@jmacd
Copy link
Contributor

@jmacd jmacd commented Nov 17, 2025

Description

Aims to fix the contrib build following open-telemetry/opentelemetry-collector#14155.

@jmacd jmacd changed the title [WIP] Upgrade for "Use configoptional.Optional for exporterhelper QueueBatchConfig" Upgrade for "Use configoptional.Optional for exporterhelper QueueBatchConfig" Nov 25, 2025
Copy link
Contributor

@axw axw left a 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
Copy link
Contributor

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)
Copy link
Contributor

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")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
fmt.Println("DANGER DANGER")

high voltage!

qbCfg.MaxSize = int64(cfg.Flush.Bytes)
}
}
fmt.Println("END (DANGER DANGER)")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
fmt.Println("END (DANGER DANGER)")

cm, err := confmaptest.LoadConf(filepath.Join("testdata", tt.configFile))
require.NoError(t, err)

fmt.Println("START HERE")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
fmt.Println("START HERE")

fmt.Println("START HERE")
sub, err := cm.Sub(tt.id.String())
require.NoError(t, err)
fmt.Println("ONE CALL")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
fmt.Println("ONE CALL")

require.NoError(t, err)
fmt.Println("ONE CALL")
require.NoError(t, sub.Unmarshal(cfg))
fmt.Println("FINISH")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
fmt.Println("FINISH")

Comment on lines 430 to 433

fmt.Println("HEY", cfg.(*Config).QueueBatchConfig.HasValue())
fmt.Println("BATCH", cfg.(*Config).QueueBatchConfig.HasValue())

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
fmt.Println("HEY", cfg.(*Config).QueueBatchConfig.HasValue())
fmt.Println("BATCH", cfg.(*Config).QueueBatchConfig.HasValue())

Copy link
Contributor

@MovieStoreGuy MovieStoreGuy left a 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?

@mx-psi
Copy link
Member

mx-psi commented Nov 25, 2025

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?

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

If this configuration type hinting for users, wouldn't struct tags be easier to adopt and less of a breaking change?

Struct tags do not allow for custom unmarshaling behavior which is necessary for some use cases of configoptional

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants