opentelemetry-collector icon indicating copy to clipboard operation
opentelemetry-collector copied to clipboard

Make DataType a separate type within Component

Open ankitpatel96 opened this issue 1 year ago • 5 comments

Description

Followup from https://github.com/open-telemetry/opentelemetry-collector/pull/10069

The end goal of this PR is to separate DataType from Type. DataType becomes an enum for Traces, Logs, and Metrics.

Context (to quote @mx-psi):

A component.ID currently is a pair of component.Type and a (possibly empty) name for the component (e.g. otlp/name). We use the fact that component.DataType is also a component.Type to also use it for pipeline names (e.g. traces/sampled).

To solve this, I introduce a component.PipelineID as suggested by @TylerHelmuth. This PipelineID is very similar to component.ID - it just only lets you use a DataType as the Type.

The PR is large but hundreds of these changes are just changing test files to use a DataType instead of a Type - I swear its not as bad as it looks. Most of the actual changes are in component, connector and service/internal/graph/

Followup Work: I wanted to move PipelineID to service/pipelines - but that would create a circular dependency with InstanceID, which uses PipelineID but lives in component. I want to fix that.

I also want to rename DataType to Signal or something like that, and move it out to its own package.

I didn't do either of those things in this PR since it's already huge.

Link to tracking issue

Fixes https://github.com/open-telemetry/opentelemetry-collector/issues/9429

Testing

Unit tests

ankitpatel96 avatar May 25 '24 18:05 ankitpatel96

Codecov Report

Attention: Patch coverage is 97.89474% with 2 lines in your changes missing coverage. Please review.

Project coverage is 92.53%. Comparing base (effe267) to head (304d0b0). Report is 54 commits behind head on main.

:exclamation: Current head 304d0b0 differs from pull request most recent head c1252e4

Please upload reports for the commit c1252e4 to get more accurate results.

Files Patch % Lines
component/pipeline.go 93.93% 1 Missing and 1 partial :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10222      +/-   ##
==========================================
+ Coverage   92.52%   92.53%   +0.01%     
==========================================
  Files         388      389       +1     
  Lines       18310    18364      +54     
==========================================
+ Hits        16942    16994      +52     
- Misses       1022     1023       +1     
- Partials      346      347       +1     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar May 25 '24 18:05 codecov[bot]

This is changing an API - and it seems like I will have to change contrib in lockstep with this change (bunch of tests are failing). Any advice on how to do that would be welcome!

ankitpatel96 avatar May 29 '24 17:05 ankitpatel96

Requesting review from the reviewers on #10069

mx-psi avatar Jun 05 '24 11:06 mx-psi

I moved InstanceID and PipelineID into a new pipeline module!

ankitpatel96 avatar Jun 12 '24 23:06 ankitpatel96

Bump - would really appreciate a review here before I do another merge to fix all these conflicts

ankitpatel96 avatar Jun 20 '24 18:06 ankitpatel96

. While conceptually I think it is nice, to an end-user this changes nothing. I am concerned about the amount of time we'll spend dealing with this breaking change for what essentially ends up being a rename (a nice rename, but a rename non-the-less.

This may end up being the case, but thinking about this a bit further, before completely abandoning this I personally want to:

  • Define for how long we want to support the Go API on different Go modules
  • Think about how costly different Go API changes will be after 1.0

The first PR related to these two goals is #10539, which will help us then define the support policy for Go API modules.

mx-psi avatar Jul 08 '24 15:07 mx-psi

This PR was marked stale due to lack of activity. It will be closed in 14 days.

github-actions[bot] avatar Jul 23 '24 03:07 github-actions[bot]

Closed as inactive. Feel free to reopen if this PR is still being worked on.

github-actions[bot] avatar Aug 08 '24 03:08 github-actions[bot]