Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: prometheus/client_ruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: prometheus/client_ruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v2.2_release
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 7 commits
  • 9 files changed
  • 5 contributors

Commits on Jun 19, 2021

  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: #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 authored and dmagliola committed Jun 19, 2021
    Configuration menu
    Copy the full SHA
    dac375d View commit details
    Browse the repository at this point in the history
  2. Add port option to exporter middleware

    If the port option is set, all requests for /metrics on other ports will
    be forwarded to the app. If it is unset or nil, or the ports match,
    export things as usual.
    
    Allows separate mounting of metrics and main app to enforce different
    security setups etc.
    
    Signed-off-by: James Turley <jamesturley@gocardless.com>
    James Turley authored and dmagliola committed Jun 19, 2021
    Configuration menu
    Copy the full SHA
    ec47d6b View commit details
    Browse the repository at this point in the history
  3. Add missing 'cgi' require in push client

    Signed-off-by: Chris Sinjakli <chris@sinjakli.co.uk>
    Sinjo authored and dmagliola committed Jun 19, 2021
    Configuration menu
    Copy the full SHA
    5bd6740 View commit details
    Browse the repository at this point in the history
  4. Update email in gemspec

    Signed-off-by: Chris Sinjakli <chris@sinjakli.co.uk>
    Sinjo authored and dmagliola committed Jun 19, 2021
    Configuration menu
    Copy the full SHA
    c89710b View commit details
    Browse the repository at this point in the history
  5. add open/read timeout kwargs

    Signed-off-by: Nick Van Wiggeren <nick@planetscale.com>
    nickvanw authored and dmagliola committed Jun 19, 2021
    Configuration menu
    Copy the full SHA
    467e30f View commit details
    Browse the repository at this point in the history
  6. Use the original metric's store in with_labels clone

    When calling `with_labels` on a metric object (let's call it "the original"),
    we instantiate a new metric (the "clone") that is identical except that
    it has some more pre-set labels, that allow the caller to observe it
    without having to specify the labels every time.
    
    "currying", if you will.
    
    The problem with the existing code (as exemplified by issue #225, and by
    the tests introduced in the previous commit), is that as part of making
    this new metric, we end up instantiating a new store for this metric.
    
    With in-memory stores, the new one will be empty. With file stores, it'll
    bring over the data from the original metric until the point the clone
    gets observed once, at which point they fork, while pointing at the same
    file and keeping separate internal state. An almost sure recipe for file
    corruption.
    
    And when exporting, only the data in the "original" metric's store will
    be exported, the clone's will be ignored, assuming files didn't get
    corrupted.
    
    The fix is not particularly elegant, but I don't see any way around it:
    we replace the internal store of the "clone" metric with the one from
    the "original", through the use of a protected method.
    
    The only real alternative is getting rid of `with_labels`, which is a
    nice-to-have for convenience and performance, but not a necessity.
    
    Signed-off-by: Daniel Magliola <dmagliola@crystalgears.com>
    dmagliola committed Jun 19, 2021
    Configuration menu
    Copy the full SHA
    621c69d View commit details
    Browse the repository at this point in the history
  7. Release v2.2

    There's new features, so it's a minor version bump.
    
    Signed-off-by: Daniel Magliola <danielmagliola@gocardless.com>
    dmagliola committed Jun 19, 2021
    Configuration menu
    Copy the full SHA
    2fdc82d View commit details
    Browse the repository at this point in the history
Loading