Commit c4bb7c4f authored by Sean McGivern's avatar Sean McGivern Committed by Illya Klymov

Show Redis instance in performance bar

We have four Redis instances in use. For most web requests, the majority
of the Redis usage will be from the cache instance, but some will be
from the shared state (persistent) instance, which is useful to separate
out.
parent 72e885dd
...@@ -55,7 +55,7 @@ export default { ...@@ -55,7 +55,7 @@ export default {
{ {
metric: 'redis', metric: 'redis',
header: s__('PerformanceBar|Redis calls'), header: s__('PerformanceBar|Redis calls'),
keys: ['cmd'], keys: ['cmd', 'instance'],
}, },
{ {
metric: 'es', metric: 'es',
......
---
title: Show Redis instance in performance bar
merge_request: 34377
author:
type: changed
...@@ -30,7 +30,9 @@ module Gitlab ...@@ -30,7 +30,9 @@ module Gitlab
end end
def detail_store def detail_store
STORAGES.flat_map(&:detail_store) STORAGES.flat_map do |storage|
storage.detail_store.map { |details| details.merge(storage: storage.name.demodulize) }
end
end end
%i[get_request_count query_time read_bytes write_bytes].each do |method| %i[get_request_count query_time read_bytes write_bytes].each do |method|
......
...@@ -16,7 +16,8 @@ module Peek ...@@ -16,7 +16,8 @@ module Peek
private private
def format_call_details(call) def format_call_details(call)
super.merge(cmd: format_command(call[:cmd])) super.merge(cmd: format_command(call[:cmd]),
instance: call[:storage])
end end
def format_command(cmd) def format_command(cmd)
......
...@@ -97,4 +97,18 @@ describe Gitlab::Instrumentation::Redis do ...@@ -97,4 +97,18 @@ describe Gitlab::Instrumentation::Redis do
expect(described_class.payload.keys).to match_array(expected_payload.keys) expect(described_class.payload.keys).to match_array(expected_payload.keys)
end end
end end
describe '.detail_store' do
it 'returns a flat array of detail stores with the storage name added to each item' do
details_row = { cmd: 'GET foo', duration: 1 }
stub_storages(:detail_store, [details_row])
expect(described_class.detail_store)
.to contain_exactly(details_row.merge(storage: 'ActionCable'),
details_row.merge(storage: 'Cache'),
details_row.merge(storage: 'Queues'),
details_row.merge(storage: 'SharedState'))
end
end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment