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

heap_dump.rb « reports « memory « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 95779407f1257c2f3e08951f233f1cfff514f825 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# frozen_string_literal: true

module Gitlab
  module Memory
    module Reports
      class HeapDump
        class << self
          def enqueue!
            @write_heap_dump = true
          end

          def enqueued?
            !!@write_heap_dump
          end
        end

        def name
          'heap_dump'
        end

        def active?
          Feature.enabled?(:report_heap_dumps, type: :ops)
        end

        def run(writer)
          return false unless self.class.enqueued?

          ObjectSpace.dump_all(output: writer)

          true
        end
      end
    end
  end
end