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

[pkg/translator/prometheus] fix panic for duplicated feature gate registration in otel-collector and prometheus packages #32334

Closed

Conversation

gracewehner
Copy link
Contributor

Description:
This mitigates the bug that causes the otelcollector to crash when a project depends on both opentelemetry-collector-contrib and prometheus packages. This is a fix until the code is maintained in a single package and MustRegister() could be used again.

The variable here is initialized by a function that attempts registration. If that errors, search the global registry for a gate that already exist with that ID. If none is still found, then panic.

The same changes will need to be copied over to the duplicate files in the prometheus repository so that both are not calling MustRegister().

Link to tracking Issue:
prometheus/prometheus#13842

Testing:
Added tests that explicitly re-register the flag to ensure there's no panic and the existing gate returned is expected.

Copy link
Member

@andrzej-stencel andrzej-stencel left a comment

Choose a reason for hiding this comment

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

Looks good to me

@Aneurysm9
Copy link
Member

I don't think this is the way we should go with this. The feature gate registrations will be removed from Prometheus and they're planning a hard fork so there's little likelihood of the conflict being reintroduced. I don't believe there's any urgent need to work around this here at this time.

Copy link
Contributor

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

@github-actions github-actions bot added the Stale label May 14, 2024
Copy link
Contributor

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

@github-actions github-actions bot closed this May 29, 2024
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.

None yet

4 participants