-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Add custom suffix to identifiers in filestream input when needed #26669
Changes from all commits
a15739e
d4182cb
481b1af
17ba1a7
61ed885
016031b
9947984
ba77a50
d14cfb1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,6 +49,8 @@ type CommonConfig struct { | |
} | ||
|
||
type Config struct { | ||
Suffix string | ||
|
||
pCfg CommonConfig | ||
parsers []common.ConfigNamespace | ||
} | ||
|
@@ -79,6 +81,7 @@ func (c *Config) Unpack(cc *common.Config) error { | |
} | ||
|
||
func NewConfig(pCfg CommonConfig, parsers []common.ConfigNamespace) (*Config, error) { | ||
var suffix string | ||
for _, ns := range parsers { | ||
name := ns.Name() | ||
switch name { | ||
|
@@ -103,12 +106,19 @@ func NewConfig(pCfg CommonConfig, parsers []common.ConfigNamespace) (*Config, er | |
if err != nil { | ||
return nil, fmt.Errorf("error while parsing container parser config: %+v", err) | ||
} | ||
if config.Stream != readjson.All { | ||
if suffix != "" { | ||
return nil, fmt.Errorf("only one stream selection is allowed") | ||
} | ||
suffix = config.Stream.String() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What if suffix (the stream) is already set? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Only one suffix is supported at the moment. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe we should error then. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have added an error. |
||
} | ||
default: | ||
return nil, fmt.Errorf("%s: %s", ErrNoSuchParser, name) | ||
} | ||
} | ||
|
||
return &Config{ | ||
Suffix: suffix, | ||
pCfg: pCfg, | ||
parsers: parsers, | ||
}, nil | ||
|
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.
maybe we want to name this field
stream
?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 named it
Suffix
because from outside it is the string that is supposed to be added to the end of the state IDs. It does not matter if it contains a stream name or emojis describing the weather. The only thing that is relevant that it is a suffix.