File: scout_apm.rb

package info (click to toggle)
ruby-graphql 2.5.19-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 13,868 kB
  • sloc: ruby: 80,420; ansic: 1,808; yacc: 845; javascript: 480; makefile: 6
file content (52 lines) | stat: -rw-r--r-- 853 bytes parent folder | download
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# frozen_string_literal: true
# A stub for the Scout agent, so we can make assertions about how it is used
if defined?(ScoutApm)
  raise "Expected ScoutApm to be undefined, so that we could define a stub for it."
end

class ScoutApm
  TRANSACTION_NAMES = []
  EVENTS = []

  def self.clear_all
    TRANSACTION_NAMES.clear
    EVENTS.clear
  end

  module Tracer
    def self.instrument(type, name, options = {})
      EVENTS << name
      yield
    end
  end

  class Layer
    def initialize(type, name)
      EVENTS << name
    end

    def subscopable!
      nil
    end
  end

  module RequestManager
    def self.lookup
      self
    end

    def self.start_layer(_layer)
      nil
    end

    def self.stop_layer
      nil
    end
  end

  module Transaction
    def self.rename(name)
      ScoutApm::TRANSACTION_NAMES << name
    end
  end
end