solarwinds_apm 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (142) hide show
  1. checksums.yaml +7 -0
  2. data/.dockerignore +5 -0
  3. data/.github/ISSUE_TEMPLATE/bug-or-feature-request.md +16 -0
  4. data/.github/workflows/build_and_release_gem.yml +112 -0
  5. data/.github/workflows/build_for_packagecloud.yml +70 -0
  6. data/.github/workflows/docker-images.yml +47 -0
  7. data/.github/workflows/run_cpluplus_tests.yml +73 -0
  8. data/.github/workflows/run_tests.yml +155 -0
  9. data/.github/workflows/scripts/test_install.rb +23 -0
  10. data/.github/workflows/swig/swig-v4.0.2.tar.gz +0 -0
  11. data/.github/workflows/test_on_4_linux.yml +161 -0
  12. data/.gitignore +39 -0
  13. data/.rubocop.yml +29 -0
  14. data/.yardopts +7 -0
  15. data/CHANGELOG.md +769 -0
  16. data/CONFIG.md +31 -0
  17. data/Gemfile +14 -0
  18. data/LICENSE +202 -0
  19. data/README.md +383 -0
  20. data/bin/solarwinds_apm_config +15 -0
  21. data/examples/prepend.rb +13 -0
  22. data/examples/sdk_examples.rb +158 -0
  23. data/ext/oboe_metal/README.md +69 -0
  24. data/ext/oboe_metal/extconf.rb +141 -0
  25. data/ext/oboe_metal/extconf_local.rb +75 -0
  26. data/ext/oboe_metal/lib/.keep +0 -0
  27. data/ext/oboe_metal/lib/liboboe-1.0-alpine-x86_64.so.0.0.0.sha256 +1 -0
  28. data/ext/oboe_metal/lib/liboboe-1.0-x86_64.so.0.0.0.sha256 +1 -0
  29. data/ext/oboe_metal/noop/noop.c +8 -0
  30. data/ext/oboe_metal/src/README.md +6 -0
  31. data/ext/oboe_metal/src/VERSION +2 -0
  32. data/ext/oboe_metal/src/bson/bson.h +220 -0
  33. data/ext/oboe_metal/src/bson/platform_hacks.h +91 -0
  34. data/ext/oboe_metal/src/frames.cc +247 -0
  35. data/ext/oboe_metal/src/frames.h +40 -0
  36. data/ext/oboe_metal/src/init_solarwinds_apm.cc +21 -0
  37. data/ext/oboe_metal/src/logging.cc +95 -0
  38. data/ext/oboe_metal/src/logging.h +35 -0
  39. data/ext/oboe_metal/src/oboe.h +1169 -0
  40. data/ext/oboe_metal/src/oboe_api.cpp +658 -0
  41. data/ext/oboe_metal/src/oboe_api.hpp +433 -0
  42. data/ext/oboe_metal/src/oboe_debug.h +59 -0
  43. data/ext/oboe_metal/src/oboe_swig_wrap.cc +7562 -0
  44. data/ext/oboe_metal/src/profiling.cc +435 -0
  45. data/ext/oboe_metal/src/profiling.h +78 -0
  46. data/ext/oboe_metal/test/CMakeLists.txt +53 -0
  47. data/ext/oboe_metal/test/FindGMock.cmake +43 -0
  48. data/ext/oboe_metal/test/README.md +56 -0
  49. data/ext/oboe_metal/test/frames_test.cc +164 -0
  50. data/ext/oboe_metal/test/profiling_test.cc +93 -0
  51. data/ext/oboe_metal/test/ruby_inc_dir.rb +8 -0
  52. data/ext/oboe_metal/test/ruby_prefix.rb +8 -0
  53. data/ext/oboe_metal/test/ruby_test_helper.rb +67 -0
  54. data/ext/oboe_metal/test/test.h +11 -0
  55. data/ext/oboe_metal/test/test_main.cc +32 -0
  56. data/init.rb +4 -0
  57. data/lib/oboe.rb +7 -0
  58. data/lib/oboe_metal.rb +172 -0
  59. data/lib/rails/generators/solarwinds_apm/install_generator.rb +47 -0
  60. data/lib/rails/generators/solarwinds_apm/templates/solarwinds_apm_initializer.rb +424 -0
  61. data/lib/solarwinds_apm/api/layerinit.rb +41 -0
  62. data/lib/solarwinds_apm/api/logging.rb +356 -0
  63. data/lib/solarwinds_apm/api/memcache.rb +37 -0
  64. data/lib/solarwinds_apm/api/metrics.rb +63 -0
  65. data/lib/solarwinds_apm/api/util.rb +98 -0
  66. data/lib/solarwinds_apm/api.rb +21 -0
  67. data/lib/solarwinds_apm/base.rb +160 -0
  68. data/lib/solarwinds_apm/config.rb +301 -0
  69. data/lib/solarwinds_apm/frameworks/grape.rb +96 -0
  70. data/lib/solarwinds_apm/frameworks/padrino.rb +78 -0
  71. data/lib/solarwinds_apm/frameworks/rails/inst/action_controller.rb +100 -0
  72. data/lib/solarwinds_apm/frameworks/rails/inst/action_controller5.rb +50 -0
  73. data/lib/solarwinds_apm/frameworks/rails/inst/action_controller_api.rb +50 -0
  74. data/lib/solarwinds_apm/frameworks/rails/inst/action_view.rb +88 -0
  75. data/lib/solarwinds_apm/frameworks/rails/inst/active_record.rb +26 -0
  76. data/lib/solarwinds_apm/frameworks/rails/inst/connection_adapters/mysql2.rb +29 -0
  77. data/lib/solarwinds_apm/frameworks/rails/inst/connection_adapters/postgresql.rb +22 -0
  78. data/lib/solarwinds_apm/frameworks/rails/inst/connection_adapters/utils5x.rb +103 -0
  79. data/lib/solarwinds_apm/frameworks/rails/inst/logger_formatters.rb +14 -0
  80. data/lib/solarwinds_apm/frameworks/rails.rb +100 -0
  81. data/lib/solarwinds_apm/frameworks/sinatra.rb +96 -0
  82. data/lib/solarwinds_apm/inst/bunny-client.rb +157 -0
  83. data/lib/solarwinds_apm/inst/bunny-consumer.rb +102 -0
  84. data/lib/solarwinds_apm/inst/curb.rb +288 -0
  85. data/lib/solarwinds_apm/inst/dalli.rb +89 -0
  86. data/lib/solarwinds_apm/inst/delayed_job.rb +100 -0
  87. data/lib/solarwinds_apm/inst/excon.rb +113 -0
  88. data/lib/solarwinds_apm/inst/faraday.rb +96 -0
  89. data/lib/solarwinds_apm/inst/graphql.rb +206 -0
  90. data/lib/solarwinds_apm/inst/grpc_client.rb +147 -0
  91. data/lib/solarwinds_apm/inst/grpc_server.rb +119 -0
  92. data/lib/solarwinds_apm/inst/httpclient.rb +181 -0
  93. data/lib/solarwinds_apm/inst/logger_formatter.rb +46 -0
  94. data/lib/solarwinds_apm/inst/logging_log_event.rb +24 -0
  95. data/lib/solarwinds_apm/inst/lumberjack_formatter.rb +9 -0
  96. data/lib/solarwinds_apm/inst/memcached.rb +86 -0
  97. data/lib/solarwinds_apm/inst/mongo.rb +246 -0
  98. data/lib/solarwinds_apm/inst/mongo2.rb +225 -0
  99. data/lib/solarwinds_apm/inst/moped.rb +466 -0
  100. data/lib/solarwinds_apm/inst/net_http.rb +60 -0
  101. data/lib/solarwinds_apm/inst/rack.rb +217 -0
  102. data/lib/solarwinds_apm/inst/rack_cache.rb +35 -0
  103. data/lib/solarwinds_apm/inst/redis.rb +273 -0
  104. data/lib/solarwinds_apm/inst/resque.rb +129 -0
  105. data/lib/solarwinds_apm/inst/rest-client.rb +43 -0
  106. data/lib/solarwinds_apm/inst/sequel.rb +241 -0
  107. data/lib/solarwinds_apm/inst/sidekiq-client.rb +63 -0
  108. data/lib/solarwinds_apm/inst/sidekiq-worker.rb +64 -0
  109. data/lib/solarwinds_apm/inst/typhoeus.rb +90 -0
  110. data/lib/solarwinds_apm/instrumentation.rb +22 -0
  111. data/lib/solarwinds_apm/loading.rb +65 -0
  112. data/lib/solarwinds_apm/logger.rb +14 -0
  113. data/lib/solarwinds_apm/noop/README.md +9 -0
  114. data/lib/solarwinds_apm/noop/context.rb +26 -0
  115. data/lib/solarwinds_apm/noop/metadata.rb +25 -0
  116. data/lib/solarwinds_apm/noop/profiling.rb +21 -0
  117. data/lib/solarwinds_apm/oboe_init_options.rb +191 -0
  118. data/lib/solarwinds_apm/ruby.rb +35 -0
  119. data/lib/solarwinds_apm/sdk/current_trace_info.rb +123 -0
  120. data/lib/solarwinds_apm/sdk/custom_metrics.rb +94 -0
  121. data/lib/solarwinds_apm/sdk/logging.rb +37 -0
  122. data/lib/solarwinds_apm/sdk/trace_context_headers.rb +69 -0
  123. data/lib/solarwinds_apm/sdk/tracing.rb +432 -0
  124. data/lib/solarwinds_apm/support/profiling.rb +22 -0
  125. data/lib/solarwinds_apm/support/trace_context.rb +53 -0
  126. data/lib/solarwinds_apm/support/trace_state.rb +69 -0
  127. data/lib/solarwinds_apm/support/trace_string.rb +89 -0
  128. data/lib/solarwinds_apm/support/transaction_metrics.rb +67 -0
  129. data/lib/solarwinds_apm/support/transaction_settings.rb +233 -0
  130. data/lib/solarwinds_apm/support/x_trace_options.rb +113 -0
  131. data/lib/solarwinds_apm/support.rb +12 -0
  132. data/lib/solarwinds_apm/support_report.rb +113 -0
  133. data/lib/solarwinds_apm/test.rb +165 -0
  134. data/lib/solarwinds_apm/thread_local.rb +26 -0
  135. data/lib/solarwinds_apm/util.rb +334 -0
  136. data/lib/solarwinds_apm/version.rb +17 -0
  137. data/lib/solarwinds_apm.rb +72 -0
  138. data/log/.keep +0 -0
  139. data/log/postgresql/.keep +0 -0
  140. data/solarwinds_apm.gemspec +52 -0
  141. data/yardoc_frontpage.md +24 -0
  142. metadata +228 -0
@@ -0,0 +1,424 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright (c) 2019 SolarWinds, LLC.
4
+ # All rights reserved.
5
+
6
+ # SolarWindsAPM Configuration for the Ruby Agent aka solarwinds_apm gem
7
+ # https://cloud.solarwinds.com/
8
+ #
9
+ # More information on configuring the Ruby Agent can be found here:
10
+ # https://documentation.solarwinds.com/en/success_center/swaas/default.htm#cshid=config-ruby-agent
11
+ #
12
+ # The initial settings in this file represent the defaults
13
+
14
+ if defined?(SolarWindsAPM::Config)
15
+
16
+ # :service_key, :hostname_alias, :http_proxy, and :debug_level
17
+ # are startup settings and can't be changed afterwards.
18
+
19
+ #
20
+ # Set SW_APM_SERVICE_KEY
21
+ # This setting will be overridden if SW_APM_SERVICE_KEY is set as an environment variable.
22
+ # This is a required setting. If the service key is not set here it needs to be set as environment variable.
23
+ #
24
+ # The service key is a combination of the API token plus a service name.
25
+ # E.g.: 0123456789abcde0123456789abcde0123456789abcde0123456789abcde1234:my_service
26
+ #
27
+ # SolarWindsAPM::Config[:service_key] = '0123456789abcde0123456789abcde0123456789abcde0123456789abcde1234:my_service'
28
+
29
+ #
30
+ # Set SW_APM_HOSTNAME_ALIAS
31
+ # This setting will be overridden if SW_APM_HOSTNAME_ALIAS is set as an environment variable
32
+ #
33
+ # SolarWindsAPM::Config[:hostname_alias] = 'alias_name'
34
+
35
+ #
36
+ # Set Proxy for SolarWinds # This setting will be overridden if SW_APM_PROXY is set as an environment variable.
37
+ #
38
+ # Please configure http_proxy if a proxy needs to be used to communicate with
39
+ # the SolarWinds APM collector.
40
+ # The format should either be http://<proxyHost>:<proxyPort> for a proxy
41
+ # server that does not require authentication, or
42
+ # http://<username>:<password>@<proxyHost>:<proxyPort> for a proxy server that
43
+ # requires basic authentication.
44
+ #
45
+ # Note that while HTTP is the only type of connection supported, the traffic
46
+ # to SolarWinds is still encrypted using SSL/TLS.
47
+ #
48
+ # It is recommended to configure the proxy in this file or as SW_APM_PROXY
49
+ # environment variable. However, the agent's underlying network library will
50
+ # use a system-wide proxy defined in the environment variables grpc_proxy,
51
+ # https_proxy or http_proxy if no SolarWindsAPM-specific configuration is set.
52
+ # Please refer to gRPC environment variables for more information.
53
+ #
54
+ # SolarWindsAPM::Config[:http_proxy] = http://<proxyHost>:<proxyPort>
55
+
56
+ #
57
+ # Set SW_APM_DEBUG_LEVEL
58
+ # This setting will be overridden if SW_APM_DEBUG_LEVEL is set as an environment variable.
59
+ #
60
+ # It sets the log level and takes the following values:
61
+ # -1 disabled, 0 fatal, 1 error, 2 warning, 3 info (the default), 4 debug low, 5 debug medium, 6 debug high.
62
+ # Values out of range (< -1 or > 6) are ignored and the log level is set to the default (info).
63
+ #
64
+ SolarWindsAPM::Config[:debug_level] = 3
65
+
66
+ #
67
+ # :debug_level will be used in the c-extension of the gem and also mapped to the
68
+ # Ruby logger as DISABLED, FATAL, ERROR, WARN, INFO, or DEBUG
69
+ # The Ruby logger can afterwards be changed to a different level, e.g:
70
+ # SolarWindsAPM.logger.level = Logger::INFO
71
+
72
+ #
73
+ # Set SW_APM_GEM_VERBOSE
74
+ # This setting will be overridden if SW_APM_GEM_VERBOSE is set as an environment variable
75
+ #
76
+ # On startup the components that are being instrumented will be reported if this is set to true.
77
+ # If true and the log level is 4 or higher this may create extra debug log messages
78
+ #
79
+ SolarWindsAPM::Config[:verbose] = false
80
+
81
+ #
82
+ # Turn code profiling on or off
83
+ #
84
+ # By default profiling is set to :disabled, the other option is :enabled.
85
+ # :enabled means that any traced code will also be profiled to get deeper insight
86
+ # into the methods called during a trace.
87
+ # Profiling in the solarwinds_apm gem is based on the low-overhead, sampling
88
+ # profiler implemented in stackprof.
89
+ #
90
+ SolarWindsAPM::Config[:profiling] = :disabled
91
+
92
+ #
93
+ # Set the profiling interval (in milliseconds)
94
+ #
95
+ # The default is 10 milliseconds, which means that the method call stack is
96
+ # recorded every 10 milliseconds. Shorter intervals may give better insight,
97
+ # but will incur more overhead.
98
+ # Minimum: 1, Maximum: 100
99
+ #
100
+ SolarWindsAPM::Config[:profiling_interval] = 10
101
+
102
+ #
103
+ # Turn Tracing on or off
104
+ #
105
+ # By default tracing is set to :enabled, the other option is :disabled.
106
+ # :enabled means that sampling will be done according to the current
107
+ # sampling rate and metrics are reported.
108
+ # :disabled means that there is no sampling and metrics are not reported.
109
+ #
110
+ # The values :always and :never are deprecated
111
+ #
112
+ SolarWindsAPM::Config[:tracing_mode] = :enabled
113
+
114
+ #
115
+ # Turn Trigger Tracing on or off
116
+ #
117
+ # By default trigger tracing is :enabled, the other option is :disabled.
118
+ # It allows to use the X-Trace-Options header to force a request to be
119
+ # traced (within rate limits set for trigger tracing)
120
+ #
121
+ SolarWindsAPM::Config[:trigger_tracing_mode] = :enabled
122
+
123
+ #
124
+ # Trace Context in Logs
125
+ #
126
+ # Configure if and when the Trace ID should be included in application logs.
127
+ # Common Ruby and Rails loggers are auto-instrumented, so that they can include
128
+ # the current Trace ID in log messages.
129
+ #
130
+ # The added string will look like:
131
+ # "trace_id=7435a9fe510ae4533414d425dadf4e18 span_id=49e60702469db05f trace_flags=00"
132
+ #
133
+ # The following options are available:
134
+ # :never (default)
135
+ # :sampled only include the Trace ID of sampled requests
136
+ # :traced include the Trace ID for all traced requests
137
+ # :always always add a Trace ID, it will be
138
+ # "trace_id=00000000000000000000000000000000 span_id=0000000000000000 trace_flags=00"
139
+ # when there is no tracing context.
140
+ #
141
+ SolarWindsAPM::Config[:log_traceId] = :never
142
+
143
+ #
144
+ # Trace Context in Queries (sql only)
145
+ #
146
+ # Configure to add the trace context to sql queries so that queries and
147
+ # transactions can be linked in the SolarWinds dashboard
148
+ #
149
+ # This option can add a small overhead for queries that use prepared
150
+ # statements as those statements will be recompiled whenever the trace context
151
+ # is added (about 10% of the requests)
152
+ #
153
+ # the options are:
154
+ # - true (default) no trace context is added
155
+ # - false the tracecontext is added as comment to the start of the query, e.g:
156
+ # "/*traceparent='00-268748089f148899e29fc5711aca7760-7c6c704dcbba6682-01'*/SELECT `widgets`.* FROM `widgets` WHERE ..."
157
+ #
158
+ SolarWindsAPM::Config[:tag_sql] = false
159
+
160
+ #
161
+ # Sanitize SQL Statements
162
+ #
163
+ # The SolarWindsAPM Ruby client has the ability to sanitize query literals
164
+ # from SQL statements. By default this is enabled. Disable to
165
+ # collect and report query literals to SolarWindsAPM.
166
+ #
167
+ SolarWindsAPM::Config[:sanitize_sql] = true
168
+ SolarWindsAPM::Config[:sanitize_sql_regexp] = '(\'[^\']*\'|\d*\.\d+|\d+|NULL)'
169
+ SolarWindsAPM::Config[:sanitize_sql_opts] = Regexp::IGNORECASE
170
+
171
+ #
172
+ # Prepend Domain to Transaction Name
173
+ #
174
+ # If this is set to `true` transaction names will be composed as
175
+ # `my.host.com/controller.action` instead of `controller.action`.
176
+ # This configuration applies to all transaction names, whether deduced by the
177
+ # instrumentation or implicitly set.
178
+ #
179
+ SolarWindsAPM::Config[:transaction_name][:prepend_domain] = false
180
+
181
+ #
182
+ # Do Not Trace - DNT
183
+ #
184
+ # DEPRECATED
185
+ # Please comment out if no filtering is desired, e.g. your static
186
+ # assets are served by the web server and not the application
187
+ #
188
+ # This configuration allows creating a regexp for paths that should be excluded
189
+ # from solarwinds_apm processing.
190
+ #
191
+ # For example:
192
+ # - static assets that aren't served by the web server, or
193
+ # - healthcheck endpoints that respond to a heart beat.
194
+ #
195
+ # :dnt_regexp is the regular expression that is applied to the incoming path
196
+ # to determine whether the request should be measured and traced or not.
197
+ #
198
+ # :dnt_opts can be commented out, nil, or Regexp::IGNORECASE
199
+ #
200
+ # The matching happens before routes are applied.
201
+ # The path originates from the rack layer and is retrieved as follows:
202
+ # req = ::Rack::Request.new(env)
203
+ # path = URI.unescape(req.path)
204
+ #
205
+ SolarWindsAPM::Config[:dnt_regexp] = '\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|pdf|txt|tar|wav|bmp|rtf|js|flv|swf|otf|eot|ttf|woff|woff2|svg|less)(\?.+){0,1}$'
206
+ SolarWindsAPM::Config[:dnt_opts] = Regexp::IGNORECASE
207
+
208
+ #
209
+ # GraphQL
210
+ #
211
+ # Enable tracing for GraphQL.
212
+ # (true | false, default: true)
213
+ SolarWindsAPM::Config[:graphql][:enabled] = true
214
+ # Replace query arguments with a '?' when sent with a trace.
215
+ # (true | false, default: true)
216
+ SolarWindsAPM::Config[:graphql][:sanitize] = true
217
+ # Remove comments from queries when sent with a trace.
218
+ # (true | false, default: true)
219
+ SolarWindsAPM::Config[:graphql][:remove_comments] = true
220
+ # Create a transaction name by combining
221
+ # "query" or "mutation" with the first word of the query.
222
+ # This overwrites the default transaction name, which is a combination of
223
+ # controller + action and would be the same for all graphql queries.
224
+ # (true | false, default: true)
225
+ SolarWindsAPM::Config[:graphql][:transaction_name] = true
226
+
227
+ #
228
+ # Rack::Cache
229
+ #
230
+ # Create a transaction name like `rack-cache.<cache-store>`,
231
+ # e.g. `rack-cache.memcached`
232
+ # This can reduce the number of transaction names, when many requests are
233
+ # served directly from the cache without hitting a controller action.
234
+ # When set to `false` the path will be used for the transaction name.
235
+ #
236
+ SolarWindsAPM::Config[:rack_cache] = { transaction_name: true }
237
+
238
+ #
239
+ # Transaction Settings
240
+ #
241
+ # Use this configuration to add exceptions to the global tracing mode and
242
+ # disable/enable metrics and traces for certain transactions.
243
+ #
244
+ # Currently allowed hash keys:
245
+ # :url to apply listed filters to urls.
246
+ # The matching of settings to urls happens before routes are applied.
247
+ # The url is extracted from the env argument passed to rack: `env['PATH_INFO']`
248
+ #
249
+ # and the hashes within the :url list either:
250
+ # :extensions takes an array of strings for filtering (not regular expressions!)
251
+ # :tracing defaults to :disabled, can be set to :enabled to override
252
+ # the global :disabled setting
253
+ # or:
254
+ # :regexp is a regular expression that is applied to the incoming path
255
+ # :opts (optional) nil(default) or Regexp::IGNORECASE (options for regexp)
256
+ # :tracing defaults to :disabled, can be set to :enabled to override
257
+ # the global :disabled setting
258
+ #
259
+ # Be careful not to add too many :regexp configurations as they will slow
260
+ # down execution.
261
+ #
262
+ SolarWindsAPM::Config[:transaction_settings] = {
263
+ url: [
264
+ # {
265
+ # extensions: %w['long_job'],
266
+ # tracing: :disabled
267
+ # },
268
+ # {
269
+ # regexp: '^.*\/long_job\/.*$',
270
+ # opts: Regexp::IGNORECASE,
271
+ # tracing: :disabled
272
+ # },
273
+ # {
274
+ # regexp: /batch/,
275
+ # }
276
+ ]
277
+ }
278
+
279
+ #
280
+ # Rails Exception Logging
281
+ #
282
+ # In Rails, raised exceptions with rescue handlers via
283
+ # <tt>rescue_from</tt> are not reported to the SolarWinds # dashboard by default. Setting this value to true will
284
+ # report all raised exceptions regardless.
285
+ #
286
+ SolarWindsAPM::Config[:report_rescued_errors] = false
287
+
288
+ #
289
+ # EC2 Metadata Fetching Timeout
290
+ #
291
+ # The timeout can be in the range 0 - 3000 (milliseconds)
292
+ # Setting to 0 milliseconds effectively disables fetching from
293
+ # the metadata URL (not waiting), and should only be used if
294
+ # not running on EC2 / Openstack to minimize agent start up time.
295
+ #
296
+ SolarWindsAPM::Config[:ec2_metadata_timeout] = 1000
297
+
298
+ #############################################
299
+ ## SETTINGS FOR INDIVIDUAL GEMS/FRAMEWORKS ##
300
+ #############################################
301
+
302
+ #
303
+ # Bunny Controller and Action
304
+ #
305
+ # The bunny (Rabbitmq) instrumentation can optionally report
306
+ # Controller and Action values to allow filtering of bunny
307
+ # message handling in # the UI. Use of Controller and Action
308
+ # for filters is temporary until the UI is updated with
309
+ # additional filters.
310
+ #
311
+ # These values identify which properties of
312
+ # Bunny::MessageProperties to report as Controller
313
+ # and Action. The defaults are to report :app_id (as
314
+ # Controller) and :type (as Action). If these values
315
+ # are not specified in the publish, then nothing
316
+ # will be reported here.
317
+ #
318
+ SolarWindsAPM::Config[:bunnyconsumer][:controller] = :app_id
319
+ SolarWindsAPM::Config[:bunnyconsumer][:action] = :type
320
+
321
+ #
322
+ # Enabling/Disabling Instrumentation
323
+ #
324
+ # If you're having trouble with one of the instrumentation libraries, they
325
+ # can be individually disabled here by setting the :enabled
326
+ # value to false.
327
+ #
328
+ # :enabled settings are read on startup and can't be changed afterwards
329
+ #
330
+ SolarWindsAPM::Config[:action_controller][:enabled] = true
331
+ SolarWindsAPM::Config[:action_controller_api][:enabled] = true
332
+ SolarWindsAPM::Config[:action_view][:enabled] = true
333
+ SolarWindsAPM::Config[:active_record][:enabled] = true
334
+ SolarWindsAPM::Config[:bunnyclient][:enabled] = true
335
+ SolarWindsAPM::Config[:bunnyconsumer][:enabled] = true
336
+ SolarWindsAPM::Config[:curb][:enabled] = true
337
+ SolarWindsAPM::Config[:dalli][:enabled] = true
338
+ SolarWindsAPM::Config[:delayed_jobclient][:enabled] = true
339
+ SolarWindsAPM::Config[:delayed_jobworker][:enabled] = true
340
+ SolarWindsAPM::Config[:excon][:enabled] = true
341
+ SolarWindsAPM::Config[:faraday][:enabled] = true
342
+ SolarWindsAPM::Config[:grpc_client][:enabled] = true
343
+ SolarWindsAPM::Config[:grpc_server][:enabled] = true
344
+ SolarWindsAPM::Config[:grape][:enabled] = true
345
+ SolarWindsAPM::Config[:httpclient][:enabled] = true
346
+ SolarWindsAPM::Config[:memcached][:enabled] = true
347
+ SolarWindsAPM::Config[:mongo][:enabled] = true
348
+ SolarWindsAPM::Config[:moped][:enabled] = true
349
+ SolarWindsAPM::Config[:nethttp][:enabled] = true
350
+ SolarWindsAPM::Config[:padrino][:enabled] = true
351
+ SolarWindsAPM::Config[:rack][:enabled] = true
352
+ SolarWindsAPM::Config[:redis][:enabled] = true
353
+ SolarWindsAPM::Config[:resqueclient][:enabled] = true
354
+ SolarWindsAPM::Config[:resqueworker][:enabled] = true
355
+ SolarWindsAPM::Config[:rest_client][:enabled] = true
356
+ SolarWindsAPM::Config[:sequel][:enabled] = true
357
+ SolarWindsAPM::Config[:sidekiqclient][:enabled] = true
358
+ SolarWindsAPM::Config[:sidekiqworker][:enabled] = true
359
+ SolarWindsAPM::Config[:sinatra][:enabled] = true
360
+ SolarWindsAPM::Config[:typhoeus][:enabled] = true
361
+
362
+ #
363
+ # Argument logging
364
+ #
365
+ #
366
+ # For http requests:
367
+ # By default the query string parameters are included in the URLs reported.
368
+ # Set :log_args to false and instrumentation will stop collecting
369
+ # and reporting query arguments from URLs.
370
+ #
371
+ SolarWindsAPM::Config[:bunnyconsumer][:log_args] = true
372
+ SolarWindsAPM::Config[:curb][:log_args] = true
373
+ SolarWindsAPM::Config[:excon][:log_args] = true
374
+ SolarWindsAPM::Config[:httpclient][:log_args] = true
375
+ SolarWindsAPM::Config[:mongo][:log_args] = true
376
+ SolarWindsAPM::Config[:nethttp][:log_args] = true
377
+ SolarWindsAPM::Config[:rack][:log_args] = true
378
+ SolarWindsAPM::Config[:resqueclient][:log_args] = true
379
+ SolarWindsAPM::Config[:resqueworker][:log_args] = true
380
+ SolarWindsAPM::Config[:sidekiqclient][:log_args] = true
381
+ SolarWindsAPM::Config[:sidekiqworker][:log_args] = true
382
+ SolarWindsAPM::Config[:typhoeus][:log_args] = true
383
+
384
+ #
385
+ # Enabling/Disabling Backtrace Collection
386
+ #
387
+ # Instrumentation can optionally collect backtraces as they collect
388
+ # performance metrics. Note that this has a negative impact on
389
+ # performance but can be useful when trying to locate the source of
390
+ # a certain call or operation.
391
+ #
392
+ SolarWindsAPM::Config[:action_controller][:collect_backtraces] = true
393
+ SolarWindsAPM::Config[:action_controller_api][:collect_backtraces] = true
394
+ SolarWindsAPM::Config[:action_view][:collect_backtraces] = true
395
+ SolarWindsAPM::Config[:active_record][:collect_backtraces] = true
396
+ SolarWindsAPM::Config[:bunnyclient][:collect_backtraces] = false
397
+ SolarWindsAPM::Config[:bunnyconsumer][:collect_backtraces] = false
398
+ SolarWindsAPM::Config[:curb][:collect_backtraces] = true
399
+ SolarWindsAPM::Config[:dalli][:collect_backtraces] = false
400
+ SolarWindsAPM::Config[:delayed_jobclient][:collect_backtraces] = false
401
+ SolarWindsAPM::Config[:delayed_jobworker][:collect_backtraces] = false
402
+ SolarWindsAPM::Config[:excon][:collect_backtraces] = true
403
+ SolarWindsAPM::Config[:faraday][:collect_backtraces] = false
404
+ SolarWindsAPM::Config[:grape][:collect_backtraces] = true
405
+ SolarWindsAPM::Config[:grpc_client][:collect_backtraces] = false
406
+ SolarWindsAPM::Config[:grpc_server][:collect_backtraces] = false
407
+ SolarWindsAPM::Config[:httpclient][:collect_backtraces] = true
408
+ SolarWindsAPM::Config[:memcached][:collect_backtraces] = false
409
+ SolarWindsAPM::Config[:mongo][:collect_backtraces] = true
410
+ SolarWindsAPM::Config[:moped][:collect_backtraces] = true
411
+ SolarWindsAPM::Config[:nethttp][:collect_backtraces] = true
412
+ SolarWindsAPM::Config[:padrino][:collect_backtraces] = true
413
+ SolarWindsAPM::Config[:rack][:collect_backtraces] = true
414
+ SolarWindsAPM::Config[:redis][:collect_backtraces] = false
415
+ SolarWindsAPM::Config[:resqueclient][:collect_backtraces] = true
416
+ SolarWindsAPM::Config[:resqueworker][:collect_backtraces] = true
417
+ SolarWindsAPM::Config[:rest_client][:collect_backtraces] = true
418
+ SolarWindsAPM::Config[:sequel][:collect_backtraces] = true
419
+ SolarWindsAPM::Config[:sidekiqclient][:collect_backtraces] = false
420
+ SolarWindsAPM::Config[:sidekiqworker][:collect_backtraces] = false
421
+ SolarWindsAPM::Config[:sinatra][:collect_backtraces] = true
422
+ SolarWindsAPM::Config[:typhoeus][:collect_backtraces] = false
423
+
424
+ end
@@ -0,0 +1,41 @@
1
+ #--
2
+ # Copyright (c) 2016 SolarWinds, LLC.
3
+ # All rights reserved.
4
+ #++
5
+
6
+ module SolarWindsAPM
7
+ module API
8
+ ##
9
+ # Provides methods related to layer initialization and reporting
10
+ module LayerInit #:nodoc:
11
+ # Internal: Report that instrumentation for the given layer has been
12
+ # installed, as well as the version of instrumentation and version of
13
+ # layer.
14
+ #
15
+ def report_init(layer = :rack) #:nodoc:
16
+ # Don't send __Init in test or if SolarWindsAPM
17
+ # isn't fully loaded (e.g. missing c-extension)
18
+ return if ENV.key?('SW_APM_GEM_TEST') || !SolarWindsAPM.loaded
19
+
20
+ platform_info = SolarWindsAPM::Util.build_init_report
21
+ log_init(layer, platform_info)
22
+ end
23
+
24
+ ##
25
+ # :nodoc:
26
+ # Deprecated:
27
+ # force_trace has been deprecated and will be removed in a subsequent version.
28
+ #
29
+ def force_trace
30
+ SolarWindsAPM.logger.warn '[solarwinds_apm/api] SolarWindsAPM::API::LayerInit.force_trace has been deprecated and will be ' \
31
+ 'removed in a subsequent version.'
32
+
33
+ saved_mode = SolarWindsAPM::Config[:tracing_mode]
34
+ SolarWindsAPM::Config[:tracing_mode] = :enabled
35
+ yield
36
+ ensure
37
+ SolarWindsAPM::Config[:tracing_mode] = saved_mode
38
+ end
39
+ end
40
+ end
41
+ end