Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/peek/views/zoekt.rb')
-rw-r--r--lib/peek/views/zoekt.rb47
1 files changed, 47 insertions, 0 deletions
diff --git a/lib/peek/views/zoekt.rb b/lib/peek/views/zoekt.rb
new file mode 100644
index 00000000000..d1e9a6d68ed
--- /dev/null
+++ b/lib/peek/views/zoekt.rb
@@ -0,0 +1,47 @@
+# frozen_string_literal: true
+
+module Peek
+ module Views
+ class Zoekt < DetailedView
+ DEFAULT_THRESHOLDS = {
+ calls: 3,
+ duration: 500,
+ individual_call: 500
+ }.freeze
+
+ THRESHOLDS = {
+ production: {
+ calls: 5,
+ duration: 1000,
+ individual_call: 1000
+ }
+ }.freeze
+
+ def key
+ 'zkt'
+ end
+
+ def self.thresholds
+ @thresholds ||= THRESHOLDS.fetch(Rails.env.to_sym, DEFAULT_THRESHOLDS)
+ end
+
+ private
+
+ def duration
+ ::Gitlab::Instrumentation::Zoekt.query_time * 1000
+ end
+
+ def calls
+ ::Gitlab::Instrumentation::Zoekt.get_request_count
+ end
+
+ def call_details
+ ::Gitlab::Instrumentation::Zoekt.detail_store
+ end
+
+ def format_call_details(call)
+ super.merge(request: "#{call[:method]} #{call[:path]}?#{(call[:params] || {}).to_query}")
+ end
+ end
+ end
+end