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

Changed how the telemetryInitializer is created #6138

Merged

Conversation

cpheps
Copy link
Contributor

@cpheps cpheps commented Sep 22, 2022

Description:
Changed how the telemetryInitializer is created. Previously only a single instance of the telemetryInitializer was created for a process. The caused an issue if a Collector instance was shutdown and a new one was created the new instance would get the global instance that was shutdown as a result of the first Collector instance being shutdown.

The new logic ensures the feature gate is only registered once but a new telemetryInitializer instance is created per instance of the collector.

Link to tracking Issue:
Tangentially related to #5084.

In that issue the desired design is:

I think we are going to the direction to follow the language pattern which is after Shutdown you cannot call Run on the same instance, you have to create a new instance.

I believe this respects that design and fixes a bug where a new instance could not fully startup with the same expectations as the previous instance.

Testing:
Modified unit tests. Also, tested with our OPAMP enabled agent and server to verify that we can create a new instance of the collector with a changed config in a single process and have telemetry still be active. Previously it would not be.

@cpheps cpheps requested review from a team and codeboten September 22, 2022 14:20
@codecov
Copy link

codecov bot commented Sep 22, 2022

Codecov Report

Base: 91.89% // Head: 91.90% // Increases project coverage by +0.00% 🎉

Coverage data is based on head (ce253e0) compared to base (b7ac70a).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6138   +/-   ##
=======================================
  Coverage   91.89%   91.90%           
=======================================
  Files         217      217           
  Lines       13319    13322    +3     
=======================================
+ Hits        12240    12243    +3     
  Misses        850      850           
  Partials      229      229           
Impacted Files Coverage Δ
service/collector.go 78.90% <100.00%> (ø)
service/telemetry.go 90.06% <100.00%> (+0.20%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@cpheps
Copy link
Contributor Author

cpheps commented Sep 22, 2022

For CI failures
Looks like codecov got a 404 on upload and that the contrib tests are currently broken but being fixed.

service/telemetry.go Outdated Show resolved Hide resolved
@djaglowski
Copy link
Member

Is there a particular PR that is supposed to fix the contrib tests? If so, will you link it here so we can track it?

@cpheps
Copy link
Contributor Author

cpheps commented Sep 23, 2022

Is there a particular PR that is supposed to fix the contrib tests? If so, will you link it here so we can track it?

I believe it was this PR open-telemetry/opentelemetry-collector-contrib#14390. The contrib tests look like the fail due to a signalfx go mod error.

Corbin Phelps added 4 commits September 23, 2022 12:44
Signed-off-by: Corbin Phelps <[email protected]>
Signed-off-by: Corbin Phelps <[email protected]>
@cpheps cpheps force-pushed the non-global-telemetry-initializer branch from fa99f71 to ce253e0 Compare September 23, 2022 16:57
Copy link
Member

@djaglowski djaglowski left a comment

Choose a reason for hiding this comment

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

This LGTM.

@djaglowski
Copy link
Member

@open-telemetry/collector-maintainers, anyone available to take a look at this one?

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

Successfully merging this pull request may close these issues.

4 participants