Commit Graph

13 Commits

Author SHA1 Message Date
Chao Weng 6de29ce169 Add `component.Type` parameter to `NewNopSettings` And deprecate `NewNopSettingsWithType` (#12452)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
Add `component.Type` parameter to `NewNopSettings` And deprecate
`NewNopSettingsWithType` cc @mx-psi

<!-- Issue number if applicable -->
#### Link to tracking issue
Relevant to #12305 

<!--Describe what testing was performed and which tests were added.-->
#### Testing
Updated

<!--Describe the documentation added.-->
#### Documentation
Added

<!--Please delete paragraphs that you did not use before submitting.-->
2025-02-21 11:17:45 +00:00
Pablo Baeyens a4ae175111
[*test] Add NewNopSettingsWithType everywhere (#12357)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

<!-- Issue number if applicable -->

Creates `NewNopSettingsWithType` function on test modules and deprecates
the `NewNopSettings` functions on those modules. Replace all usages of
`NewNopSettings` with `NewNopSettingsWithType`.

Part of #12305 but applied to all component kinds.

#### Link to tracking issue
Updates #12221
2025-02-13 16:56:20 +00:00
Pablo Baeyens 183d7edf9f
[extension] Error out if passed extension.Settings has incorrect type (#12305)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

Explicitly error out if the passed `component.ID` does not have a
matching `component.Type`

<!-- Issue number if applicable -->
#### Link to tracking issue
Updates #12221
2025-02-07 20:15:42 +00:00
Antoine Toulme e8807bfe94
[mdatagen] update other lifecycle generated tests to not be impacted by fieldalignment (#12125)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
update other lifecycle generated tests to not be impacted by
fieldalignment

<!-- Issue number if applicable -->
#### Link to tracking issue
See #12121 for original PR.
2025-01-24 01:30:28 +00:00
Bogdan Drutu 98230db9d3
Deprecate funcs that repeate processor in name (#11310)
Similar with
https://github.com/open-telemetry/opentelemetry-collector/pull/11287

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2024-09-30 15:31:44 -07:00
Alex Boten fbffbb0820
[chore] small test improvements (#11211)
Clean up some inconsistencies in the test code across the components.

Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
2024-09-18 13:47:25 -07:00
Alex Boten 9907ba50df
[processor] deprecate CreateSettings -> Settings (#10336)
This deprecates CreateSettings in favour of Settings.
NewNopCreateSettings is also being deprecated in favour of
NewNopSettings
    
Part of #9428

---------

Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
2024-06-06 09:34:53 -07:00
Antoine Toulme 9a21643a54
[config] Deprecate component.UnmarshalConfig (#9750)
**Description:**
This PR removes the top level if/else in `component.UnmarshalConfig`,
handling recursive state in the confmap.Conf object instead.
This PR deprecates `component.UnmarshalConfig` in favor of calling
directly `Unmarshal` on the confmap.Conf object.

**Link to tracking Issue:**
Fixes #7102
Fixes #7101

---------

Co-authored-by: Evan Bradley <11745660+evan-bradley@users.noreply.github.com>
2024-05-29 11:07:52 +02:00
Dmitrii Anoshin 1f643f4ce1
[cmd/mdatagen] Move component config test from cmd/builder (#9940)
The tests generated by cmd/builder are skipped in contrib because they
cause the CI timeouts. We moved the lifecycle tests to the tests
generated by mdatagen, but the config/factory smoke tests are still part
of the files generated by cmd/builder.

Recently, the loadbalancing exporter got an invalid camelCase config
field because of this coverage gap.

This change moves the config/factory tests from cmd/builder to
cmd/mdatagen. So, they are always generated for every component, even if
not used in any collector bundle.
2024-04-11 10:43:05 -07:00
Antoine Toulme 06f177a66b
Revert "[chore] change the way we unmarshal the config in tests" (#9771)
Reverts open-telemetry/opentelemetry-collector#9765

We need to revert those changes as contrib has issues with them in
isolation from #9750.
2024-03-15 09:54:41 -07:00
Ziqi Zhao ae29878f2c
[cmd/mdatagen] optimize mdatagen for batchprocessor failed test (#9768)
**Description:** 
fix #9688

The batchprocessor use a `batchProcessor` as a common struct which
implements `consumer.Traces`, `consumer.Metrics`, `consumer.Logs` in the
meantime.

As a result, the generated lifecycle test will fail, since when it
create a metrics, traces processor object, it will still fall to the
case `consumer.Logs` and panic.
```
=== RUN   TestComponentLifecycle/metrics-shutdown
=== RUN   TestComponentLifecycle/metrics-lifecycle
panic: interface conversion: interface {} is plog.Logs, not pmetric.Metrics

goroutine 37 [running]:
go.opentelemetry.io/collector/processor/batchprocessor.(*batchMetrics).add(0x14000208120?, {0x10572aae0?, 0x1400029c3f0?})
	/Users/zhaoziqi/Documents/go/src/go.opentelemetry.io/opentelemetry-collector/processor/batchprocessor/batch_processor.go:450 +0x208
go.opentelemetry.io/collector/processor/batchprocessor.(*shard).processItem(0x14000292200, {0x10572aae0?, 0x1400029c3f0?})
	/Users/zhaoziqi/Documents/go/src/go.opentelemetry.io/opentelemetry-collector/processor/batchprocessor/batch_processor.go:226 +0x38
go.opentelemetry.io/collector/processor/batchprocessor.(*shard).start(0x14000292200)
	/Users/zhaoziqi/Documents/go/src/go.opentelemetry.io/opentelemetry-collector/processor/batchprocessor/batch_processor.go:199 +0x1a0
created by go.opentelemetry.io/collector/processor/batchprocessor.(*batchProcessor).newShard in goroutine 36
	/Users/zhaoziqi/Documents/go/src/go.opentelemetry.io/opentelemetry-collector/processor/batchprocessor/batch_processor.go:160 +0x1a4
exit status 2
FAIL	go.opentelemetry.io/collector/processor/batchprocessor	0.594s
```

**Link to tracking Issue:** <Issue number if applicable>
fix #9688

---------

Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>
2024-03-14 23:30:37 -07:00
Antoine Toulme 117ce94f96
[chore] change the way we unmarshal the config in tests (#9765)
This change is required in preparation of #9750 

This removes the call to `component.UnmarshalConfig` in preparation of
its deprecation, and instead has the `Conf` object unmarshal itself into
the `Config` struct.
2024-03-14 13:56:22 -07:00
Dmitrii Anoshin 89dcb87168
[cmd/mdatagen] Pull new changes from contrib (#9683)
To completely migrate mdatagen from contrib to core, we need to pull
latest changes:

-
https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/31500
-
https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/31503
-
https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/31520
-
https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/31525
-
https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/31530
-
https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/31532

---------

Co-authored-by: Alex Boten <223565+codeboten@users.noreply.github.com>
2024-03-04 15:06:12 -08:00