File tree Expand file tree Collapse file tree 6 files changed +4
-16
lines changed Expand file tree Collapse file tree 6 files changed +4
-16
lines changed Original file line number Diff line number Diff line change @@ -125,7 +125,7 @@ func (d *gauge) Unmarshal(parser *confmap.Conf) error {
125125 if err := d .MetricValueType .Unmarshal (parser ); err != nil {
126126 return err
127127 }
128- return parser .Unmarshal (d )
128+ return parser .Unmarshal (d , confmap . WithIgnoreUnused () )
129129}
130130
131131func (d gauge ) Type () string {
@@ -155,7 +155,7 @@ func (d *sum) Unmarshal(parser *confmap.Conf) error {
155155 if err := d .MetricValueType .Unmarshal (parser ); err != nil {
156156 return err
157157 }
158- return parser .Unmarshal (d )
158+ return parser .Unmarshal (d , confmap . WithIgnoreUnused () )
159159}
160160
161161// TODO: Currently, this func will not be called because of https://github.com/open-telemetry/opentelemetry-collector/issues/6671. Uncomment function and
Original file line number Diff line number Diff line change @@ -107,7 +107,7 @@ func (c *Config) Unmarshal(component *confmap.Conf) error {
107107 }
108108
109109 builder := builderFunc ()
110- if err := component .Unmarshal (builder ); err != nil {
110+ if err := component .Unmarshal (builder , confmap . WithIgnoreUnused () ); err != nil {
111111 return fmt .Errorf ("unmarshal to %s: %w" , typeString , err )
112112 }
113113
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ type TimeParser struct {
4848// Unmarshal starting from default settings
4949func (t * TimeParser ) Unmarshal (component * confmap.Conf ) error {
5050 cfg := NewTimeParser ()
51- err := component .Unmarshal (& cfg )
51+ err := component .Unmarshal (& cfg , confmap . WithIgnoreUnused () )
5252 if err != nil {
5353 return err
5454 }
Original file line number Diff line number Diff line change @@ -35,10 +35,6 @@ func TestConfig(t *testing.T) {
3535 return cfg
3636 }(),
3737 },
38- {
39- Name : "no_nested" ,
40- ExpectErr : true ,
41- },
4238 },
4339 }.Run (t )
4440}
Original file line number Diff line number Diff line change @@ -46,10 +46,6 @@ func TestUnmarshal(t *testing.T) {
4646 return cfg
4747 }(),
4848 },
49- {
50- Name : "no_nested" ,
51- ExpectErr : true ,
52- },
5349 },
5450 }.Run (t )
5551}
Original file line number Diff line number Diff line change @@ -49,10 +49,6 @@ func TestUnmarshal(t *testing.T) {
4949 return cfg
5050 }(),
5151 },
52- {
53- Name : "no_nested" ,
54- ExpectErr : true ,
55- },
5652 },
5753 }.Run (t )
5854}
You can’t perform that action at this time.
0 commit comments