Skip to content
Snippets Groups Projects
Commit 2697d2d0 authored by Aleksei Lipniagov's avatar Aleksei Lipniagov :two:
Browse files

Deprecate Sherlock tool

This removes most of the things related to Sherlock.
Dependent gems and docs will be removed separately.
parent 1660ed9e
No related branches found
No related tags found
1 merge request!77345Deprecate Sherlock tool
Showing
with 0 additions and 429 deletions
......@@ -325,7 +325,6 @@ Performance/Sum:
- 'lib/container_registry/tag.rb'
- 'lib/gitlab/ci/reports/test_suite_comparer.rb'
- 'lib/gitlab/diff/file.rb'
- 'lib/gitlab/sherlock/transaction.rb'
- 'lib/gitlab/usage_data.rb'
- 'lib/peek/views/detailed_view.rb'
- 'spec/models/namespace/root_storage_statistics_spec.rb'
......
......@@ -26,7 +26,6 @@ Database/MultipleDatabases:
- lib/gitlab/import_export/group/relation_tree_restorer.rb
- lib/gitlab/legacy_github_import/importer.rb
- lib/gitlab/seeder.rb
- lib/gitlab/sherlock/query.rb
- lib/system_check/orphans/repository_check.rb
- spec/db/schema_spec.rb
- spec/initializers/database_config_spec.rb
......
......@@ -76,7 +76,6 @@ Rails/TimeZone:
- lib/gitlab/prometheus/queries/additional_metrics_environment_query.rb
- lib/gitlab/prometheus/queries/matched_metric_query.rb
- lib/gitlab/prometheus_client.rb
- lib/gitlab/sherlock/transaction.rb
- lib/gitlab/task_helpers.rb
- lib/gitlab/x509/tag.rb
- lib/grafana/time_window.rb
......@@ -141,7 +140,6 @@ Rails/TimeZone:
- spec/lib/gitlab/prometheus/queries/additional_metrics_deployment_query_spec.rb
- spec/lib/gitlab/prometheus/queries/deployment_query_spec.rb
- spec/lib/gitlab/prometheus/queries/validate_query_spec.rb
- spec/lib/gitlab/sherlock/transaction_spec.rb
- spec/lib/gitlab/sidekiq_logging/json_formatter_spec.rb
- spec/lib/gitlab/sidekiq_middleware/duplicate_jobs/strategies/until_executing_spec.rb
- spec/lib/gitlab/updated_notes_paginator_spec.rb
......
......@@ -28,7 +28,6 @@
@import './pages/service_desk';
@import './pages/settings';
@import './pages/settings_ci_cd';
@import './pages/sherlock';
@import './pages/storage_quota';
@import './pages/tree';
@import './pages/users';
table .sherlock-code {
max-width: 700px;
}
.sherlock-code {
pre {
word-wrap: normal;
code {
white-space: pre;
}
}
}
.sherlock-line-samples-table {
thead th,
tbody td {
font-size: 13px !important;
text-align: right;
padding: 0 10px !important;
}
.slow {
color: $red-500;
font-weight: $gl-font-weight-bold;
}
}
.sherlock-file-sample pre {
padding-top: 28px !important;
}
# frozen_string_literal: true
module Sherlock
class ApplicationController < ::ApplicationController
before_action :find_transaction
def find_transaction
if params[:transaction_id]
@transaction = Gitlab::Sherlock.collection
.find_transaction(params[:transaction_id])
end
end
end
end
# frozen_string_literal: true
module Sherlock
class FileSamplesController < Sherlock::ApplicationController
def show
@file_sample = @transaction.find_file_sample(params[:id])
end
end
end
# frozen_string_literal: true
module Sherlock
class QueriesController < Sherlock::ApplicationController
def show
@query = @transaction.find_query(params[:id])
end
end
end
# frozen_string_literal: true
module Sherlock
class TransactionsController < Sherlock::ApplicationController
def index
@transactions = Gitlab::Sherlock.collection.newest_first
end
def show
@transaction = Gitlab::Sherlock.collection.find_transaction(params[:id])
render_404 unless @transaction
end
def destroy_all
Gitlab::Sherlock.collection.clear
redirect_back_or_default(options: { status: :found })
end
end
end
......@@ -189,15 +189,6 @@ def build_view_model(builder:, project:, group:)
end
end
# rubocop: enable Cop/UserAdmin
if Gitlab::Sherlock.enabled?
builder.add_secondary_menu_item(
id: 'sherlock',
title: _('Sherlock Transactions'),
icon: 'admin',
href: sherlock_transactions_path
)
end
end
def projects_menu_item_attrs
......
......@@ -46,10 +46,6 @@ def user_dropdown_class
class_names
end
def has_extra_nav_icons?
Gitlab::Sherlock.enabled? || current_user.admin?
end
def page_has_markdown?
current_path?('merge_requests#show') ||
current_path?('projects/merge_requests/conflicts#show') ||
......
- page_title t('sherlock.title'), t('sherlock.transaction'),
t('sherlock.file_sample')
- header_title t('sherlock.title'), sherlock_transactions_path
.row-content-block
.float-right
= link_to(sherlock_transaction_path(@transaction), class: 'btn gl-button') do
= sprite_icon('arrow-left')
= t('sherlock.transaction')
.oneline
= t('sherlock.file_sample')
= @file_sample.id
.gl-mt-3
%p
%span.light
#{t('sherlock.time')}:
%strong
= @file_sample.duration.round(2)
= t('sherlock.milliseconds')
%p
%span.light
#{t('sherlock.events')}:
%strong
= @file_sample.events
%article.file-holder
.js-file-title.file-title
= sprite_icon("doc-text")
%strong
= @file_sample.file
.code.file-content.js-syntax-highlight
.line-numbers
%table.sherlock-line-samples-table.gl-mb-0
%thead
%tr
%th= t('sherlock.line_capitalized')
%th= t('sherlock.events')
%th= t('sherlock.time')
%th= t('sherlock.percent')
%tbody
- @file_sample.line_samples.each_with_index do |sample, index|
%tr{ class: sample.majority_of?(@file_sample.duration) ? 'slow' : '' }
%td= index + 1
%td= sample.events
%td
= sample.duration.round(2)
= t('sherlock.milliseconds')
%td
= sample.percentage_of(@file_sample.duration).round
= t('sherlock.percent')
.sherlock-file-sample
= highlight(@file_sample.file, @file_sample.source)
.gl-mt-3
.card
.card-header
%strong
= t('sherlock.application_backtrace')
%ul.content-list
- @query.application_backtrace.each do |location|
%li
%strong
- if defined?(BetterErrors)
= link_to(location.path, BetterErrors.editor.url(location.path, location.line))
- else
= location.path
%small.light
= t('sherlock.line')
= location.line
.card
.card-header
%strong
= t('sherlock.full_backtrace')
%ul.content-list
- @query.backtrace.each do |location|
%li
- if location.application?
%strong= location.path
- else
= location.path
%small.light
= t('sherlock.line')
= location.line
.gl-mt-3
.card
.card-header
%strong
= t('sherlock.general')
%ul.content-list
%li
%span.light
#{t('sherlock.time')}:
%strong
= @query.duration.round(4)
= t('sherlock.milliseconds')
%li
- frame = @query.last_application_frame
%span.light
#{t('sherlock.origin')}:
%strong
- if defined?(BetterErrors)
= link_to(frame.path, BetterErrors.editor.url(frame.path, frame.line))
- else
= frame.path
%small.light
= t('sherlock.line')
= frame.line
.card
.card-header
.float-right
%button.js-clipboard-trigger.gl-button.btn.btn-default.btn-sm{ title: t('sherlock.copy_to_clipboard'), type: :button }
= sprite_icon('copy-to-clipboard')
%pre.hidden
= @query.formatted_query
%strong
= t('sherlock.query')
%ul.content-list
%li
.code.js-syntax-highlight.sherlock-code
:preserve
#{highlight("#{@query.id}.sql", @query.formatted_query, language: 'sql')}
.card
.card-header
.float-right
%button.js-clipboard-trigger.gl-button.btn.btn-default.btn-sm{ title: t('sherlock.copy_to_clipboard'), type: :button }
= sprite_icon('copy-to-clipboard')
%pre.hidden
= @query.explain
%strong
= t('sherlock.query_plan')
%ul.content-list
%li
.code.js-syntax-highlight.sherlock-code
%pre
%code= @query.explain
- page_title t('sherlock.title'), t('sherlock.transaction'), t('sherlock.query')
- header_title t('sherlock.title'), sherlock_transactions_path
%ul.nav-links.nav.nav-tabs
%li.active
%a{ href: "#tab-general", data: { toggle: "tab" } }
= t('sherlock.general')
%li
%a{ href: "#tab-backtrace", data: { toggle: "tab" } }
= t('sherlock.backtrace')
.row-content-block
.float-right
= link_to(sherlock_transaction_path(@transaction), class: 'btn gl-button btn-default') do
= sprite_icon('arrow-left')
= t('sherlock.transaction')
.oneline
= t('sherlock.query')
= @query.id
.tab-content
.tab-pane.active#tab-general
= render(partial: 'general')
.tab-pane#tab-backtrace
= render(partial: 'backtrace')
- if @transaction.file_samples.empty?
.nothing-here-block
= t('sherlock.no_file_samples')
- else
.table-holder
%table.table
%thead
%tr
%th= t('sherlock.time_inclusive')
%th= t('sherlock.count')
%th= t('sherlock.path')
%th
%tbody
- @transaction.sorted_file_samples.each do |sample|
%tr
%td
= sample.duration.round(2)
= t('sherlock.milliseconds')
%td= @transaction.view_counts.fetch(sample.file, 1)
%td= sample.relative_path
%td
= link_to(t('sherlock.view'),
sherlock_transaction_file_sample_path(@transaction, sample),
class: 'gl-button btn btn-sm')
.gl-mt-3
.card
.card-header
%strong
= t('sherlock.general')
%ul.content-list
%li
%span.light
#{t('sherlock.id')}:
%strong
= @transaction.id
%li
%span.light
#{t('sherlock.type')}:
%strong
= @transaction.type
%li
%span.light
#{t('sherlock.path')}:
%strong
= @transaction.path
%li
%span.light
#{t('sherlock.time')}:
%strong
= @transaction.duration.round(2)
= t('sherlock.seconds')
%li
%span.light
#{t('sherlock.query_time')}
%strong
= @transaction.query_duration.round(2)
= t('sherlock.seconds')
%li
%span.light
#{t('sherlock.finished_at')}:
%strong
= time_ago_with_tooltip @transaction.finished_at
- if @transaction.queries.empty?
.nothing-here-block
= t('sherlock.no_queries')
- else
.table-holder
%table.table#sherlock-queries
%thead
%tr
%th= t('sherlock.time')
%th= t('sherlock.query')
%th
%tbody
- @transaction.sorted_queries.each do |query|
%tr
%td
= query.duration.round(2)
= t('sherlock.milliseconds')
%td
.code.js-syntax-highlight.sherlock-code
= highlight("#{query.id}.sql", query.formatted_query, language: 'sql')
%td
= link_to(t('sherlock.view'),
sherlock_transaction_query_path(@transaction, query),
class: 'gl-button btn btn-sm')
- page_title t('sherlock.title')
- header_title t('sherlock.title'), sherlock_transactions_path
.row-content-block
.float-right
= link_to(destroy_all_sherlock_transactions_path,
class: 'gl-button btn btn-danger',
method: :delete) do
= sprite_icon('remove')
= t('sherlock.delete_all_transactions')
.oneline= t('sherlock.introduction')
- if @transactions.empty?
.nothing-here-block= t('sherlock.no_transactions')
- else
.table-holder
%table.table
%thead
%tr
%th= t('sherlock.type')
%th= t('sherlock.path')
%th= t('sherlock.time')
%th= t('sherlock.queries')
%th= t('sherlock.finished_at')
%th
%tbody
- @transactions.each do |trans|
%tr
%td= trans.type
%td
%span{ title: trans.path }
= truncate(trans.path, length: 70)
%td
= trans.duration.round(2)
= t('sherlock.seconds')
%td= trans.queries.length
%td
= time_ago_with_tooltip trans.finished_at
%td
= link_to(sherlock_transaction_path(trans), class: 'gl-button btn btn-sm') do
= t('sherlock.view')
- page_title t('sherlock.title'), t('sherlock.transaction')
- header_title t('sherlock.title'), sherlock_transactions_path
%ul.nav-links.nav.nav-tabs
%li.active
%a{ href: "#tab-general", data: { toggle: "tab" } }
= t('sherlock.general')
%li
%a{ href: "#tab-queries", data: { toggle: "tab" } }
= t('sherlock.queries')
= gl_badge_tag @transaction.queries.length.to_s
%li
%a{ href: "#tab-file-samples", data: { toggle: "tab" } }
= t('sherlock.file_samples')
= gl_badge_tag @transaction.file_samples.length.to_s
.row-content-block
.float-right
= link_to(sherlock_transactions_path, class: 'gl-button btn') do
= sprite_icon('arrow-left', css_class: 'gl-mr-3')
= t('sherlock.all_transactions')
.oneline
= t('sherlock.transaction')
= @transaction.id
.tab-content
.tab-pane.active#tab-general
= render(partial: 'general')
.tab-pane#tab-queries
= render(partial: 'queries')
.tab-pane#tab-file-samples
= render(partial: 'file_samples')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment