Commit Graph

61 Commits

Author SHA1 Message Date
Pablo Baeyens a737a48402
[component] Make component.Kind a struct (#12214)
<!--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 -->
Changes the underlying type of `component.Kind` to be closer to
[`pipeline.Signal`](https://pkg.go.dev/go.opentelemetry.io/collector/pipeline#Signal).
Right now the type is defined within `component`, but it could be moved
to an internal module so that we could have a different module exposing
other value on this enum.

This is already doable today, the only thing this PR gives us is 
1. slightly more flexibility on things like making the concept of kind
more complex (e.g. adding an adjective to a kind).
2. restricting external consumers from implementing their own component
kinds without our explicit approval (with some kind of API we design)

I am not convinced this is _necessary_ to do, but we may as well do it.

This is technically a breaking change since `component.Kind(42)` was a
valid expression and it no longer is. I think this is extremely rare, so
I suggest if we go ahead we do so in one go.

#### Link to tracking issue
Fixes #11443
2025-01-31 10:46:36 +00:00
Alex Boten 164c28a60e
update time period before removing an unmaintained component (#11664)
After reviewing the 6 month period, the period seems too long to get
feedback on whether an unmaintained component should be removed. I'm
proposing shortening it to 3 months.

---------

Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
2024-11-13 09:38:22 -08:00
Pablo Baeyens dd8080d678
[chore][cmd/mdatagen] Fix generated links to stability levels (#11573)
<!--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 -->

Forgot to do this on #11561
2024-10-30 15:36:31 +01:00
Bogdan Drutu 98975742d6
Add UnmarshalText for StabilityLevel (#11520)
This PR also starts using the fact that StabilityLevel implements
UnmarshalText and cleans up the mdatagen stability structure.

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2024-10-23 10:18:14 -07:00
Bogdan Drutu 57e59d192f
[chore] Add tests for Stability LogMessage, small nit in switch (#11522)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2024-10-23 08:01:24 -07:00
Tyler Helmuth dfa6b6ee62
[component] Remove deprecated DataType (#11253)
#### Description

Continues the switch to use `pipeline.ID` and `pipeline.Signal`.
- Removes deprecated code
- Continues rename process for function/type changes.

#### Link to tracking issue
Related to
https://github.com/open-telemetry/opentelemetry-collector/issues/9429
2024-10-01 13:27:29 -07:00
Tyler Helmuth 77bb849aa0
[component] Refactor to use pipeline.ID and pipeline.Signal (#11204)
#### Description
Depends on
https://github.com/open-telemetry/opentelemetry-collector/pull/11209

This PR is a non-breaking implementation of
https://github.com/open-telemetry/opentelemetry-collector/pull/10947. It
adds a new module, `pipeline`, which houses a `pipeline.ID` and
`pipeline.Signal`. `pipeline.ID` is used to identify a pipeline within
the service. `pipeline.Signal` is uses to identify the signal associated
to a pipeline.

I do this work begrudgingly. As the PR shows, this is a huge refactor
when done in a non-breaking way, will require 3 full releases, and
doesn't benefit our [End Users or, in my opinion, our Component
Developers or Collector Library
Users](https://github.com/open-telemetry/opentelemetry-collector/blob/main/CONTRIBUTING.md#target-audiences).
I view this refactor as a Nice-To-Have, not a requirement for Component
1.0.

<!-- Issue number if applicable -->
#### Link to tracking issue
Works towards
https://github.com/open-telemetry/opentelemetry-collector/issues/9429
2024-09-23 07:38:59 -07:00
Tyler Helmuth 6b57a75ad4
[component] Remove incorrect comment on Factory interface (#11017)
#### Description
Removes an incorrect comment from the `component.Factory interface`.

This comment was added via
https://github.com/open-telemetry/opentelemetry-collector/pull/4338 when
the extension/receiver/processor/exporter factory types all still [lived
in](b4be13e749/component/exporter.go (L61))
`component`. Since the factories have been moved to other modules,
`component.Factory` needs to be implementable.

The specific extension/receiver/processor/exporter factory types are
unimplementable since they are defined in internal packages.

<!-- Issue number if applicable -->
#### Link to tracking issue
Related to
https://github.com/open-telemetry/opentelemetry-collector/issues/6506
2024-08-30 16:42:47 +02:00
Tyler Helmuth cb24d0c7d7
[component] Remove ReportStatus from component.TelemetrySettings (#10777)
#### Description

This PR removes `ReportStatus` from `component.TelemetrySettings` and
instead expects components to check if their `component.Host` implements
a new `componentstatus.Reporter` interface.

<!-- Issue number if applicable -->
#### Link to tracking issue
Related to
https://github.com/open-telemetry/opentelemetry-collector/pull/10725
Related to
https://github.com/open-telemetry/opentelemetry-collector/pull/10413

<!--Describe what testing was performed and which tests were added.-->
#### Testing
unit tests and a sharedinstance e2e test.

The contrib tests will fail because this is a breaking change. If we
merge this I and @mwear can commit to updating contrib before the next
release.

---------

Co-authored-by: Pablo Baeyens <pablo.baeyens@datadoghq.com>
2024-08-16 09:27:01 +02:00
Antoine Toulme b6bdc4ee5b
[chore] fix some typos and a use of deprecated Go API (#10347) 2024-06-06 08:04:30 -07:00
Ankit Patel ecdbb535c7
Documentation improvements - Internal Architecture Doc + Package level comments (#10068)
<!--Describe the documentation added.-->
#### Documentation
Creates an internal architecture file. In it is a diagram of the startup
flow of the collector as well as links to key files / packages. I also
added package level comments to some key packages.

I wrote some other documentation in
https://github.com/open-telemetry/opentelemetry-collector/pull/10029 but
split the PRs up.

---------

Co-authored-by: Pablo Baeyens <pbaeyens31+github@gmail.com>
2024-05-20 22:33:02 +02:00
Antoine Toulme 4df2af26aa
[component] Remove deprecated error `ErrNilNextConsumer` (#9779)
**Description:** 
Remove deprecated error `ErrNilNextConsumer`

**Link to tracking Issue:**
Fixes #9322
2024-03-19 18:52:57 -07:00
Antoine Toulme 08a692279c
[component] Deprecate ErrNilNextConsumer (#9526)
**Description:**
Deprecate ErrNilNextConsumer and implement nil checks in the builder
structs.
2024-02-23 13:54:46 -08:00
Bogdan Drutu df8aaaec98
Fix connector logger zap kind key (#8878)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2023-11-13 21:40:15 -08:00
Matthew Wear 53615832e6
Component Status Reporting (#8169)
This PR introduces component status reporting. There have been several
attempts to introduce this functionality previously, with the most
recent being: #6560.

This PR was orignally based off of #6560, but has evolved based on the
feedback received and some additional enhancements to improve the ease
of use of the `ReportComponentStatus` API.

In earlier discussions (see
https://github.com/open-telemetry/opentelemetry-collector/pull/8169#issuecomment-1668367246)
we decided to model status as a finite state machine with the following
statuses: `Starting`, `OK`, `RecoverableError`, `PermanentError`,
`FatalError`. `Stopping`, and `Stopped`. A benefit of this design is
that `StatusWatcher`s will be notified on changes in status rather than
on potentially repetitive reports of the same status.

With the additional statuses and modeling them using a finite state
machine, there are more statuses to report. Rather than having each
component be responsible for reporting all of the statuses, I automated
status reporting where possible. A component's status will automatically
be set to `Starting` at startup. If the components `Start` returns an
error, the status will automatically be set to `PermanentError`. A
component is expected to report `StatusOK` when it has successfully
started (if it has successfully started) and from there can report
changes in status as it runs. It will likely be a common scenario for
components to transition between `StatusOK` and `StatusRecoverableError`
during their lifetime. In extenuating circumstances they can transition
into terminal states of `PermanentError` and `FatalError` (where a fatal
error initiates collector shutdown). Additionally, during component
Shutdown statuses are automatically reported where possible. A
component's status is set to `Stopping` when Shutdown is initially
called, if Shutdown returns an error, the status will be set to
`PermanentError` if it does not return an error, the status is set to
`Stopped`.

In #6560 ReportComponentStatus was implemented on the `Host` interface.
I found that few components use the Host interface, and none of them
save a handle to it (to be used outside of the `start` method). I found
that many components keep a handle to the `TelemetrySettings` that they
are initialized with, and this seemed like a more natural, convenient
place for the `ReportComponentStatus` API. I'm ultimately flexible on
where this method resides, but feel that `TelemetrySettings` a more user
friendly place for it.

Regardless of where the `ReportComponentStatus` method resides (Host or
TelemetrySettings), there is a difference in the method signature for
the API based on whether it is used from the service or from a
component. As the service is not bound to a specific component, it needs
to take the `instanceID` of a component as a parameter, whereas the
component version of the method already knows the `instanceID`. In #6560
this led to having both `component.Host` and `servicehost.Host` versions
of the Host interface to be used at the component or service levels. In
this version, we have the same for TelemetrySettings. There is a
`component.TelemetrySettings` and a `servicetelemetry.Settings` with the
only difference being the method signature of `ReportComponentStatus`.

Lastly, this PR sets up the machinery for report component status, and
allows extensions to be `StatusWatcher`s, but it does not introduce any
`StatusWatcher`s. We expect the OpAMP extension to be a `StatusWatcher`
and use data from this system as part of its AgentHealth message (the
message is currently being extended to accommodate more component level
details). We also expect there to be a non-OpAMP `StatusWatcher`
implementation, likely via the HealthCheck extension (or something
similiar).

**Link to tracking Issue:** #7682

cc: @tigrannajaryan @djaglowski @evan-bradley

---------

Co-authored-by: Tigran Najaryan <tnajaryan@splunk.com>
Co-authored-by: Pablo Baeyens <pbaeyens31+github@gmail.com>
Co-authored-by: Daniel Jaglowski <jaglows3@gmail.com>
Co-authored-by: Evan Bradley <11745660+evan-bradley@users.noreply.github.com>
Co-authored-by: Tigran Najaryan <4194920+tigrannajaryan@users.noreply.github.com>
Co-authored-by: Alex Boten <aboten@lightstep.com>
2023-10-06 11:35:38 -07:00
Alex Boten 80d704deb4
[chore] use license shortform (#7694)
* [chore] use license shortform

To remain consistent w/ contrib repo, see https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/22052

Signed-off-by: Alex Boten <aboten@lightstep.com>

* make goporto

Signed-off-by: Alex Boten <aboten@lightstep.com>

---------

Signed-off-by: Alex Boten <aboten@lightstep.com>
2023-05-18 13:11:17 -07:00
Bogdan Drutu 1bfb1804fb
Continue to disallow directly implementing Factories, but allow it for component.Factory (#6962)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2023-01-24 09:50:47 -08:00
Bogdan Drutu 1028e3d2a2
Deprecate special Configs for each component type, use a standard opaque Config (#6617)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2022-11-23 15:02:54 -08:00
Daniel Jaglowski c914964600
Define new component type "connector" (#6577)
This establishes the new component type without including anything
specific about the design of connectors.
2022-11-22 21:32:18 -08:00
Bogdan Drutu 5b004ba32c
Remove deprecated func/types from component (#6606)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2022-11-22 16:25:10 -08:00
Dmitrii Anoshin 4bb55bc1fa
[component] Rename "In development" stability level to "Development" (#6561) 2022-11-16 09:48:18 -08:00
Dmitrii Anoshin 65dfc325d9
[component] Update values returned by `StabilityLevel.String` method (#6531)
This change updates values returned by `StabilityLevel.String` to be consistent with other enum types:
  - All returned strings are capitalized.
  - "Undefined" is returned only for `StabilityLevelUndefined`.
  - "" is returned for integers that are out of StabilityLevel enum range.
2022-11-15 18:13:22 -08:00
Sean Marciniak ee05613162
[component] clarifying lifecycle expectation (#6535)
Extended the documentation of the component to include safe Shutdown expectations.

Co-authored-by: Alex Boten <alex@boten.ca>
2022-11-15 17:23:52 -08:00
Bogdan d6ed8246b6 Deprecate all types and funcs in config package
The main reason is to remove the circular dependency between the config (including sub-packages) and component. Here is the current state:
* component depends on config
* config/sub-package[grpc, http, etc.] depends on config & component

Because of this "circular" dependency, we cannot split for example "config" into its own module, only if all the other config sub-packages are also split.

Signed-off-by: Bogdan <bogdandrutu@gmail.com>
2022-11-05 10:04:49 -07:00
Bogdan Drutu fdf4885c90
Remove deprecated funcs from component (#5917)
Signed-off-by: Bogdan <bogdandrutu@gmail.com>

Signed-off-by: Bogdan <bogdandrutu@gmail.com>
2022-08-16 10:48:19 -07:00
Bogdan Drutu 186077db7a
Define a new API for components stability level to match extensions as well (#5762)
Signed-off-by: Bogdan <bogdandrutu@gmail.com>
2022-08-03 10:13:31 -07:00
Alex Boten f513448463
add go 1.19 to tests (#5791)
Adding the latest version of go to the tests run by CI. To pass the tests, the following changes were required:
- run make genpdata
- fix test certificates to address errors caused by the rejection of duplicate extensions in TLS handshakes
2022-08-03 09:55:10 -07:00
Bogdan Drutu b2dc376cca
Small fixes in the new StabilityLevel feature (#5763)
* Make the enum values same type as the enum type
* Use config.DataType everywhere

Signed-off-by: Bogdan <bogdandrutu@gmail.com>
2022-08-01 12:00:47 -07:00
Alex Boten 6266e5b515
add LogMessage and move LogStabilityLevel (#5633)
* add LogMessage and move LogStabilityLevel

This change will make the func available for extensions as well.

* add docstring

* fix typo

* fix impi

* apply review feedback
2022-07-13 05:39:59 -07:00
Alex Boten 9f0d97ca57
add stability level to component factory (#5580)
* add stability level to component factory

* update docstring

* use a map instead of a single stability level

* apply review feedback

* add tests

* fix impi, add changelog

* add processors, receivers

* fix inconsistency

* set noop to stable

* update calls in deprecated func
2022-07-05 14:02:23 -07:00
Bogdan Drutu e6b5cd54d1
Deprecate componenterror package, move to component (#5383)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2022-05-17 17:18:08 -07:00
Bogdan Drutu 6c1f5e7f72
Remove use of unnecessary internal interface in factory (#4920)
* Remove use of unnecessary internal interface in factory

This PR does not change the design (which is to not allow external implementation),
but simplifies the way how this is achieved, now that the helpers are in the same package.

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>

* Use baseFactory to implement Type() func

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2022-02-25 09:55:09 -08:00
Bogdan Drutu c4134ba6f3
Add the StartFunc/ShutdownFunc to component directly (#4803)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2022-02-18 11:29:49 -08:00
Pablo Baeyens 9631ceabb7
Make `component.Factory` inherit `internalinterface.InternalInterface` (#4338)
* Make `component.Factory` inherit `internalinterface.InternalInterface`

* Add changelog entry

* Add comment on `component.Factory`
2021-11-02 12:09:32 -07:00
José Carlos Chávez 9d3a8a4608
Adds vanity import check (#4180)
* chore: adds porto and fixes vanity imports.

* chore: fixes target overriding.

* chore: fixes install of porto.

* chore: includes porto as a tool.

* chore: upgrades porto to check internals.

* chore: rebase and update vanity import.

* chore: removes unnecessary space.

* chore: rollsback vanity import in generated files.
2021-10-12 13:47:36 -07:00
Bryan Uribe 6cbf7e3134
Improve component package docs (#3305)
* added doc.go file for component package

* added description for package componenthelper

* fixed comment for Shutdown

* added default build info for readability in go docs

* added doc.go for componenterror

* added doc.go for componenthelper

* added newline

* fixed grammar in descriptions

* added newline in componenthelper/doc.go

* added an

* fixed format error

* updated component package comments

* addressing lint error
2021-06-07 02:34:16 -07:00
Bryan Uribe ed7d203bfb
Review component package grammar (#3303)
* fixed grammar in processor.go

* fixed grammar in receiver.go

* fixed spelling

* modified component.go

* modified exporter.go

* fixed host.go

* fixed grammar in processor.go

* fixed grammar in component.go

* fixed grammar in exporter.go

* fixed grammar in extension.go

* fixed format error

* fixed lint errors in component.go
2021-06-02 01:08:39 -07:00
Jaana Dogan 4ada46a381
Fix godoc wording and inconsistencies (#3015)
* Fix godoc wording and inconsistencies

1. Move the component lifecycle to interface godoc so the godoc can render it
2. Avoid using below/above, godoc already groups things correctly.
3. Avoid giving references to what functions/methods implement what. Instead, mention what they do.
4. Fix inconsistencies in new lines for long lines.

* Update component/receiver.go

Co-authored-by: Tigran Najaryan <4194920+tigrannajaryan@users.noreply.github.com>

* Update component/receiver.go

Co-authored-by: Tigran Najaryan <4194920+tigrannajaryan@users.noreply.github.com>

* Update component/receiver.go

Co-authored-by: Tigran Najaryan <4194920+tigrannajaryan@users.noreply.github.com>

* Update component/receiver.go

Co-authored-by: Tigran Najaryan <4194920+tigrannajaryan@users.noreply.github.com>

Co-authored-by: Tigran Najaryan <4194920+tigrannajaryan@users.noreply.github.com>
2021-04-30 15:27:05 -07:00
Pablo Baeyens a31ad5bf6c
Move Unmarshaler interface to Config instead of Factory (#2867)
* Make custom unmarshaling a config interface

If a component wants custom unmarshaling they need to add an
Unmarshal method to their Config struct instead of providing
it through the factory.

* Add interface assert for unmarshable configurations

* Document Unmarshal methods

* Mention that config.Unmarshable is an optional interface.

* Use config.Parser on config.Unmarshable interface
Move customUnmarshaler implementation to Unmarshal

* Deprecate factory unmarshaler interface

* Amend comment

* Empty commit to retrigger CI

* Add deprecation comment

* Revert previous commits

Revert "Add deprecation comment"

This reverts commit 4e10ec27f2.

Revert "Amend comment"

This reverts commit ab5ae0af76.

Revert "Deprecate factory unmarshaler interface"

This reverts commit e33c788d55.

* Add fallback to use deprecatedUnmarshaler

* Rename config.Unmarshable to config.CustomUnmarshable; update docs

* Empty commit to retrigger CI
2021-04-12 07:45:45 -07:00
Bogdan Drutu e7c74eb2fd
Move configmodels to config (#2808)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-03-26 12:14:35 -07:00
Tigran Najaryan 3b1392387b
Clarify Component lifecycle (#2757)
This clarifies the phases of the lifecycle of Component.
2021-03-22 11:17:26 -07:00
Bogdan Drutu 294c38935f
Split host definition into its own file (#2652)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-03-10 10:45:31 -08:00
Bogdan Drutu 2f38767f72
Remove TestApplicationStartInfo, add a DefaultApplicationStartInfo (#2595)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-03-05 12:52:23 -08:00
Bogdan Drutu 006d7b5988
Do not expose entire config in the Host API (#2589)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-03-05 12:11:24 -08:00
Bogdan Drutu 7cdbd1caab
Rename ServiceExtension to just Extension (#2581)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-03-05 11:26:49 -08:00
José Carlos Chávez 0ed7a4c2ac
docs(component): improves the documentation to clarify that components should not accept anymore data on shutdown (#2481). (#2504)
Clarifies that components should not accept anymore data on shutdown 

Closes #2481
2021-02-23 15:03:03 -05:00
José Carlos Chávez c7bf897810
docs(component): improves the documentation to clarify that buffers need to be cleared and data sent to the next component on shutdown (#2443). (#2480) 2021-02-13 13:17:31 -08:00
Bogdan Drutu 0f1d528827
Clarify that context passed to start should not be reused (#1754)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-09-11 11:30:32 -07:00
James Bebbington c8641eea6e
Pass version (& other app info) into components in params struct (#1582)
* Pass Version into components in params struct

* Add TestApplicationStartInfo function
2020-08-24 20:03:07 -07:00
Jay Camp 1e65674799
Update copyright (#1597)
* Update copyright

* rebase
2020-08-19 18:25:44 -07:00