• Douwe Maan's avatar
    Merge branch '18451-track-new-redis-connections' into 'master' · 8249fdcd
    Douwe Maan authored
    Resolve "Track the number of new Redis connections per transaction"
    
    ## What does this MR do?
    
    Add a new metric counter, `new_redis_connections`, that contains the number of calls to `Redis::Client#connect` in the current transaction.
    
    ## Are there points in the code the reviewer needs to double check?
    
    Not sure. I tested this in kind of a brute-force way:
    
    1. Add a debugger in the monkey-patched `connect` method.
    2. With metrics enabled, start the app and load a page.
    3. The first Redis connection is created by `Rack::Attack` and isn't in a transaction, but still works fine.
    4. The second Redis connection is within a transaction (the page load), and increments the counter.
    5. If I reload the page, neither debugger is hit.
    6. If I use a Redis client and do `CLIENT KILL` on my two existing clients, then reload the page, I get 3 and 4 again.
    7. If I disable metrics collection, the debugger never gets hit.
    
    ## Why was this MR ...
    8249fdcd
To find the state of this project's repository at the time of any of these versions, check out the tags..
CHANGELOG 151 KB