Skip to content
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

[connector,exporter,processor,receiver] Error out on mismatched type #12381

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

mx-psi
Copy link
Member

@mx-psi mx-psi commented Feb 13, 2025

Description

Error out on mismatched type for all component kinds. Same as #12305 but for all component kinds.

Link to tracking issue

Requires #12357
Fixes #12221

@mx-psi mx-psi marked this pull request as ready for review February 14, 2025 12:55
@mx-psi mx-psi requested a review from a team as a code owner February 14, 2025 12:55
Copy link

codecov bot commented Feb 14, 2025

Codecov Report

Attention: Patch coverage is 12.90323% with 54 lines in your changes missing coverage. Please review.

Project coverage is 91.90%. Comparing base (6de29ce) to head (3676dd8).

Files with missing lines Patch % Lines
connector/connector.go 0.00% 18 Missing and 9 partials ⚠️
exporter/exporter.go 0.00% 6 Missing and 3 partials ⚠️
processor/processor.go 0.00% 6 Missing and 3 partials ⚠️
receiver/receiver.go 0.00% 6 Missing and 3 partials ⚠️

❌ Your patch check has failed because the patch coverage (12.90%) is below the target coverage (95.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #12381      +/-   ##
==========================================
- Coverage   92.09%   91.90%   -0.20%     
==========================================
  Files         465      465              
  Lines       25173    25227      +54     
==========================================
  Hits        23184    23184              
- Misses       1592     1628      +36     
- Partials      397      415      +18     

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

Copy link
Member

@bogdandrutu bogdandrutu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make sure we have tests for all the main use-cases.

mx-psi added a commit to open-telemetry/opentelemetry-collector-contrib that referenced this pull request Feb 19, 2025
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

Tries to fix some of the contrib tests for
open-telemetry/opentelemetry-collector/pull/12381

<!-- Issue number (e.g. #1234) or full URL to issue, if applicable. -->
#### Link to tracking issue

Updates open-telemetry/opentelemetry-collector/issues/12221
@mx-psi
Copy link
Member Author

mx-psi commented Feb 19, 2025

@bogdandrutu The remaining contrib failures are interesting. We have quite a few components that use other components under the hood. A couple of examples (but there a few more):

  1. The simple Prometheus receiver uses the Prometheus receiver and has a simplified configuration
  2. The JMX receiver uses an OTLP receiver under the hood

How should these components use the API? I think this is also interesting for telemetry: if a component creates other components under the hood, what should its telemetry look like? cc @djaglowski @jade-guiton-dd in case you have thoughts about this

@jade-guiton-dd
Copy link
Contributor

jade-guiton-dd commented Feb 19, 2025

  • Regarding telemetry:

    The component-related attributes defined in the RFC only really work within the context of a standard Collector pipeline (because of otelcol.pipeline.id) and configuration (because of the "config name" part of otelcol.component.id), so I think components that are created manually and used as part of an opaque "sub-pipeline" like that should just inherit the attributes of their containing component. This should happen by default with Wrap TelemetrySettings providers to add component-identifying attributes #12384 as long as the parent component passes the TelemetrySettings they received.

  • Regarding the API:

    I'm not sure if this kind of "sub-pipeline" should be considered a supported use case of components, so I think the onus should be on component authors to manually adjust the settings passed into the child component to make it work, in this case manually adjusting the component ID.

    If we DO want to support this use case, I think the best way would be some kind of API to create a "derived" receiver/exporter/etc.Settings with the appropriate values for the child component, instead of parents passing their own as-is. We could then adjust the ID accordingly. In the context of component telemetry, we could also add additional extra attributes to identify the source as a child component.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[extension/receiver/exporter/processor/connector] Should we remove component.Type from Settings.ID?
3 participants