plain_apm 0.10.0 → 0.10.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f234cdb0d7afa540ac0ae06405ca89a2476bf4e18a44062aebe6fda4868b8b63
4
- data.tar.gz: 1c3b2039cd4ce11b9d26d23a1dda6c9fba208fb2e3e8c50bccb0947e1f0161da
3
+ metadata.gz: 380c7c5a078b9d9b650e66ea7daa26109e3a028af6733c845da95784a9848351
4
+ data.tar.gz: 4e72c60ed9f5bf063802d27c8b98fe63b236d74eed7b06e9c9aa0bcc0f0d175d
5
5
  SHA512:
6
- metadata.gz: 7695a907666719056596c427615ca736b39e19a09ee5de97d6999eaec49a55b0a41853e6796076e5acc5e6433f3b8378cab802eadd682b27070b7e3bfe260a51
7
- data.tar.gz: d2ce1c8a4e12681f661c3b09307a32211cfcb3e65d449bb00f90b995bdb5ed4d9726db2edc6722e1d4a9c97a2035d3b6cc1f75d3e1767bf6f0baacdcfba71a36
6
+ metadata.gz: bb81d0e597f83f1fe6389fc1732a7c165d69d3e3369ac2b73152de6566ef5c06e1002d910b4dc6b46e0f69b44c4bfb72c33540b62910f3dbc6db8b0b023655fb
7
+ data.tar.gz: 4a371c933a3dae7778c80b1f01479048194e60f61929b7fab3eff0b5dffc69144df419f1b92f65545a16a014dade2d4bb318ec33480bd4b885eb02a0d620b074
@@ -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. */
@@ -30,6 +30,9 @@ module PlainApm
30
30
  end
31
31
 
32
32
  def collect(event)
33
+ # drop immediately if there's no ongoing transaction
34
+ return if PlainApm::Extensions::Context.trace_id.nil?
35
+
33
36
  # id / transaction_id is by instrumenter and thread
34
37
  payload = payload(event)
35
38
 
@@ -93,6 +93,7 @@ module PlainApm
93
93
  {
94
94
  "Content-Type" => "application/json, charset=UTF-8",
95
95
  "Content-Encoding" => "deflate",
96
+ "X-PlainApm-Version" => PlainApm::VERSION,
96
97
  "X-PlainApm-Key" => app_key
97
98
  }.merge(meta_headers)
98
99
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PlainApm
4
- VERSION = "0.10.0"
4
+ VERSION = "0.10.1"
5
5
  end
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.0
4
+ version: 0.10.1
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-04-17 00:00:00.000000000 Z
11
+ date: 2024-05-11 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.26
159
+ rubygems_version: 3.3.27
160
160
  signing_key:
161
161
  specification_version: 4
162
162
  summary: PlainAPM agent