Commit 97f71074 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Merge branch 'add-query-params-to-performance-bar' into 'master'

Include Elasticsearch query params in Performance Bar

See merge request gitlab-org/gitlab!36899
parents 765fb96b dbd975f5
---
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
describe '#results' do
let(:results) { described_class.new.results }
let(:project) { create(:project, :repository) }
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[:duration]).to be_kind_of(String)
expect(results[:details].last[:method]).to eq("POST")
expect(results[:details].last[:path]).to eq("gitlab-test/_refresh")
expect(results[:details].last[:method]).to eq('GET')
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
......@@ -40,7 +40,7 @@ module Peek
end
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
......
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