Skip to content
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

fix(agent): Warn on multple agent configuration tables seen #15402

Merged
merged 2 commits into from
May 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ type Config struct {
Persister *persister.Persister

NumberSecrets uint64

seenAgentTable bool
seenAgentTableOnce sync.Once
}

// Ordered plugins used to keep the order in which they appear in a file
Expand Down Expand Up @@ -516,6 +519,13 @@ func (c *Config) LoadConfigData(data []byte) error {

// Parse agent table:
if val, ok := tbl.Fields["agent"]; ok {
if c.seenAgentTable {
c.seenAgentTableOnce.Do(func() {
log.Printf("W! Overlapping settings in multiple agent tables are not supported: may cause undefined behavior")
})
}
c.seenAgentTable = true

subTable, ok := val.(*ast.Table)
if !ok {
return errors.New("invalid configuration, error parsing agent table")
Expand Down
Loading