Commit 8cebaaae authored by Illya Klymov's avatar Illya Klymov

Merge branch 'show-redis-instance-in-performance-bar' into 'master'

Show Redis instance in performance bar

See merge request gitlab-org/gitlab!34377
parents d9b199ef c4bb7c4f
......@@ -55,7 +55,7 @@ export default {
{
metric: 'redis',
header: s__('PerformanceBar|Redis calls'),
keys: ['cmd'],
keys: ['cmd', 'instance'],
},
{
metric: 'es',
......
---
title: Show Redis instance in performance bar
merge_request: 34377
author:
type: changed
......@@ -30,7 +30,9 @@ module Gitlab
end
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
%i[get_request_count query_time read_bytes write_bytes].each do |method|
......
......@@ -16,7 +16,8 @@ module Peek
private
def format_call_details(call)
super.merge(cmd: format_command(call[:cmd]))
super.merge(cmd: format_command(call[:cmd]),
instance: call[:storage])
end
def format_command(cmd)
......
......@@ -97,4 +97,18 @@ describe Gitlab::Instrumentation::Redis do
expect(described_class.payload.keys).to match_array(expected_payload.keys)
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
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