solarwinds_apm 6.1.0 → 6.1.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.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +49 -2
  3. data/ext/oboe_metal/extconf.rb +15 -9
  4. data/ext/oboe_metal/lib/liboboe-1.0-aarch64.so.sha256 +1 -1
  5. data/ext/oboe_metal/lib/liboboe-1.0-alpine-aarch64.so.sha256 +1 -1
  6. data/ext/oboe_metal/lib/liboboe-1.0-alpine-x86_64.so.sha256 +1 -1
  7. data/ext/oboe_metal/lib/liboboe-1.0-lambda-aarch64.so.sha256 +1 -1
  8. data/ext/oboe_metal/lib/liboboe-1.0-lambda-x86_64.so.sha256 +1 -1
  9. data/ext/oboe_metal/lib/liboboe-1.0-x86_64.so.sha256 +1 -1
  10. data/ext/oboe_metal/src/VERSION +1 -1
  11. data/ext/oboe_metal/src/oboe.h +2 -1
  12. data/ext/oboe_metal/src/oboe_api.cpp +5 -3
  13. data/ext/oboe_metal/src/oboe_api.h +2 -1
  14. data/ext/oboe_metal/src/oboe_swig_wrap.cc +219 -120
  15. data/lib/oboe_metal.rb +8 -4
  16. data/lib/rails/generators/solarwinds_apm/templates/solarwinds_apm_initializer.rb +0 -4
  17. data/lib/solarwinds_apm/api/custom_instrumentation.rb +80 -0
  18. data/lib/solarwinds_apm/api.rb +2 -0
  19. data/lib/solarwinds_apm/oboe_init_options.rb +14 -1
  20. data/lib/solarwinds_apm/opentelemetry/solarwinds_processor.rb +2 -2
  21. data/lib/solarwinds_apm/opentelemetry/solarwinds_response_propagator.rb +4 -3
  22. data/lib/solarwinds_apm/opentelemetry/solarwinds_sampler.rb +2 -0
  23. data/lib/solarwinds_apm/otel_config.rb +10 -0
  24. data/lib/solarwinds_apm/patch/tag_sql/sw_dbo_utils.rb +35 -0
  25. data/lib/solarwinds_apm/patch/tag_sql/sw_mysql2_patch.rb +25 -0
  26. data/lib/solarwinds_apm/patch/tag_sql/sw_pg_patch.rb +39 -0
  27. data/lib/solarwinds_apm/patch/tag_sql_patch.rb +11 -0
  28. data/lib/solarwinds_apm/support.rb +0 -14
  29. data/lib/solarwinds_apm/version.rb +1 -1
  30. metadata +10 -12
  31. data/lib/solarwinds_apm/support/swomarginalia/LICENSE +0 -20
  32. data/lib/solarwinds_apm/support/swomarginalia/README.md +0 -46
  33. data/lib/solarwinds_apm/support/swomarginalia/comment.rb +0 -206
  34. data/lib/solarwinds_apm/support/swomarginalia/formatter.rb +0 -20
  35. data/lib/solarwinds_apm/support/swomarginalia/load_swomarginalia.rb +0 -55
  36. data/lib/solarwinds_apm/support/swomarginalia/railtie.rb +0 -24
  37. data/lib/solarwinds_apm/support/swomarginalia/swomarginalia.rb +0 -89
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 807b88fafed018cf28ab385ea2cb52667127fc4cbab96aac770b5c1f3ab894a6
4
- data.tar.gz: b7ec5c206351c3f6fdc90da61550482d9b9e1d2e82f27c1d1a54408111c3f8db
3
+ metadata.gz: 73f2befcea2c555995f79719d36c68d2448ae31f56656741d5c6e8d49e61963b
4
+ data.tar.gz: 4ba3986285dcda8adc5629c2e08b5221638928d06733dd6fc0c009379b97ab4b
5
5
  SHA512:
6
- metadata.gz: 637ac2da4665dfe45e8095928ca1d46ac2bfdde1f3574913d232c6978d003158a0d94bdb472a5ed65088c89ab070b2e86079e518a9c60503dcd7c3c8af5059c3
7
- data.tar.gz: 41dabb11f5b5e692342620a1936224e5acffe738bf01c0f9ca0ceabbec1a882eda455cdfd1fb9c3469e75300e0ef66227ab8699d369c0daf15eba6ff40b057b2
6
+ metadata.gz: 777aebc61cfb1f6776f0640f9b0cbd6005c5c375989a046809ce4f97551a8f2925154496eeef798726ac2242641646bb590c48d23caf71165473b0ac0cfa6b52
7
+ data.tar.gz: c244cb0d3c1252cbcb85f3381cc82195ca8d59bf0ea4991f2c41f89a49d29a92efcf089ee35ae6274614493bd7e89d7ecb5851ec876a572d24fc5015ec7d5625
data/README.md CHANGED
@@ -64,9 +64,11 @@ Note that if `OpenTelemetry::SDK.configure` is used to set up a `TracerProvider`
64
64
 
65
65
  Several convenience and vendor-specific APIs are availabe to an application where `solarwinds_apm` has been loaded, below is a quick overview of the features provided. The full reference can be found at the [RubyDoc page for this gem](https://rubydoc.info/github/solarwinds/apm-ruby).
66
66
 
67
- #### Convenience Method for in_span
67
+ #### Convenience Method: `in_span` and `add_tracer`
68
68
 
69
- This method acquires the correct `Tracer` so a new span can be created in a single call, below is a simple Rails controller example:
69
+ `in_span` acquires the correct `Tracer` so a new span can be created in a single call.
70
+
71
+ For example, using it in a Rails controller:
70
72
 
71
73
  ```ruby
72
74
  class StaticController < ApplicationController
@@ -78,6 +80,51 @@ class StaticController < ApplicationController
78
80
  end
79
81
  ```
80
82
 
83
+ `add_tracer` can add a custom span to the specified instance or class method that is already defined. It can optionally set the span kind and additional attributes provided in hash format:
84
+
85
+ ```ruby
86
+ add_tracer :method_name, 'custom_span_name', { attributes: { 'any' => 'attributes' }, kind: :span_kind }
87
+ ```
88
+
89
+ For example, if you want to instrument class or instance method `create_session` inside an application controller:
90
+
91
+ To instrument instance method
92
+ ```ruby
93
+ class SessionsController < ApplicationController
94
+ include SolarWindsAPM::API::Tracer
95
+
96
+ def create
97
+ user = User.find_by(email: params[:session][:email].downcase)
98
+ create_session(user)
99
+ end
100
+
101
+ def create_session(user)
102
+ end
103
+
104
+ # instrument instance method create_session
105
+ add_tracer :create_session, 'custom_name', { attributes: { 'foo' => 'bar' }, kind: :consumer }
106
+ end
107
+ ```
108
+
109
+ To instrument class method
110
+ ```ruby
111
+ class SessionsController < ApplicationController
112
+ def create
113
+ user = User.find_by(email: params[:session][:email].downcase)
114
+ create_session(user)
115
+ end
116
+
117
+ def self.create_session(user)
118
+ end
119
+
120
+ # instrument class method create_session
121
+ class << self
122
+ include SolarWindsAPM::API::Tracer
123
+ add_tracer :create_session, 'custom_name', { attributes: { 'foo' => 'bar' }, kind: :consumer }
124
+ end
125
+ end
126
+ ```
127
+
81
128
  #### Get Curent Trace Context Information
82
129
 
83
130
  The `current_trace_info` method returns a `TraceInfo` object containing string representations of the current trace context that can be used in logging or manual propagation of context. This is a convenience method that wraps the OTel API `::OpenTelemetry::Trace.current_span`.
@@ -18,20 +18,17 @@ CONFIG['warnflags'] = CONFIG['warnflags'].gsub('-Wdeclaration-after-statement',
18
18
  init_mkmf(CONFIG)
19
19
 
20
20
  ext_dir = __dir__
21
- oboe_debug = ENV['OBOE_DEBUG'].to_s.casecmp('true').zero?
22
- non_production = ENV['OBOE_DEV'].to_s.casecmp('true').zero? || ENV['OBOE_STAGING'].to_s.casecmp('true').zero?
21
+ oboe_env = ENV.fetch('OBOE_ENV', nil)
22
+ non_production = %w[dev stg].include? oboe_env.to_s
23
23
 
24
24
  swo_lib_dir = File.join(ext_dir, 'lib')
25
25
  version = File.read(File.join(ext_dir, 'src', 'VERSION')).strip
26
26
 
27
- # OBOE_DEBUG has the highest priorities over oboe environment
28
- if oboe_debug
29
- swo_path = File.join('https://agent-binaries.cloud.solarwinds.com/apm/c-lib/', version, 'relwithdebinfo')
30
- puts 'Fetching c-lib from PRODUCTION DEBUG Build'
31
- elsif ENV['OBOE_DEV'].to_s.casecmp('true').zero?
27
+ case oboe_env
28
+ when 'dev'
32
29
  swo_path = 'https://solarwinds-apm-staging.s3.us-west-2.amazonaws.com/apm/c-lib/nightly'
33
30
  puts 'Fetching c-lib from DEVELOPMENT Build'
34
- elsif ENV['OBOE_STAGING'].to_s.casecmp('true').zero?
31
+ when 'stg'
35
32
  swo_path = File.join('https://agent-binaries.global.st-ssp.solarwinds.com/apm/c-lib/', version)
36
33
  puts 'Fetching c-lib from STAGING Build'
37
34
  else
@@ -39,6 +36,15 @@ else
39
36
  puts 'Fetching c-lib from PRODUCTION Build'
40
37
  end
41
38
 
39
+ oboe_debug = ENV['OBOE_DEBUG'].to_s.casecmp('true').zero?
40
+
41
+ if oboe_debug
42
+ swo_path = File.join(swo_path, 'relwithdebinfo')
43
+ puts "Fetching DEBUG Build based on #{oboe_env.to_s.empty? ? 'prod' : oboe_env}"
44
+ end
45
+
46
+ puts "final swo_path: #{swo_path}"
47
+
42
48
  swo_arch = 'x86_64'
43
49
  system_arch = `uname -m` # for mac, the command is `uname` # "Darwin\n"; try `uname -a`
44
50
  system_arch.delete!("\n")
@@ -120,7 +126,7 @@ if success
120
126
  dir_config('oboe', 'src', 'lib')
121
127
 
122
128
  # create Makefile
123
- if have_library('oboe', 'oboe_config_get_revision', 'oboe.h')
129
+ if have_library('oboe')
124
130
  $libs = append_library($libs, 'oboe')
125
131
  $libs = append_library($libs, 'stdc++')
126
132
 
@@ -1 +1 @@
1
- 61538e93d28a320f25615c04330c61c9b85fb61832d0be570b35ac75ce3cb05c
1
+ 53295ec020a713c5f6fe7c14b150a10ac7db0e5ea692fbd6945ee69f7a581271
@@ -1 +1 @@
1
- 84dadb40257d98b3f1a1bf79aec922bd41f35119538ddf128546048738ae7729
1
+ 37407ece6aafcb662fbce8eb23f98a9b017154c66c8ec02eda835702ba14f446
@@ -1 +1 @@
1
- 50ef136fd07dda69b9fed1c7fd61e364aae23402c814b56e03775f32525af348
1
+ 925d65c2a940a82315525ea2e82eb357793f7db8a2a8ec529e7c03e2478bc965
@@ -1 +1 @@
1
- 38204cae649edff5ac37ea97b5991ed06ed6dca47201745ac261be9f15386dbc
1
+ 3d49133827a0b6839744231e3ca49f8c9340380063286b8c3794bde585370001
@@ -1 +1 @@
1
- 65808108b17f1b883d8fbbcd48eb04c5682b67b5ec04c04c5642f29664aa29af
1
+ e2198827ce86309a59def33be14f17d0474477df33a5d75bd415d73a01c790b3
@@ -1 +1 @@
1
- 337fb9e998fd2f802b6d8305a45a7d0c6248da621d2607ddf2d0b4254d5a6fde
1
+ 798a7c9551c66af743e1d6d2b736bf5667fa97fdc0ac8eec825fe4f63adaa044
@@ -1 +1 @@
1
- 15.0.2
1
+ 15.0.3
@@ -161,7 +161,7 @@ typedef struct oboe_metric_tag {
161
161
  } oboe_metric_tag_t;
162
162
 
163
163
  typedef struct oboe_init_options {
164
- int version; // the version of this structure (currently on version 16)
164
+ int version; // the version of this structure (currently on version 17)
165
165
  const char *hostname_alias; // optional hostname alias
166
166
  int log_level; // level at which log messages will be written to log file (0-6)
167
167
  // use OBOE_INIT_LOG_LEVEL_INFO(3) for default log level
@@ -188,6 +188,7 @@ typedef struct oboe_init_options {
188
188
  // only used in lambda reporter (off=0, on=1, default off)
189
189
  int metric_format; // flag indicating the format of metric (0 = Both; 1 = TransactionResponseTime only; 2 = ResponseTime only; default = 0)
190
190
  int log_type; // log type (0 = stderr; 1 = stdout; 2 = file; 3 = null; 4 = disabled; default = 0)
191
+ int defer_init; // defer init (0 = disable; 1 = enabled, parent process will not init oboe but fork child process will init oboe; default = 0)
191
192
  } oboe_init_options_t;
192
193
 
193
194
  typedef struct oboe_span_params {
@@ -587,11 +587,12 @@ Reporter::Reporter(
587
587
  int stdout_clear_nonblocking, // flag indicating if the O_NONBLOCK flag on stdout should be cleared,
588
588
  // only used in lambda reporter (off=0, on=1, default off)
589
589
  int metric_format, // flag indicating the format of metric (0 = Both; 1 = TransactionResponseTime only; 2 = ResponseTime only; default = 0)
590
- int log_type // log type (0 = stderr; 1 = stdout; 2 = file; 3 = null; 4 = disabled; default = 0)
590
+ int log_type, // log type (0 = stderr; 1 = stdout; 2 = file; 3 = null; 4 = disabled; default = 0)
591
+ int defer_init // defer init (0 = disable; 1 = enabled, parent process will not init oboe but fork child process will init oboe; default = 0)
591
592
  ) {
592
593
  oboe_init_options_t options;
593
594
  memset(&options, 0, sizeof(options));
594
- options.version = 16;
595
+ options.version = 17;
595
596
  oboe_init_options_set_defaults(&options);
596
597
 
597
598
  if (hostname_alias != "") {
@@ -628,6 +629,7 @@ Reporter::Reporter(
628
629
  options.stdout_clear_nonblocking = stdout_clear_nonblocking;
629
630
  options.metric_format = metric_format;
630
631
  options.log_type = log_type;
632
+ options.defer_init = defer_init;
631
633
  init_status = oboe_init(&options);
632
634
  }
633
635
 
@@ -694,7 +696,7 @@ std::string Config::getVersionString() {
694
696
  OboeAPI::OboeAPI(const OboeAPIOptions& options) {
695
697
  oboe_init_options_t oboe_options;
696
698
  memset(&oboe_options, 0, sizeof(oboe_options));
697
- oboe_options.version = 16;
699
+ oboe_options.version = 17;
698
700
  oboe_init_options_set_defaults(&oboe_options);
699
701
  oboe_options.log_level = options.logging_options.level;
700
702
  oboe_options.log_type = options.logging_options.type;
@@ -463,7 +463,8 @@ class Reporter : private oboe_reporter_t {
463
463
  int stdout_clear_nonblocking, // flag indicating if the O_NONBLOCK flag on stdout should be cleared,
464
464
  // only used in lambda reporter (off=0, on=1, default off)
465
465
  int metric_format, // flag indicating the format of metric (0 = Both; 1 = TransactionResponseTime only; 2 = ResponseTime only; default = 0)
466
- int log_type // log type (0 = stderr; 1 = stdout; 2 = file; 3 = null; 4 = disabled; default = 0)
466
+ int log_type, // log type (0 = stderr; 1 = stdout; 2 = file; 3 = null; 4 = disabled; default = 0)
467
+ int defer_init // defer init (0 = disable; 1 = enabled, parent process will not init oboe but fork child process will init oboe; default = 0)
467
468
  );
468
469
 
469
470
  ~Reporter();