Commit dbd975f5 authored by Dylan Griffith's avatar Dylan Griffith

Include Elasticsearch query params in Performance Bar

parent 5ff6d0ea
---
title: Include Elasticsearch query params in Performance Bar
merge_request: 36899
author:
type: changed
...@@ -13,12 +13,20 @@ RSpec.describe Peek::Views::Elasticsearch, :elastic, :request_store do ...@@ -13,12 +13,20 @@ RSpec.describe Peek::Views::Elasticsearch, :elastic, :request_store do
describe '#results' do describe '#results' do
let(:results) { described_class.new.results } let(:results) { described_class.new.results }
let(:project) { create(:project, :repository) }
it 'includes performance details' do it 'includes performance details' do
::Gitlab::SafeRequestStore.clear!
project.repository.__elasticsearch__.elastic_search_as_found_blob('hello world')
expect(results[:calls]).to be > 0 expect(results[:calls]).to be > 0
expect(results[:duration]).to be_kind_of(String) expect(results[:duration]).to be_kind_of(String)
expect(results[:details].last[:method]).to eq("POST") expect(results[:details].last[:method]).to eq('GET')
expect(results[:details].last[:path]).to eq("gitlab-test/_refresh") expect(results[:details].last[:path]).to eq('gitlab-test/doc/_search')
expect(results[:details].last[:params]).to eq({ routing: "project_#{project.id}" })
expect(results[:details].last[:request]).to eq("GET gitlab-test/doc/_search?routing=project_#{project.id}")
end end
end end
end end
...@@ -40,7 +40,7 @@ module Peek ...@@ -40,7 +40,7 @@ module Peek
end end
def format_call_details(call) def format_call_details(call)
super.merge(request: "#{call[:method]} #{call[:path]}") super.merge(request: "#{call[:method]} #{call[:path]}?#{call[:params].to_query}")
end end
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