plain_apm 0.10.0 → 0.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ext/object_tracing/object_tracing.c +11 -1
- data/lib/plain_apm/event_attributes.rb +16 -1
- data/lib/plain_apm/extensions/active_support/event.rb +9 -0
- data/lib/plain_apm/hooks/action_pack.rb +6 -1
- data/lib/plain_apm/hooks/active_support_subscriber.rb +3 -0
- data/lib/plain_apm/transport.rb +1 -0
- data/lib/plain_apm/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c48770b73fc39349e83183e81f882964eee3504efb2828ca524651f6df8fcce
|
4
|
+
data.tar.gz: c591759e668fce2402e67b4d49cd2b91b2d74304f73f4979bad5862832455b79
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 202d04c8ddf30432c613bcda9abe0a6abb0b73de9fb0a40b57181cdd4e264837b20c641948f867955699227e726e369687454b9a0c8e5d1a00c0f5d4485c9aaa
|
7
|
+
data.tar.gz: c16dc0de9bb7bfa110eddb680d0a96da964a5a0ef98bcd1c4c75ea6fcb4f3adc4623bc9e0c7c9621e8a738f87986a5cb33f3cfe4341bb8a115e7b996609c3231
|
@@ -1,14 +1,19 @@
|
|
1
1
|
#include <ruby/ruby.h>
|
2
2
|
#include <ruby/debug.h>
|
3
3
|
|
4
|
+
/* Pre-ruby 3.1 compatibility */
|
5
|
+
#ifndef RBOOL
|
6
|
+
#define RBOOL(v) ((v) ? Qtrue : Qfalse)
|
7
|
+
#endif
|
8
|
+
|
4
9
|
static VALUE rb_mPlainApm = Qnil;
|
5
10
|
static VALUE rb_mObjTracing = Qnil;
|
6
11
|
|
7
12
|
static __thread uint64_t allocated_objects = 0;
|
8
13
|
|
9
|
-
#ifdef OBJECT_TRACING_ENABLED
|
10
14
|
static int object_tracing_active = 0;
|
11
15
|
|
16
|
+
#ifdef OBJECT_TRACING_ENABLED
|
12
17
|
static void track_thread_allocated_objects(VALUE tpval, void *data) {
|
13
18
|
allocated_objects++;
|
14
19
|
}
|
@@ -18,6 +23,10 @@ static VALUE total_thread_allocated_objects(VALUE self) {
|
|
18
23
|
return ULL2NUM(allocated_objects);
|
19
24
|
}
|
20
25
|
|
26
|
+
static VALUE thread_allocated_objects_tracing_enabled(VALUE self) {
|
27
|
+
return RBOOL(object_tracing_active);
|
28
|
+
}
|
29
|
+
|
21
30
|
void Init_object_tracing(void) {
|
22
31
|
rb_mPlainApm = rb_define_module("PlainApm");
|
23
32
|
rb_gc_register_address(&rb_mPlainApm);
|
@@ -26,6 +35,7 @@ void Init_object_tracing(void) {
|
|
26
35
|
rb_gc_register_address(&rb_mObjTracing);
|
27
36
|
|
28
37
|
rb_define_singleton_method(rb_mObjTracing, "total_thread_allocated_objects", total_thread_allocated_objects, 0);
|
38
|
+
rb_define_singleton_method(rb_mObjTracing, "thread_allocated_objects_tracing_enabled", thread_allocated_objects_tracing_enabled, 0);
|
29
39
|
|
30
40
|
#ifdef OBJECT_TRACING_ENABLED
|
31
41
|
/* Ensure the tracepoint is attached only once. */
|
@@ -27,6 +27,9 @@ module PlainApm
|
|
27
27
|
attrs[:message] = e.message
|
28
28
|
attrs[:backtrace] = e.backtrace
|
29
29
|
|
30
|
+
attrs[:event_time] = now
|
31
|
+
attrs[:event_utc_time] = utc_now
|
32
|
+
|
30
33
|
if error_source
|
31
34
|
attrs[:event_source] = error_source
|
32
35
|
end
|
@@ -83,6 +86,10 @@ module PlainApm
|
|
83
86
|
attrs[:event_time] = event.time
|
84
87
|
attrs[:duration] = event.duration
|
85
88
|
|
89
|
+
if event.respond_to?(:utc_time)
|
90
|
+
attrs[:event_utc_time] = event.utc_time
|
91
|
+
end
|
92
|
+
|
86
93
|
if event.respond_to?(:gc_time)
|
87
94
|
attrs[:gc_time] = event.gc_time
|
88
95
|
end
|
@@ -115,7 +122,7 @@ module PlainApm
|
|
115
122
|
# https://bugs.ruby-lang.org/issues/19443 for the feature.
|
116
123
|
def add_trace_attributes(attrs)
|
117
124
|
attrs[:thread_id] = Thread.current.object_id
|
118
|
-
attrs[:collected_at] =
|
125
|
+
attrs[:collected_at] = utc_now
|
119
126
|
attrs[:pid] = Process.pid
|
120
127
|
attrs[:version] = PlainApm::VERSION
|
121
128
|
attrs[:hostname] = cached_attributes[:hostname]
|
@@ -156,6 +163,14 @@ module PlainApm
|
|
156
163
|
nil
|
157
164
|
end
|
158
165
|
|
166
|
+
def now
|
167
|
+
Process.clock_gettime(Process::CLOCK_MONOTONIC, :float_millisecond)
|
168
|
+
end
|
169
|
+
|
170
|
+
def utc_now
|
171
|
+
Time.now.to_f
|
172
|
+
end
|
173
|
+
|
159
174
|
def self.included(other)
|
160
175
|
other.class_eval do
|
161
176
|
def self.rails_root
|
@@ -4,6 +4,7 @@ module PlainApm
|
|
4
4
|
module Event
|
5
5
|
def start!
|
6
6
|
super
|
7
|
+
@utc_start = utc_now
|
7
8
|
@thread_allocation_count_start = now_thread_allocations
|
8
9
|
@gc_time_start = now_gc_time
|
9
10
|
@gc_major_count_start = now_gc_major_count
|
@@ -34,6 +35,10 @@ module PlainApm
|
|
34
35
|
@gc_minor_count_finish - @gc_minor_count_start
|
35
36
|
end
|
36
37
|
|
38
|
+
def utc_time
|
39
|
+
@utc_start
|
40
|
+
end
|
41
|
+
|
37
42
|
private
|
38
43
|
|
39
44
|
# Per thread GC counter
|
@@ -71,6 +76,10 @@ module PlainApm
|
|
71
76
|
0
|
72
77
|
end
|
73
78
|
end
|
79
|
+
|
80
|
+
def utc_now
|
81
|
+
Time.now.to_f
|
82
|
+
end
|
74
83
|
end
|
75
84
|
end
|
76
85
|
end
|
@@ -26,7 +26,12 @@ module PlainApm
|
|
26
26
|
o[:path] = payload[:path]
|
27
27
|
o[:status] = payload[:status]
|
28
28
|
end
|
29
|
-
when "
|
29
|
+
when "start_processing"
|
30
|
+
base.tap do |o|
|
31
|
+
o[:controller] = payload[:controller]
|
32
|
+
o[:action] = payload[:action]
|
33
|
+
end
|
34
|
+
when "redirect_to", "halted_callback", "send_file", "send_data"
|
30
35
|
nil
|
31
36
|
when "read_fragment", "write_fragment", "exist_fragment?", "expire_fragment"
|
32
37
|
# controller, action, key
|
data/lib/plain_apm/transport.rb
CHANGED
data/lib/plain_apm/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: plain_apm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- PlainAPM Team
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-06-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -156,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
156
156
|
- !ruby/object:Gem::Version
|
157
157
|
version: '0'
|
158
158
|
requirements: []
|
159
|
-
rubygems_version: 3.3.
|
159
|
+
rubygems_version: 3.3.27
|
160
160
|
signing_key:
|
161
161
|
specification_version: 4
|
162
162
|
summary: PlainAPM agent
|