Top Level Namespace

Defined Under Namespace

Modules: PlainApm

Instance Method Summary collapse

Instance Method Details

#abort_on_missing_ruby_header(name) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'ext/object_tracing/extconf.rb', line 3

def abort_on_missing_ruby_header(name)
  abort(
  <<-MSG

      PlainAPM extension needs #{name} Ruby library header to compile.

      If Ruby is installed from a package on your system, please ensure the
      corresponding Ruby development package is installed as well.

      E.g. on Debian/Ubuntu, this would be achieved by running

      sudo apt install ruby-dev

      on CentOS/Fedora, run

      sudo yum install ruby-devel

      etc...
  MSG
  )
end

#enable_object_tracingObject



61
62
63
# File 'ext/object_tracing/extconf.rb', line 61

def enable_object_tracing
  $defs.push("-DOBJECT_TRACING_ENABLED") unless $defs.include? "-DOBJECT_TRACING_ENABLED"
end

#helloObject

This affects all tracepoints, including internal ones



5
6
7
# File 'ext/object_tracing/bug19112.rb', line 5

def hello
  "world"
end

#try_ruby(file) ⇒ Object



57
58
59
# File 'ext/object_tracing/extconf.rb', line 57

def try_ruby(file)
  system("ruby", "-W0", File.join(__dir__, file), [:out, :err] => File::NULL)
end

#warn_on_ruby_ractor_bugsObject



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
53
54
55
# File 'ext/object_tracing/extconf.rb', line 25

def warn_on_ruby_ractor_bugs
  warn(
  <<-MSG

     PlainAPM extension to track object allocation on a per-thread basis is
     built on top of Ruby's TracePoint API.

     However, the currently running Ruby version contains bugs which,
     when Tracepoints are used in together with Ractors, can cause
     crashes or inconsistent tracing results.

     Per-thread object allocation tracing will be disabled.

     If you are sure your app is not using Ractors, you can override this by
     installing plain_apm with --enable-object-tracing-override flag:

     gem install plain_apm -- --enable-object-tracing-override

     When using bundler, you can configure it to pass this flag to the gem
     install by running:

     bundle config set --global build.plain_apm --enable-object-tracing-override

     See also:

     https://bugs.ruby-lang.org/issues/18464
     https://bugs.ruby-lang.org/issues/19112

  MSG
  )
end