Skip to content

Commit

Permalink
matching code rewritten
Browse files Browse the repository at this point in the history
  • Loading branch information
braydonk committed May 28, 2024
1 parent 33983f5 commit 3f0a4e8
Show file tree
Hide file tree
Showing 3 changed files with 806 additions and 356 deletions.
24 changes: 12 additions & 12 deletions cmd/mdatagen/templates/config.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ func (msc *MetricsConfig) Unmarshal(parser *confmap.Conf) error {
if parser == nil {
return nil
}
if ContainsPattern(parser.AllKeys()) {
confStrMap := parser.ToStringMap()
expandedConfig := ExpandPatternMap(confStrMap, MetricNames)
newParser := confmap.NewFromStringMap(expandedConfig)
return newParser.Unmarshal(msc)
confStrMap := parser.ToStringMap()
expandedConfig, err := expandPatternMap(confStrMap, MetricNames)
if err != nil {
return err
}
return parser.Unmarshal(msc)
newParser := confmap.NewFromStringMap(expandedConfig)
return newParser.Unmarshal(msc)
}
{{- end }}

Expand Down Expand Up @@ -122,13 +122,13 @@ func (rasc *ResourceAttributesConfig) Unmarshal(parser *confmap.Conf) error {
if parser == nil {
return nil
}
if ContainsPattern(parser.AllKeys()) {
confStrMap := parser.ToStringMap()
expandedConfig := ExpandPatternMap(confStrMap, ResourceAttributeNames)
newParser := confmap.NewFromStringMap(expandedConfig)
return newParser.Unmarshal(rasc)
confStrMap := parser.ToStringMap()
expandedConfig, err := expandPatternMap(confStrMap, ResourceAttributeNames)
if err != nil {
return err
}
return parser.Unmarshal(rasc)
newParser := confmap.NewFromStringMap(expandedConfig)
return newParser.Unmarshal(rasc)
}
{{- end }}

Expand Down
Loading

0 comments on commit 3f0a4e8

Please sign in to comment.