Skip to content

[component] Make component.Kind a struct #12214

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

Merged
merged 2 commits into from
Jan 31, 2025

Conversation

mx-psi
Copy link
Member

@mx-psi mx-psi commented Jan 30, 2025

Description

Changes the underlying type of component.Kind to be closer to 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

@mx-psi mx-psi added the release:blocker The issue must be resolved before cutting the next release label Jan 30, 2025
@mx-psi mx-psi force-pushed the mx-psi/component-kind-structify branch from 72c0238 to 309bea6 Compare January 30, 2025 17:02
@mx-psi mx-psi marked this pull request as ready for review January 30, 2025 17:06
@mx-psi mx-psi requested a review from a team as a code owner January 30, 2025 17:06
@mx-psi mx-psi requested a review from dmitryax January 30, 2025 17:06
@mx-psi
Copy link
Member Author

mx-psi commented Jan 30, 2025

cc @bogdandrutu do you think we should do this?

@mx-psi mx-psi requested a review from bogdandrutu January 30, 2025 17:07
Copy link

codecov bot commented Jan 30, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.28%. Comparing base (c119b2a) to head (11097f9).
Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #12214      +/-   ##
==========================================
- Coverage   91.28%   91.28%   -0.01%     
==========================================
  Files         465      465              
  Lines       25616    25605      -11     
==========================================
- Hits        23384    23373      -11     
  Misses       1819     1819              
  Partials      413      413              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mx-psi mx-psi added this pull request to the merge queue Jan 31, 2025
Merged via the queue into open-telemetry:main with commit a737a48 Jan 31, 2025
52 of 53 checks passed
@mx-psi mx-psi deleted the mx-psi/component-kind-structify branch January 31, 2025 11:04
sfc-gh-sili pushed a commit to sfc-gh-sili/opentelemetry-collector that referenced this pull request Feb 3, 2025
<!--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 open-telemetry#11443
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:blocker The issue must be resolved before cutting the next release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove GetExtensions from component.Host
2 participants