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

PrometheusHttpServer prevent concurrent reads when reusable memory mode #6371

Merged
merged 1 commit into from
Apr 22, 2024

Conversation

jack-berg
Copy link
Member

Followup to #6304. PeriodicMetricReader already has locks in place which prevent concurrent reads and ensure safe access when memory mode is reusable, but PrometheusHttpServer needs an equivalent mechanism.

@jack-berg jack-berg requested a review from a team April 9, 2024 18:44
Copy link

codecov bot commented Apr 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.10%. Comparing base (92d659a) to head (ea3960a).

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #6371   +/-   ##
=========================================
  Coverage     91.10%   91.10%           
- Complexity     5772     5773    +1     
=========================================
  Files           627      627           
  Lines         16852    16854    +2     
  Branches       1720     1721    +1     
=========================================
+ Hits          15353    15355    +2     
  Misses         1005     1005           
  Partials        494      494           

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

@jack-berg jack-berg merged commit 8f791f2 into open-telemetry:main Apr 22, 2024
18 checks passed
Copy link
Contributor

@anuraaga anuraaga left a comment

Choose a reason for hiding this comment

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

Was totally randomly reading this PR and figured I'd write down something I noticed

// When memory mode is REUSABLE_DATA, concurrent reads lead to data corruption. To prevent this,
// we configure prometheus with a single thread executor such that requests are handled
// sequentially.
if (memoryMode == MemoryMode.REUSABLE_DATA) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be executor == null && memoryMode == REUSABLE? Or otherwise the builder should prevent setting both?

Copy link
Member Author

Choose a reason for hiding this comment

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

👋

I left a comment on the PrometheusHttpServerBuilder javadoc stating that if you set memory mode, setExecutor is ignored. We could be stricter and throw if both are set.

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.

3 participants