elastic-apm 3.4.0 → 3.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (165) hide show
  1. checksums.yaml +4 -4
  2. data/.ci/.jenkins_exclude.yml +39 -20
  3. data/.ci/.jenkins_framework.yml +2 -2
  4. data/.ci/Jenkinsfile +286 -170
  5. data/.ci/docker/jruby/11-jdk/Dockerfile +40 -0
  6. data/.ci/docker/jruby/12-jdk/Dockerfile +40 -0
  7. data/.ci/docker/jruby/13-jdk/Dockerfile +40 -0
  8. data/.ci/docker/jruby/7-jdk/Dockerfile +40 -0
  9. data/.ci/docker/jruby/8-jdk/Dockerfile +40 -0
  10. data/.ci/docker/jruby/README.md +31 -0
  11. data/.ci/docker/jruby/run.sh +73 -0
  12. data/.ci/docker/jruby/test.sh +13 -0
  13. data/.ci/jobs/defaults.yml +1 -1
  14. data/.ci/packer_cache.sh +16 -0
  15. data/.github/ISSUE_TEMPLATE/Bug_report.md +13 -11
  16. data/.github/ISSUE_TEMPLATE/Feature_request.md +8 -8
  17. data/.github/PULL_REQUEST_TEMPLATE.md +51 -5
  18. data/.gitignore +5 -0
  19. data/.rspec +0 -1
  20. data/.rubocop.yml +13 -1
  21. data/CHANGELOG.asciidoc +94 -1
  22. data/CONTRIBUTING.md +6 -48
  23. data/Gemfile +34 -9
  24. data/README.md +62 -13
  25. data/Rakefile +37 -5
  26. data/bin/run-tests +4 -1
  27. data/docker-compose.yml +7 -0
  28. data/docs/api.asciidoc +15 -3
  29. data/docs/configuration.asciidoc +164 -32
  30. data/docs/debugging.asciidoc +14 -0
  31. data/docs/getting-started-rails.asciidoc +2 -0
  32. data/docs/graphql.asciidoc +23 -0
  33. data/docs/images/dynamic-config.svg +1 -0
  34. data/docs/index.asciidoc +6 -1
  35. data/docs/introduction.asciidoc +2 -1
  36. data/docs/performance-tuning.asciidoc +106 -0
  37. data/docs/set-up.asciidoc +5 -2
  38. data/docs/supported-technologies.asciidoc +68 -1
  39. data/docs/upgrading.asciidoc +45 -0
  40. data/elastic-apm.gemspec +17 -0
  41. data/lib/elastic-apm.rb +17 -0
  42. data/lib/elastic_apm.rb +29 -0
  43. data/lib/elastic_apm/agent.rb +49 -2
  44. data/lib/elastic_apm/central_config.rb +27 -8
  45. data/lib/elastic_apm/central_config/cache_control.rb +17 -0
  46. data/lib/elastic_apm/child_durations.rb +17 -0
  47. data/lib/elastic_apm/config.rb +82 -7
  48. data/lib/elastic_apm/config/bytes.rb +17 -0
  49. data/lib/elastic_apm/config/duration.rb +17 -0
  50. data/lib/elastic_apm/config/options.rb +18 -1
  51. data/lib/elastic_apm/config/regexp_list.rb +17 -0
  52. data/lib/elastic_apm/config/wildcard_pattern_list.rb +20 -1
  53. data/lib/elastic_apm/context.rb +17 -0
  54. data/lib/elastic_apm/context/request.rb +17 -0
  55. data/lib/elastic_apm/context/request/socket.rb +17 -0
  56. data/lib/elastic_apm/context/request/url.rb +17 -0
  57. data/lib/elastic_apm/context/response.rb +18 -1
  58. data/lib/elastic_apm/context/user.rb +17 -0
  59. data/lib/elastic_apm/context_builder.rb +17 -0
  60. data/lib/elastic_apm/deprecations.rb +17 -0
  61. data/lib/elastic_apm/error.rb +17 -0
  62. data/lib/elastic_apm/error/exception.rb +17 -0
  63. data/lib/elastic_apm/error/log.rb +17 -0
  64. data/lib/elastic_apm/error_builder.rb +17 -0
  65. data/lib/elastic_apm/grape.rb +17 -0
  66. data/lib/elastic_apm/graphql.rb +91 -0
  67. data/lib/elastic_apm/grpc.rb +99 -0
  68. data/lib/elastic_apm/instrumenter.rb +29 -4
  69. data/lib/elastic_apm/internal_error.rb +17 -0
  70. data/lib/elastic_apm/logging.rb +17 -0
  71. data/lib/elastic_apm/metadata.rb +17 -0
  72. data/lib/elastic_apm/metadata/process_info.rb +17 -0
  73. data/lib/elastic_apm/metadata/service_info.rb +22 -2
  74. data/lib/elastic_apm/metadata/system_info.rb +17 -0
  75. data/lib/elastic_apm/metadata/system_info/container_info.rb +17 -0
  76. data/lib/elastic_apm/metrics.rb +33 -1
  77. data/lib/elastic_apm/metrics/breakdown_set.rb +17 -0
  78. data/lib/elastic_apm/metrics/cpu_mem_set.rb +17 -0
  79. data/lib/elastic_apm/metrics/metric.rb +23 -4
  80. data/lib/elastic_apm/metrics/set.rb +17 -0
  81. data/lib/elastic_apm/metrics/span_scoped_set.rb +17 -0
  82. data/lib/elastic_apm/metrics/transaction_set.rb +17 -0
  83. data/lib/elastic_apm/metrics/vm_set.rb +17 -0
  84. data/lib/elastic_apm/metricset.rb +17 -0
  85. data/lib/elastic_apm/middleware.rb +20 -4
  86. data/lib/elastic_apm/naively_hashable.rb +17 -0
  87. data/lib/elastic_apm/normalizers.rb +17 -0
  88. data/lib/elastic_apm/normalizers/grape.rb +17 -0
  89. data/lib/elastic_apm/normalizers/grape/endpoint_run.rb +18 -1
  90. data/lib/elastic_apm/normalizers/rails.rb +17 -0
  91. data/lib/elastic_apm/normalizers/rails/action_controller.rb +17 -0
  92. data/lib/elastic_apm/normalizers/rails/action_mailer.rb +17 -0
  93. data/lib/elastic_apm/normalizers/rails/action_view.rb +17 -0
  94. data/lib/elastic_apm/normalizers/rails/active_record.rb +17 -0
  95. data/lib/elastic_apm/opentracing.rb +66 -24
  96. data/lib/elastic_apm/rails.rb +17 -0
  97. data/lib/elastic_apm/railtie.rb +17 -0
  98. data/lib/elastic_apm/resque.rb +29 -0
  99. data/lib/elastic_apm/sinatra.rb +17 -0
  100. data/lib/elastic_apm/span.rb +17 -0
  101. data/lib/elastic_apm/span/context.rb +17 -0
  102. data/lib/elastic_apm/span/context/db.rb +26 -2
  103. data/lib/elastic_apm/span/context/destination.rb +37 -4
  104. data/lib/elastic_apm/span/context/http.rb +17 -0
  105. data/lib/elastic_apm/span_helpers.rb +17 -0
  106. data/lib/elastic_apm/spies.rb +33 -14
  107. data/lib/elastic_apm/spies/action_dispatch.rb +17 -0
  108. data/lib/elastic_apm/spies/delayed_job.rb +17 -0
  109. data/lib/elastic_apm/spies/dynamo_db.rb +58 -0
  110. data/lib/elastic_apm/spies/elasticsearch.rb +37 -2
  111. data/lib/elastic_apm/spies/faraday.rb +18 -1
  112. data/lib/elastic_apm/spies/http.rb +19 -1
  113. data/lib/elastic_apm/spies/json.rb +17 -0
  114. data/lib/elastic_apm/spies/mongo.rb +18 -1
  115. data/lib/elastic_apm/spies/net_http.rb +25 -3
  116. data/lib/elastic_apm/spies/rake.rb +17 -0
  117. data/lib/elastic_apm/spies/redis.rb +17 -0
  118. data/lib/elastic_apm/spies/resque.rb +53 -0
  119. data/lib/elastic_apm/spies/sequel.rb +31 -4
  120. data/lib/elastic_apm/spies/shoryuken.rb +17 -0
  121. data/lib/elastic_apm/spies/sidekiq.rb +17 -0
  122. data/lib/elastic_apm/spies/sinatra.rb +17 -0
  123. data/lib/elastic_apm/spies/sneakers.rb +17 -0
  124. data/lib/elastic_apm/spies/sucker_punch.rb +54 -0
  125. data/lib/elastic_apm/spies/tilt.rb +17 -0
  126. data/lib/elastic_apm/sql.rb +21 -4
  127. data/lib/elastic_apm/sql/signature.rb +17 -0
  128. data/lib/elastic_apm/sql/tokenizer.rb +17 -0
  129. data/lib/elastic_apm/sql/tokens.rb +17 -0
  130. data/lib/elastic_apm/sql_summarizer.rb +17 -0
  131. data/lib/elastic_apm/stacktrace.rb +17 -0
  132. data/lib/elastic_apm/stacktrace/frame.rb +17 -0
  133. data/lib/elastic_apm/stacktrace_builder.rb +23 -1
  134. data/lib/elastic_apm/subscriber.rb +17 -0
  135. data/lib/elastic_apm/trace_context.rb +85 -49
  136. data/lib/elastic_apm/trace_context/traceparent.rb +113 -0
  137. data/lib/elastic_apm/trace_context/tracestate.rb +43 -0
  138. data/lib/elastic_apm/transaction.rb +33 -5
  139. data/lib/elastic_apm/transport/base.rb +39 -23
  140. data/lib/elastic_apm/transport/connection.rb +17 -0
  141. data/lib/elastic_apm/transport/connection/http.rb +17 -0
  142. data/lib/elastic_apm/transport/connection/proxy_pipe.rb +22 -0
  143. data/lib/elastic_apm/transport/filters.rb +17 -0
  144. data/lib/elastic_apm/transport/filters/hash_sanitizer.rb +77 -0
  145. data/lib/elastic_apm/transport/filters/secrets_filter.rb +29 -53
  146. data/lib/elastic_apm/transport/headers.rb +17 -0
  147. data/lib/elastic_apm/transport/serializers.rb +17 -0
  148. data/lib/elastic_apm/transport/serializers/context_serializer.rb +17 -0
  149. data/lib/elastic_apm/transport/serializers/error_serializer.rb +17 -0
  150. data/lib/elastic_apm/transport/serializers/metadata_serializer.rb +44 -20
  151. data/lib/elastic_apm/transport/serializers/metricset_serializer.rb +17 -0
  152. data/lib/elastic_apm/transport/serializers/span_serializer.rb +22 -2
  153. data/lib/elastic_apm/transport/serializers/transaction_serializer.rb +17 -0
  154. data/lib/elastic_apm/transport/user_agent.rb +17 -0
  155. data/lib/elastic_apm/transport/worker.rb +17 -0
  156. data/lib/elastic_apm/util.rb +17 -0
  157. data/lib/elastic_apm/util/inflector.rb +17 -0
  158. data/lib/elastic_apm/util/lru_cache.rb +17 -0
  159. data/lib/elastic_apm/util/throttle.rb +17 -0
  160. data/lib/elastic_apm/version.rb +18 -1
  161. metadata +29 -12
  162. data/.ci/downstreamTests.groovy +0 -185
  163. data/.ci/prepare-git-context.sh +0 -27
  164. data/CHANGELOG.md +0 -1
  165. data/codecov.yml +0 -32
@@ -26,6 +26,13 @@ services:
26
26
  - /tmp:exec,mode=1777
27
27
  depends_on:
28
28
  - mongodb
29
+ user: ${USER_ID}
30
+
31
+ ruby_rspec:
32
+ image: apm-agent-ruby:${RUBY_VERSION}
33
+ environment:
34
+ MONGODB_URL: 'mongodb:27017'
35
+ user: ${USER_ID}
29
36
 
30
37
  volumes:
31
38
  vendor:
@@ -42,6 +42,18 @@ If you're not using Rails, see <<getting-started-rack,Getting started with Rack>
42
42
  Stop the currently running agent. Use this inside `at_exit` in your
43
43
  <<getting-started-rack,Rack app>> to gracefully shut down.
44
44
 
45
+ [float]
46
+ [[api-agent-restart]]
47
+ ==== `ElasticAPM.restart`
48
+
49
+ If the agent is already running, this method will stop and start the agent.
50
+
51
+ If the agent is not already running, this method will start the agent.
52
+
53
+ A config can be passed to the method that will be used to start the agent. If the agent
54
+ is already running and no config is passed to the `#restart` method, the running agent's
55
+ config will be used.
56
+
45
57
  [float]
46
58
  [[api-agent-running]]
47
59
  ==== `ElasticAPM.running?`
@@ -425,13 +437,13 @@ end
425
437
 
426
438
  [float]
427
439
  [[api-transaction-sampled_]]
428
- ==== #sampled?
440
+ ==== `#sampled?`
429
441
 
430
442
  Whether the transaction is _sampled_ eg. it includes stacktraces for its spans.
431
443
 
432
444
  [float]
433
445
  [[api-transaction-ensure_parent_id]]
434
- ==== #ensure_parent_id
446
+ ==== `#ensure_parent_id`
435
447
 
436
448
  If the transaction does not have a parent-ID yet, calling this method generates
437
449
  a new ID, sets it as the parent-ID of this transaction, and returns it as a
@@ -446,7 +458,7 @@ JavaScript RUM agent with the value of this method allows analyzing the time
446
458
  spent in the browser vs in the backend services.
447
459
 
448
460
  To enable the JavaScript RUM agent, initilialize the RUM agent with the Ruby
449
- agent'a current transaction:
461
+ agent's current transaction:
450
462
 
451
463
  [source,html]
452
464
  ----
@@ -8,28 +8,46 @@ endif::[]
8
8
  == Configuration
9
9
 
10
10
  There are several ways to configure how Elastic APM behaves.
11
-
12
- The recommended way to configure Elastic APM is to create a file
13
- `config/elastic_apm.yml` and specify options in there:
11
+ The recommended way is to specify options in a `config/elastic_apm.yml` file:
14
12
 
15
13
  [source,yaml]
16
14
  ----
17
- ---
18
15
  server_url: 'http://localhost:8200'
19
16
  secret_token: <%= ENV["VERY_SECRET_TOKEN"] %>
20
17
  ----
21
18
 
19
+ Some options can be set with `ENV` variables.
20
+ When using this method, strings are split by comma, e.g.,
21
+ `ELASTIC_APM_SANITIZE_FIELD_NAMES="a,b" # => [/a/, /b/]`.
22
+
23
+ [float]
24
+ [[configuration-precedence]]
25
+ === Configuration precedence
26
+
22
27
  Options are applied in the following order (last one wins):
23
28
 
24
29
  1. Defaults
25
30
  2. Arguments to `ElasticAPM.start` / `Config.new`
26
- 3. Config file eg. `config/elastic_apm.yml`
31
+ 3. Config file, e.g., `config/elastic_apm.yml`
27
32
  4. Environment variables
33
+ 5. {apm-app-ref}/agent-configuration.html[Central configuration]
34
+ (supported options are marked with <<dynamic-configuration, image:./images/dynamic-config.svg[] >>)
35
+
36
+ [float]
37
+ [[dynamic-configuration]]
38
+ === Dynamic configuration
39
+
40
+ Configuration options marked with the image:./images/dynamic-config.svg[] badge can be changed at runtime
41
+ when set from a supported source.
42
+
43
+ The Agent supports {apm-app-ref}/agent-configuration.html[Central configuration],
44
+ which allows you to fine-tune certain configurations via the APM app.
45
+ This feature is enabled in the Agent by default, with <<config-central-config>>.
28
46
 
29
47
  [float]
30
48
  === Ruby on Rails
31
49
 
32
- When using Rails it's also possible to specify options inside
50
+ When using Rails, it's possible to specify options inside
33
51
  `config/application.rb`:
34
52
 
35
53
  [source,ruby]
@@ -41,7 +59,7 @@ config.elastic_apm.service_name = 'MyApp'
41
59
  [float]
42
60
  === Sinatra and Rack
43
61
 
44
- When using APM with Sinatra and Rack you can configure it when starting
62
+ When using Sinatra and Rack, you can configure when starting
45
63
  the agent:
46
64
 
47
65
  [source,ruby]
@@ -53,7 +71,7 @@ ElasticAPM.start(
53
71
  )
54
72
  ----
55
73
 
56
- Alternatively, you can use the `ElasticAPM::Sinatra.start` API.
74
+ Alternatively, you can use the `ElasticAPM::Sinatra.start` API:
57
75
 
58
76
  [source,ruby]
59
77
  ----
@@ -69,7 +87,7 @@ See <<getting-started-rack>>.
69
87
  [float]
70
88
  === Grape and Rack
71
89
 
72
- When using APM with Grape and Rack (without Rails), you can configure it when starting
90
+ When using Grape and Rack (without Rails), you can configure when starting
73
91
  the agent:
74
92
 
75
93
  [source,ruby]
@@ -86,12 +104,6 @@ See <<getting-started-rack>>.
86
104
  [float]
87
105
  === Options
88
106
 
89
- Some options can be set with `ENV` variables and all of them may be set in
90
- your source code.
91
-
92
- When setting values for lists using `ENV` variables, strings are split by comma
93
- eg `ELASTIC_APM_CUSTOM_KEY_FILTERS="a,b" # => [/a/, /b/]`.
94
-
95
107
  [float]
96
108
  [[config-config-file]]
97
109
  ==== `config_file`
@@ -147,9 +159,26 @@ ruby -r securerandom -e 'print SecureRandom.uuid'
147
159
 
148
160
  WARNING: Secret tokens only provide any real security if your APM server uses TLS.
149
161
 
162
+ [float]
163
+ [[config-api-key]]
164
+ ==== `api_key`
165
+
166
+ [options="header"]
167
+ |============
168
+ | Environment | `Config` key | Default | Example
169
+ | `ELASTIC_APM_API_KEY` | `api_key` | `nil` | A base64-encoded string
170
+ |============
171
+
172
+ This base64-encoded string is used to ensure that only your agents can send data to your APM server.
173
+ You must have created the api key using the APM server command line tool. Please see the APM server
174
+ documentation for details on how to do that. Please note that this feature is experimental in the
175
+ APM server in version 7.6.
176
+
177
+ WARNING: Api keys only provide any real security if your APM server uses TLS.
178
+
150
179
  [float]
151
180
  [[config-active]]
152
- ==== `active`
181
+ ==== `active` deprecated:[3.7.0,See <<config-enabled>> instead.]
153
182
  |============
154
183
  | Environment | `Config` key | Default
155
184
  | `ELASTIC_APM_ACTIVE` | `active` | `true`
@@ -158,6 +187,8 @@ WARNING: Secret tokens only provide any real security if your APM server uses TL
158
187
  Whether or not to start the agent.
159
188
  If `active` is `false`, `ElasticAPM.start` will do nothing and all calls to the root API will return `nil`.
160
189
 
190
+ NOTE: This option is being removed. See <<config-enabled>> instead.
191
+
161
192
  [float]
162
193
  [[config-api-buffer-size]]
163
194
  ==== `api_buffer_size`
@@ -176,6 +207,9 @@ went wrong.
176
207
  [float]
177
208
  [[config-api-request-size]]
178
209
  ==== `api_request_size`
210
+
211
+ <<dynamic-configuration, image:./images/dynamic-config.svg[] >>
212
+
179
213
  |============
180
214
  | Environment | `Config` key | Default
181
215
  | `ELASTIC_APM_API_REQUEST_SIZE` | `api_request_size` | `"750kb"`
@@ -189,6 +223,9 @@ It has to be provided in *<<config-format-size, size format>>*.
189
223
  [float]
190
224
  [[config-api-request-time]]
191
225
  ==== `api_request_time`
226
+
227
+ <<dynamic-configuration, image:./images/dynamic-config.svg[] >>
228
+
192
229
  |============
193
230
  | Environment | `Config` key | Default
194
231
  | `ELASTIC_APM_API_REQUEST_TIME` | `api_request_time` | `"10s"`
@@ -217,6 +254,9 @@ NOTE: This feature requires APM Server and Kibana >= 7.3.
217
254
  [float]
218
255
  [[config-capture-body]]
219
256
  ==== `capture_body`
257
+
258
+ <<dynamic-configuration, image:./images/dynamic-config.svg[] >>
259
+
220
260
  |============
221
261
  | Environment | `Config` key | Default | Example |
222
262
  | `ELASTIC_APM_CAPTURE_BODY` | `capture_body` | `"off"` | `"all"`
@@ -237,6 +277,9 @@ If your service handles data like this, we advise to only enable this feature wi
237
277
  [float]
238
278
  [[config-capture-headers]]
239
279
  ==== `capture_headers`
280
+
281
+ <<dynamic-configuration, image:./images/dynamic-config.svg[] >>
282
+
240
283
  |============
241
284
  | Environment | `Config` key | Default
242
285
  | `ELASTIC_APM_CAPTURE_HEADERS` | `capture_headers` | `true`
@@ -244,6 +287,16 @@ If your service handles data like this, we advise to only enable this feature wi
244
287
 
245
288
  Whether or not to attach the request headers to transactions and errors.
246
289
 
290
+ [float]
291
+ [[config-capture-elasticsearch-queries]]
292
+ ==== `capture_elasticsearch_queries`
293
+ |============
294
+ | Environment | `Config` key | Default
295
+ | `ELASTIC_APM_CAPTURE_ELASTICSEARCH_QUERIES` | `capture_elasticsearch_queries` | `false`
296
+ |============
297
+
298
+ Whether or not to capture the body from requests in Elasticsearch.
299
+
247
300
  [float]
248
301
  [[config-capture-env]]
249
302
  ==== `capture_env`
@@ -262,7 +315,7 @@ Whether or not to attach `ENV` from Rack to transactions and errors.
262
315
  | `ELASTIC_APM_CENTRAL_CONFIG` | `central_config` | `true`
263
316
  |============
264
317
 
265
- Enable {apm-app-ref}/agent-configuration.html[APM Agent Configuration via Kibana].
318
+ Enables {apm-app-ref}/agent-configuration.html[APM Agent Configuration via Kibana].
266
319
  If set to `true`, the client will poll the APM Server regularly for new agent configuration.
267
320
 
268
321
  Usually APM Server determines how often to poll, but if not the default interval is 5 minutes.
@@ -271,7 +324,7 @@ NOTE: This feature requires APM Server v7.3 or later and that the APM Server is
271
324
 
272
325
  [float]
273
326
  [[config-custom-key-filters]]
274
- ==== `custom_key_filters`
327
+ ==== `custom_key_filters` deprecated:[3.5.0,See <<config-sanitize-field-names>> instead.]
275
328
  [options="header"]
276
329
  |============
277
330
  | Environment | `Config` key | Default | Example
@@ -286,6 +339,8 @@ Use this option to add your own custom header keys to the list of filtered keys.
286
339
  When setting this option via `ENV`, use a comma separated string.
287
340
  Eg. `ELASTIC_APM_CUSTOM_KEY_FILTERS="a,b" # => [/a/, /b/]`
288
341
 
342
+ NOTE: This option is being removed. See <<config-sanitize-field-names>> instead.
343
+
289
344
  [float]
290
345
  [[config-default-tags]]
291
346
  ==== `default_tags`
@@ -328,6 +383,7 @@ that are set will override `global_labels`.
328
383
 
329
384
  A comma-separated list of dotted metrics names that should not be sent to the APM Server.
330
385
  You can use `*` to match multiple metrics.
386
+ Matching is case-insensitive.
331
387
 
332
388
  [float]
333
389
  [[config-disable-send]]
@@ -351,12 +407,12 @@ Disables the agent's startup message announcing itself.
351
407
 
352
408
  [float]
353
409
  [[config-disabled-instrumentations]]
354
- ==== `disabled_instrumentations`
410
+ ==== `disable_instrumentations`
355
411
 
356
412
  [options="header"]
357
413
  |============
358
- | Environment | `Config` key | Default
359
- | `ELASTIC_APM_DISABLED_INSTRUMENTATIONS` | `disabled_instrumentations` | `['json']`
414
+ | Environment | `Config` key | Default
415
+ | `ELASTIC_APM_DISABLE_INSTRUMENTATIONS` | `disable_instrumentations` | `['json']`
360
416
  |============
361
417
 
362
418
  Elastic APM automatically instruments select third party libraries.
@@ -364,6 +420,18 @@ Use this option to disable any of these.
364
420
 
365
421
  Get an array of enabled instrumentations with `ElasticAPM.agent.config.enabled_instrumentations`.
366
422
 
423
+ [float]
424
+ [[config-enabled]]
425
+ ==== `enabled`
426
+ [options="header"]
427
+ |============
428
+ | Environment | `Config` key | Default
429
+ | `ELASTIC_APM_ENABLED` | `enabled` | `true`
430
+ |============
431
+
432
+ Whether or not to start the agent.
433
+ If `enabled` is `false`, `ElasticAPM.start` will do nothing and all calls to the root API will return `nil`.
434
+
367
435
  [float]
368
436
  [[config-environment]]
369
437
  ==== `environment`
@@ -495,6 +563,8 @@ Elastic APM can instrument your Rake tasks but given that they are used for a mu
495
563
  [[config-log-level]]
496
564
  ==== `log_level`
497
565
 
566
+ <<dynamic-configuration, image:./images/dynamic-config.svg[] >>
567
+
498
568
  [options="header"]
499
569
  |============
500
570
  | Environment | `Config` key | Default
@@ -591,6 +661,41 @@ There are also `ENV` version of these following the same pattern of putting `ELA
591
661
 
592
662
  See https://github.com/httprb/http/wiki/Proxy-Support[Http.rb's docs].
593
663
 
664
+ [float]
665
+ [[config-recording]]
666
+ ==== `recording`
667
+
668
+ <<dynamic-configuration, image:./images/dynamic-config.svg[] >>
669
+
670
+ [options="header"]
671
+ |============
672
+ | Environment | `Config` key | Default
673
+ | `ELASTIC_APM_RECORDING` | `recording` | `true`
674
+ |============
675
+
676
+ Enable or disable the recording of events.
677
+ If set to false, then the agent does not create or send any events to the Elastic APM server,
678
+ and instrumentation overhead is minimized. The agent continues to poll the server for configuration changes
679
+ when this option is false.
680
+
681
+ [float]
682
+ [[config-sanitize-field-names]]
683
+ ==== `sanitize_field_names`
684
+
685
+ [options="header"]
686
+ |============
687
+ | Environment | `Config` key | Default | Example
688
+ | `ELASTIC_APM_SANITIZE_FIELD_NAMES` | `sanitize_field_names` | `[]` | `Auth*tion,abc*,*xyz`
689
+ |============
690
+
691
+ Sometimes it is necessary to sanitize the data sent to Elastic APM, e.g. remove sensitive data.
692
+
693
+ Configure a list of wildcard patterns of field names which should be sanitized. These apply to HTTP headers and bodies (if you're capturing those.)
694
+
695
+ Supports the wildcard `*`, which matches zero or more characters.
696
+ Examples: `/foo/*/bar/*/baz*`, `*foo*`.
697
+ Matching is case insensitive.
698
+
594
699
  [float]
595
700
  [[config-service-name]]
596
701
  ==== `service_name`
@@ -612,6 +717,23 @@ NOTE: The service name must conform to this regular expression: `^[a-zA-Z0-9 _-]
612
717
  In layman's terms: Your service name must only contain characters from the ASCII
613
718
  alphabet, numbers, dashes, underscores and spaces.
614
719
 
720
+ [float]
721
+ [[config-service-node-name]]
722
+ ==== `service_node_name`
723
+
724
+ [options="header"]
725
+ |============
726
+ | Environment | `Config` key | Default | Example
727
+ | `ELASTIC_APM_SERVICE_NODE_NAME` | `service_node_name` | `nil` | `"my-app-1"`
728
+ |============
729
+
730
+ The name of the given service node. This is optional, and if omitted, the APM
731
+ Server will fall back on `system.container.id` if available, and finally
732
+ `host.name` if necessary.
733
+
734
+ This option allows you to set the node name manually to ensure uniqueness and
735
+ meaningfulness.
736
+
615
737
  [float]
616
738
  [[config-service-version]]
617
739
  ==== `service_version`
@@ -657,6 +779,8 @@ storage use in your Elasticsearch cluster.
657
779
  [[config-span-frames-min-duration-ms]]
658
780
  ==== `span_frames_min_duration`
659
781
 
782
+ <<dynamic-configuration, image:./images/dynamic-config.svg[] >>
783
+
660
784
  |============
661
785
  | Environment | `Config` key | Default
662
786
  | `ELASTIC_APM_SPAN_FRAMES_MIN_DURATION` | `span_frames_min_duration` | `"5ms"`
@@ -700,6 +824,8 @@ The maximum number of stack trace lines per span/error.
700
824
  [[config-transaction-max-spans]]
701
825
  ==== `transaction_max_spans`
702
826
 
827
+ <<dynamic-configuration, image:./images/dynamic-config.svg[] >>
828
+
703
829
  |============
704
830
  | Environment | `Config` key | Default
705
831
  | `ELASTIC_APM_TRANSACTION_MAX_SPANS` | `transaction_max_spans` | `500`
@@ -715,6 +841,8 @@ too much work for such edge cases.
715
841
  [[config-transaction-sample-rate]]
716
842
  ==== `transaction_sample_rate`
717
843
 
844
+ <<dynamic-configuration, image:./images/dynamic-config.svg[] >>
845
+
718
846
  |============
719
847
  | Environment | `Config` key | Default
720
848
  | `ELASTIC_APM_TRANSACTION_SAMPLE_RATE` | `transaction_sample_rate` | `1.0`
@@ -728,20 +856,14 @@ context information, tags, or spans.
728
856
 
729
857
  [float]
730
858
  [[config-use-experimental-sql-parser]]
731
- ==== `use_experimental_sql_parser`
859
+ ==== `use_legacy_sql_parser`
732
860
  |============
733
- | Environment | `Config` key | Default
734
- | `ELASTIC_APM_USE_EXPERIMENTAL_SQL_PARSER` | `use_experimental_sql_parser` | `false`
861
+ | Environment | `Config` key | Default
862
+ | `ELASTIC_APM_USE_LEGACY_SQL_PARSER` | `use_legacy_sql_parser` | `false`
735
863
  |============
736
864
 
737
- Use a newer, more precise but still experimental approach to generating summaries of
738
- your app's SQL statements.
739
- Without this, your SQL statements will still be summarized albeit less accurately.
740
-
741
- The summaries become the spans' names -- what it says in the waterfall view in Kibana.
742
-
743
- NOTE: This should work just fine but is still deamed experimental. That means it is
744
- subject to change. Please let us know if you come across any issues.
865
+ Use the older, less precise approach to generating summaries of your app's SQL statements.
866
+ Try this if you're experiencing trouble using the new default.
745
867
 
746
868
  [float]
747
869
  [[config-verify-server-cert]]
@@ -795,3 +917,13 @@ The unit is provided as suffix directly after the number, without any separation
795
917
  * `gb` (gigabytes)
796
918
 
797
919
  NOTE: we use the power-of-two sizing convention, e.g. `1 kilobyte == 1024 bytes`
920
+
921
+ [float]
922
+ [[special-configuration]]
923
+ === Special configuration
924
+
925
+ Elastic APM patches `Kernel#require` to auto-detect and instrument supported third party libraries. It does so with the utmost care but in rare cases it can conflict with some libraries.
926
+
927
+ To get around this patch, set the environment variable `ELASTIC_APM_SKIP_REQUIRE_PATCH` to `"1"`.
928
+
929
+ If you choose to do so, the agent might need some additional tweaking to make sure the third party libraries are picked up and instrumented. Make sure you require the agent _after_ you require your other dependencies.
@@ -28,3 +28,17 @@ Things to consider:
28
28
  - Experiencing high load? The agent can spawn multiple instances of its Workers that pick off the queue by changing the option `pool_size` (default is `1`).
29
29
  - If you have high load you may also consider setting `transaction_sample_rate` to something smaller than `1.0`. This determines whether to include _spans_ for every _transaction_. If you have enough traffic, skipping some (probably) identical spans won't have a noticeable effect on your data.
30
30
 
31
+ [float]
32
+ [[disable-agent]]
33
+ === Disable the Agent
34
+
35
+ In the unlikely event the agent causes disruptions to a production application,
36
+ you can disable the agent while you troubleshoot.
37
+
38
+ If you have access to <<dynamic-configuration,dynamic configuration>>,
39
+ you can disable the recording of events by setting <<config-recording,`recording`>> to `false`.
40
+ When changed at runtime from a supported source, there's no need to restart your application.
41
+
42
+ If that doesn't work, or you don't have access to dynamic configuration, you can disable the agent by setting
43
+ <<config-enabled,`enabled`>> to `false`.
44
+ You'll need to restart your application for the changes to apply.