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

service: only initialize telemetry once to prevent errors in multiple instances #3918

Merged

Conversation

kirbyquerby
Copy link
Member

Description: only initialize internal telemetry once.
This change updates the init() method for colTelemetry (which is a singleton) to run at most once. This allows multiple collector instances to be run in the same process.
Link to tracking Issue: open-telemetry/prometheus-interoperability-spec/issues/34

Testing: Manually tested and was able to create multiple collectors in the same process, while previously, it would error out with:

Error: failed to initialize telemetry: processor/batch/batch_send_size: cannot register view "processor/batch/batch_send_size"; a different view with the same name is already registered                        
processor/batch/batch_send_size_bytes: cannot register view "processor/batch/batch_send_size_bytes"; a different view with the same name is already registered                                                   
kafka_receiver_current_offset: cannot register view "kafka_receiver_current_offset"; a different view with the same name is already registered                                                                   
kafka_receiver_offset_lag: cannot register view "kafka_receiver_offset_lag"; a different view with the same name is already registered  

/cc @odeke-em

@kirbyquerby kirbyquerby requested review from a team and dmitryax August 27, 2021 22:12
Copy link
Member

@odeke-em odeke-em left a comment

Choose a reason for hiding this comment

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

LGTM, thank you @kirbyquerby!

@kirbyquerby kirbyquerby changed the title only initialize collector telemetry once service: only initialize telemetry once to prevent errors in multiple instances Aug 27, 2021
@odeke-em
Copy link
Member

Kindly cc-ing @bogdandrutu @alolita @Aneurysm9. This issue prevents us from creating in code multiple collectors to run the Prometheus RemoteWrite exporter tests in parallel.

@odeke-em
Copy link
Member

odeke-em commented Sep 3, 2021

Kindly help us merge this change @bogdandrutu @tigrannajaryan @alolita, before things get stale again, it is also a blocker for our work and progress

@bogdandrutu bogdandrutu merged commit 56cc570 into open-telemetry:main Sep 3, 2021
erichsueh3 pushed a commit to open-o11y/opentelemetry-collector that referenced this pull request Sep 8, 2021
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.

5 participants