Skip to content

Commit

Permalink
add detailed validation error, update comment
Browse files Browse the repository at this point in the history
  • Loading branch information
jmacd committed Mar 27, 2023
1 parent 01cfea3 commit 518ca6d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions processor/batchprocessor/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package batchprocessor // import "go.opentelemetry.io/collector/processor/batchp

import (
"errors"
"fmt"
"strings"
"time"

Expand All @@ -41,8 +42,8 @@ type Config struct {
// is not empty, one batcher will be used per distinct
// combination of values for the listed metadata keys.
//
// Entries are case-insensitive. Duplicated entries will be
// ignored.
// Entries are case-insensitive. Duplicated entries will
// trigger a validation error.
MetadataKeys []string `mapstructure:"metadata_keys"`
}

Expand All @@ -57,7 +58,7 @@ func (cfg *Config) Validate() error {
for _, k := range cfg.MetadataKeys {
l := strings.ToLower(k)
if _, has := uniq[l]; has {
return errors.New("duplicate entry in metadata_keys")
return fmt.Errorf("duplicate entry in metadata_keys: %s (case-insensitive)", l)
}
uniq[l] = true
}
Expand Down

0 comments on commit 518ca6d

Please sign in to comment.