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

Make all registry methods thread safe #201

Merged

Commits on Aug 25, 2020

  1. Make all registry methods thread safe

    The registry is backed by a Hash, which is not guaranteed to be thread
    safe on all interpreters. For peace of mind, this change synchronizes
    all accesses to the metrics hash.
    
    Another option would have been to use a [thread-safe Hash][1] instead of
    a Hash but this would have meant adding Ruby Concurrent as a
    dependency, which I'm assuming we don't want.
    
    Ref: prometheus#184 (comment)
    
    [1]: https://github.com/ruby-concurrency/concurrent-ruby/blob/v1.1.7/lib/concurrent-ruby/concurrent/hash.rb
    
    Signed-off-by: Matthieu Prat <matthieuprat@gocardless.com>
    matthieuprat committed Aug 25, 2020
    Configuration menu
    Copy the full SHA
    c3836b2 View commit details
    Browse the repository at this point in the history