File: appoptics.rb

package info (click to toggle)
ruby-graphql 2.2.17-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 9,584 kB
  • sloc: ruby: 67,505; ansic: 1,753; yacc: 831; javascript: 331; makefile: 6
file content (49 lines) | stat: -rw-r--r-- 937 bytes parent folder | download | duplicates (2)
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
# frozen_string_literal: true
# A stub for the AppOpticsAPM agent, so we can make assertions about how it is used
if defined?(AppOpticsAPM) && !AppOpticsAPM.graphql_test
  raise "Expected AppOpticsAPM to be undefined, so that we can define a stub for it."
end

module AppOpticsAPM
  def self.loaded; true; end

  module SDK
    def self.trace(name, kvs)
      $appoptics_tracing_spans << name
      $appoptics_tracing_kvs << kvs.dup
      yield
    end

    def self.get_transaction_name
      $appoptics_tracing_name
    end

    def self.set_transaction_name(name)
      $appoptics_tracing_name = name
    end
  end

  module Config
    class << self
      def [](key)
        config[key.to_sym]
      end

      def []=(key, value)
        config[key.to_sym] = value
      end

      def clear
        config.clear
      end

      def config
        @config ||= {}
      end
    end
  end

  def self.graphql_test
    true
  end
end