elastic-apm 3.5.0 → 3.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (159) hide show
  1. checksums.yaml +4 -4
  2. data/.ci/Jenkinsfile +286 -183
  3. data/.ci/docker/jruby/11-jdk/Dockerfile +40 -0
  4. data/.ci/docker/jruby/12-jdk/Dockerfile +40 -0
  5. data/.ci/docker/jruby/13-jdk/Dockerfile +40 -0
  6. data/.ci/docker/jruby/7-jdk/Dockerfile +40 -0
  7. data/.ci/docker/jruby/8-jdk/Dockerfile +40 -0
  8. data/.ci/docker/jruby/README.md +31 -0
  9. data/.ci/docker/jruby/run.sh +73 -0
  10. data/.ci/docker/jruby/test.sh +13 -0
  11. data/.ci/jobs/defaults.yml +1 -1
  12. data/.ci/packer_cache.sh +12 -10
  13. data/.gitignore +3 -1
  14. data/.rspec +0 -1
  15. data/.rubocop.yml +13 -1
  16. data/CHANGELOG.asciidoc +92 -0
  17. data/CONTRIBUTING.md +6 -4
  18. data/Gemfile +35 -9
  19. data/Rakefile +37 -5
  20. data/bin/run-tests +4 -1
  21. data/docker-compose.yml +7 -0
  22. data/docs/api.asciidoc +14 -2
  23. data/docs/configuration.asciidoc +122 -27
  24. data/docs/debugging.asciidoc +14 -0
  25. data/docs/getting-started-rails.asciidoc +2 -0
  26. data/docs/graphql.asciidoc +23 -0
  27. data/docs/images/dynamic-config.svg +1 -0
  28. data/docs/index.asciidoc +6 -1
  29. data/docs/introduction.asciidoc +2 -1
  30. data/docs/performance-tuning.asciidoc +106 -0
  31. data/docs/set-up.asciidoc +5 -2
  32. data/docs/supported-technologies.asciidoc +68 -1
  33. data/docs/upgrading.asciidoc +45 -0
  34. data/elastic-apm.gemspec +17 -0
  35. data/lib/elastic-apm.rb +17 -0
  36. data/lib/elastic_apm.rb +29 -0
  37. data/lib/elastic_apm/agent.rb +48 -2
  38. data/lib/elastic_apm/central_config.rb +27 -8
  39. data/lib/elastic_apm/central_config/cache_control.rb +17 -0
  40. data/lib/elastic_apm/child_durations.rb +17 -0
  41. data/lib/elastic_apm/config.rb +59 -3
  42. data/lib/elastic_apm/config/bytes.rb +17 -0
  43. data/lib/elastic_apm/config/duration.rb +17 -0
  44. data/lib/elastic_apm/config/options.rb +18 -1
  45. data/lib/elastic_apm/config/regexp_list.rb +17 -0
  46. data/lib/elastic_apm/config/wildcard_pattern_list.rb +28 -1
  47. data/lib/elastic_apm/context.rb +17 -0
  48. data/lib/elastic_apm/context/request.rb +17 -0
  49. data/lib/elastic_apm/context/request/socket.rb +17 -0
  50. data/lib/elastic_apm/context/request/url.rb +17 -0
  51. data/lib/elastic_apm/context/response.rb +17 -0
  52. data/lib/elastic_apm/context/user.rb +17 -0
  53. data/lib/elastic_apm/context_builder.rb +18 -1
  54. data/lib/elastic_apm/deprecations.rb +17 -0
  55. data/lib/elastic_apm/error.rb +17 -0
  56. data/lib/elastic_apm/error/exception.rb +17 -0
  57. data/lib/elastic_apm/error/log.rb +17 -0
  58. data/lib/elastic_apm/error_builder.rb +17 -0
  59. data/lib/elastic_apm/grape.rb +17 -0
  60. data/lib/elastic_apm/graphql.rb +91 -0
  61. data/lib/elastic_apm/grpc.rb +99 -0
  62. data/lib/elastic_apm/instrumenter.rb +29 -4
  63. data/lib/elastic_apm/internal_error.rb +17 -0
  64. data/lib/elastic_apm/logging.rb +17 -0
  65. data/lib/elastic_apm/metadata.rb +17 -0
  66. data/lib/elastic_apm/metadata/process_info.rb +17 -0
  67. data/lib/elastic_apm/metadata/service_info.rb +22 -2
  68. data/lib/elastic_apm/metadata/system_info.rb +22 -3
  69. data/lib/elastic_apm/metadata/system_info/container_info.rb +45 -4
  70. data/lib/elastic_apm/metrics.rb +33 -1
  71. data/lib/elastic_apm/metrics/breakdown_set.rb +17 -0
  72. data/lib/elastic_apm/metrics/cpu_mem_set.rb +17 -0
  73. data/lib/elastic_apm/metrics/metric.rb +17 -0
  74. data/lib/elastic_apm/metrics/set.rb +17 -0
  75. data/lib/elastic_apm/metrics/span_scoped_set.rb +17 -0
  76. data/lib/elastic_apm/metrics/transaction_set.rb +17 -0
  77. data/lib/elastic_apm/metrics/vm_set.rb +17 -0
  78. data/lib/elastic_apm/metricset.rb +17 -0
  79. data/lib/elastic_apm/middleware.rb +25 -2
  80. data/lib/elastic_apm/naively_hashable.rb +17 -0
  81. data/lib/elastic_apm/normalizers.rb +17 -0
  82. data/lib/elastic_apm/normalizers/grape.rb +17 -0
  83. data/lib/elastic_apm/normalizers/grape/endpoint_run.rb +18 -1
  84. data/lib/elastic_apm/normalizers/rails.rb +17 -0
  85. data/lib/elastic_apm/normalizers/rails/action_controller.rb +17 -0
  86. data/lib/elastic_apm/normalizers/rails/action_mailer.rb +17 -0
  87. data/lib/elastic_apm/normalizers/rails/action_view.rb +17 -0
  88. data/lib/elastic_apm/normalizers/rails/active_record.rb +17 -0
  89. data/lib/elastic_apm/opentracing.rb +64 -23
  90. data/lib/elastic_apm/rails.rb +17 -0
  91. data/lib/elastic_apm/railtie.rb +17 -0
  92. data/lib/elastic_apm/resque.rb +29 -0
  93. data/lib/elastic_apm/sinatra.rb +17 -0
  94. data/lib/elastic_apm/span.rb +20 -2
  95. data/lib/elastic_apm/span/context.rb +17 -0
  96. data/lib/elastic_apm/span/context/db.rb +17 -0
  97. data/lib/elastic_apm/span/context/destination.rb +37 -4
  98. data/lib/elastic_apm/span/context/http.rb +17 -0
  99. data/lib/elastic_apm/span_helpers.rb +17 -0
  100. data/lib/elastic_apm/spies.rb +33 -14
  101. data/lib/elastic_apm/spies/action_dispatch.rb +17 -0
  102. data/lib/elastic_apm/spies/delayed_job.rb +17 -0
  103. data/lib/elastic_apm/spies/dynamo_db.rb +58 -0
  104. data/lib/elastic_apm/spies/elasticsearch.rb +37 -2
  105. data/lib/elastic_apm/spies/faraday.rb +17 -0
  106. data/lib/elastic_apm/spies/http.rb +17 -0
  107. data/lib/elastic_apm/spies/json.rb +17 -0
  108. data/lib/elastic_apm/spies/mongo.rb +18 -1
  109. data/lib/elastic_apm/spies/net_http.rb +23 -2
  110. data/lib/elastic_apm/spies/rake.rb +17 -0
  111. data/lib/elastic_apm/spies/redis.rb +17 -0
  112. data/lib/elastic_apm/spies/resque.rb +53 -0
  113. data/lib/elastic_apm/spies/sequel.rb +18 -1
  114. data/lib/elastic_apm/spies/shoryuken.rb +17 -0
  115. data/lib/elastic_apm/spies/sidekiq.rb +17 -0
  116. data/lib/elastic_apm/spies/sinatra.rb +17 -0
  117. data/lib/elastic_apm/spies/sneakers.rb +17 -0
  118. data/lib/elastic_apm/spies/sucker_punch.rb +54 -0
  119. data/lib/elastic_apm/spies/tilt.rb +17 -0
  120. data/lib/elastic_apm/sql.rb +21 -4
  121. data/lib/elastic_apm/sql/signature.rb +17 -0
  122. data/lib/elastic_apm/sql/tokenizer.rb +17 -0
  123. data/lib/elastic_apm/sql/tokens.rb +17 -0
  124. data/lib/elastic_apm/sql_summarizer.rb +17 -0
  125. data/lib/elastic_apm/stacktrace.rb +17 -0
  126. data/lib/elastic_apm/stacktrace/frame.rb +17 -0
  127. data/lib/elastic_apm/stacktrace_builder.rb +23 -1
  128. data/lib/elastic_apm/subscriber.rb +17 -0
  129. data/lib/elastic_apm/trace_context.rb +51 -11
  130. data/lib/elastic_apm/trace_context/traceparent.rb +17 -0
  131. data/lib/elastic_apm/trace_context/tracestate.rb +17 -0
  132. data/lib/elastic_apm/transaction.rb +33 -5
  133. data/lib/elastic_apm/transport/base.rb +39 -23
  134. data/lib/elastic_apm/transport/connection.rb +17 -0
  135. data/lib/elastic_apm/transport/connection/http.rb +17 -0
  136. data/lib/elastic_apm/transport/connection/proxy_pipe.rb +22 -0
  137. data/lib/elastic_apm/transport/filters.rb +17 -0
  138. data/lib/elastic_apm/transport/filters/hash_sanitizer.rb +77 -0
  139. data/lib/elastic_apm/transport/filters/secrets_filter.rb +29 -56
  140. data/lib/elastic_apm/transport/headers.rb +17 -0
  141. data/lib/elastic_apm/transport/serializers.rb +17 -0
  142. data/lib/elastic_apm/transport/serializers/context_serializer.rb +17 -0
  143. data/lib/elastic_apm/transport/serializers/error_serializer.rb +17 -0
  144. data/lib/elastic_apm/transport/serializers/metadata_serializer.rb +44 -20
  145. data/lib/elastic_apm/transport/serializers/metricset_serializer.rb +17 -0
  146. data/lib/elastic_apm/transport/serializers/span_serializer.rb +20 -1
  147. data/lib/elastic_apm/transport/serializers/transaction_serializer.rb +17 -0
  148. data/lib/elastic_apm/transport/user_agent.rb +17 -0
  149. data/lib/elastic_apm/transport/worker.rb +21 -0
  150. data/lib/elastic_apm/util.rb +17 -0
  151. data/lib/elastic_apm/util/inflector.rb +17 -0
  152. data/lib/elastic_apm/util/lru_cache.rb +17 -0
  153. data/lib/elastic_apm/util/throttle.rb +17 -0
  154. data/lib/elastic_apm/version.rb +18 -1
  155. metadata +26 -12
  156. data/.ci/downstreamTests.groovy +0 -185
  157. data/.ci/prepare-git-context.sh +0 -27
  158. data/CHANGELOG.md +0 -1
  159. data/codecov.yml +0 -32
@@ -41,10 +41,12 @@ $ spec/scripts/spec.sh ruby:2.6 rails-5.2
41
41
  To release a new version:
42
42
 
43
43
  1. Update `VERSION` in `lib/elastic_apm/version.rb` according to the changes (major, minor, patch).
44
- 2. Update `CHANGELOG.md` to reflect the new version – change _Unreleased_ section to _Version (release date)_.
45
- 3. Make a new commit with the changes above, with a message in the style of `vX.X.X`.
46
- 4. Run `rake release`. This will...
44
+ 1. Update `CHANGELOG.md` to reflect the new version – change _Unreleased_ section to _Version (release date)_.
45
+ 1. For Majors: Add a new row to the EOL table in `docs/upgrading.asciidoc`. The EOL date is the release date plus 18 months.
46
+ 1. Make a new commit with the changes above, with a message in the style of `vX.X.X`.
47
+ 1. Run `rake release`. This will...
47
48
  1. Tag the current commit as new version.
48
49
  2. Push the tag to GitHub.
49
50
  3. Build the gem and upload to Rubygems (local user needs to be signed in and authorized.)
50
- 4. Update `2.x` branch to be at released commit and push it to GitHub.
51
+ 1. Run `rake release:update_branch`. This will...
52
+ 1. Update `3.x` branch to be at released commit and push it to GitHub.
data/Gemfile CHANGED
@@ -1,3 +1,20 @@
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
1
18
  # frozen_string_literal: true
2
19
 
3
20
  source 'https://rubygems.org'
@@ -17,30 +34,30 @@ gem 'timecop'
17
34
  gem 'webmock'
18
35
 
19
36
  # Integrations
37
+ gem 'aws-sdk-dynamodb', require: nil
20
38
  gem 'aws-sdk-sqs', require: nil
21
39
  gem 'elasticsearch', require: nil
22
40
  gem 'fakeredis', require: nil
23
41
  gem 'faraday', require: nil
42
+ gem 'graphql', require: nil
43
+ gem 'google-protobuf', '< 3.12' if !defined?(JRUBY_VERSION) && RUBY_VERSION < '2.5'
44
+ gem 'grpc' if !defined?(JRUBY_VERSION)
45
+ gem 'json'
24
46
  gem 'json-schema', require: nil
25
47
  gem 'mongo', require: nil
26
48
  gem 'opentracing', require: nil
27
49
  gem 'rake', require: nil
50
+ gem 'resque', require: nil
28
51
  gem 'sequel', require: nil
29
52
  gem 'shoryuken', require: nil
30
53
  gem 'sidekiq', require: nil
31
- gem 'sneakers', '~> 2.12', require: nil
32
54
  gem 'simplecov', require: false
33
55
  gem 'simplecov-cobertura', require: false
56
+ gem 'sneakers', '~> 2.12', require: nil
57
+ gem 'sucker_punch', '~> 2.0', require: nil
34
58
  gem 'yard', require: nil
35
59
  gem 'yarjuf'
36
60
 
37
- if RUBY_PLATFORM == 'java'
38
- gem 'activerecord-jdbcsqlite3-adapter'
39
- gem 'jdbc-sqlite3'
40
- else
41
- gem 'sqlite3'
42
- end
43
-
44
61
  ## Install Framework
45
62
  GITHUB_REPOS = {
46
63
  'grape' => 'ruby-grape/grape',
@@ -59,7 +76,7 @@ end
59
76
  frameworks_versions.each do |framework, version|
60
77
  case version
61
78
  when 'master'
62
- gem framework, github: GITHUB_REPOS.fetch[framework]
79
+ gem framework, github: GITHUB_REPOS.fetch(framework)
63
80
  when /.+/
64
81
  gem framework, "~> #{version}.0"
65
82
  else
@@ -73,6 +90,15 @@ if frameworks_versions.key?('rails')
73
90
  end
74
91
  end
75
92
 
93
+ if RUBY_PLATFORM == 'java'
94
+ gem 'activerecord-jdbcsqlite3-adapter'
95
+ gem 'jdbc-sqlite3'
96
+ elsif frameworks_versions['rails'] =~ /^(4|5)/
97
+ gem 'sqlite3', '~> 1.3.6'
98
+ else
99
+ gem 'sqlite3' # rubocop:disable Bundler/DuplicatedGem
100
+ end
101
+
76
102
  group :bench do
77
103
  gem 'ruby-prof', require: nil, platforms: %i[ruby]
78
104
  gem 'stackprof', require: nil, platforms: %i[ruby]
data/Rakefile CHANGED
@@ -1,12 +1,34 @@
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
1
18
  # frozen_string_literal: true
2
19
 
3
20
  require 'bundler/gem_tasks'
4
21
 
5
- Rake::Task[:release].enhance do
6
- `git checkout 3.x &&
7
- git rebase master &&
8
- git push origin 3.x &&
9
- git checkout master`
22
+ desc """Post release action:
23
+ Update `3.x` branch to be at released commit and push it to GitHub.
24
+ """
25
+ namespace :release do
26
+ task :update_branch do
27
+ `git checkout 3.x &&
28
+ git rebase master &&
29
+ git push origin 3.x &&
30
+ git checkout master`
31
+ end
10
32
  end
11
33
 
12
34
  require 'rspec/core/rake_task'
@@ -17,3 +39,13 @@ YARD::Rake::YardocTask.new
17
39
  task docs: :yard
18
40
 
19
41
  task default: :spec
42
+
43
+ namespace :coverage do
44
+ desc "Collates all result sets generated by the different test runners"
45
+ task :report do
46
+ require 'simplecov'
47
+ require 'simplecov-cobertura'
48
+ SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter
49
+ SimpleCov.collate Dir["coverage/matrix_results/**/.resultset.json"]
50
+ end
51
+ end
@@ -8,7 +8,10 @@ runRspec(){
8
8
  if [ -n "${case}" ]; then
9
9
  bn="$(basename ${case} _spec.rb)/"
10
10
  fi
11
- bundle exec rspec -f progress -f JUnit -o spec/junit-reports/${bn}ruby-agent-junit.xml ${case}
11
+ bundle exec rspec \
12
+ -f progress \
13
+ -r yarjuf -f JUnit -o spec/junit-reports/${bn}ruby-agent-junit.xml \
14
+ ${case}
12
15
  }
13
16
  specific_spec=$1
14
17
 
@@ -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
@@ -8,9 +8,7 @@ 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
  ----
@@ -18,17 +16,38 @@ server_url: 'http://localhost:8200'
18
16
  secret_token: <%= ENV["VERY_SECRET_TOKEN"] %>
19
17
  ----
20
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
+
21
27
  Options are applied in the following order (last one wins):
22
28
 
23
29
  1. Defaults
24
30
  2. Arguments to `ElasticAPM.start` / `Config.new`
25
- 3. Config file eg. `config/elastic_apm.yml`
31
+ 3. Config file, e.g., `config/elastic_apm.yml`
26
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>>.
27
46
 
28
47
  [float]
29
48
  === Ruby on Rails
30
49
 
31
- When using Rails it's also possible to specify options inside
50
+ When using Rails, it's possible to specify options inside
32
51
  `config/application.rb`:
33
52
 
34
53
  [source,ruby]
@@ -40,7 +59,7 @@ config.elastic_apm.service_name = 'MyApp'
40
59
  [float]
41
60
  === Sinatra and Rack
42
61
 
43
- When using APM with Sinatra and Rack you can configure it when starting
62
+ When using Sinatra and Rack, you can configure when starting
44
63
  the agent:
45
64
 
46
65
  [source,ruby]
@@ -52,7 +71,7 @@ ElasticAPM.start(
52
71
  )
53
72
  ----
54
73
 
55
- Alternatively, you can use the `ElasticAPM::Sinatra.start` API.
74
+ Alternatively, you can use the `ElasticAPM::Sinatra.start` API:
56
75
 
57
76
  [source,ruby]
58
77
  ----
@@ -68,7 +87,7 @@ See <<getting-started-rack>>.
68
87
  [float]
69
88
  === Grape and Rack
70
89
 
71
- 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
72
91
  the agent:
73
92
 
74
93
  [source,ruby]
@@ -85,12 +104,6 @@ See <<getting-started-rack>>.
85
104
  [float]
86
105
  === Options
87
106
 
88
- Some options can be set with `ENV` variables and all of them may be set in
89
- your source code.
90
-
91
- When setting values for lists using `ENV` variables, strings are split by comma
92
- eg `ELASTIC_APM_SANITIZE_FIELD_NAMES="a,b" # => [/a/, /b/]`.
93
-
94
107
  [float]
95
108
  [[config-config-file]]
96
109
  ==== `config_file`
@@ -165,7 +178,7 @@ WARNING: Api keys only provide any real security if your APM server uses TLS.
165
178
 
166
179
  [float]
167
180
  [[config-active]]
168
- ==== `active`
181
+ ==== `active` deprecated:[3.7.0,See <<config-enabled>> instead.]
169
182
  |============
170
183
  | Environment | `Config` key | Default
171
184
  | `ELASTIC_APM_ACTIVE` | `active` | `true`
@@ -174,6 +187,8 @@ WARNING: Api keys only provide any real security if your APM server uses TLS.
174
187
  Whether or not to start the agent.
175
188
  If `active` is `false`, `ElasticAPM.start` will do nothing and all calls to the root API will return `nil`.
176
189
 
190
+ NOTE: This option is being removed. See <<config-enabled>> instead.
191
+
177
192
  [float]
178
193
  [[config-api-buffer-size]]
179
194
  ==== `api_buffer_size`
@@ -192,6 +207,9 @@ went wrong.
192
207
  [float]
193
208
  [[config-api-request-size]]
194
209
  ==== `api_request_size`
210
+
211
+ <<dynamic-configuration, image:./images/dynamic-config.svg[] >>
212
+
195
213
  |============
196
214
  | Environment | `Config` key | Default
197
215
  | `ELASTIC_APM_API_REQUEST_SIZE` | `api_request_size` | `"750kb"`
@@ -205,6 +223,9 @@ It has to be provided in *<<config-format-size, size format>>*.
205
223
  [float]
206
224
  [[config-api-request-time]]
207
225
  ==== `api_request_time`
226
+
227
+ <<dynamic-configuration, image:./images/dynamic-config.svg[] >>
228
+
208
229
  |============
209
230
  | Environment | `Config` key | Default
210
231
  | `ELASTIC_APM_API_REQUEST_TIME` | `api_request_time` | `"10s"`
@@ -233,6 +254,9 @@ NOTE: This feature requires APM Server and Kibana >= 7.3.
233
254
  [float]
234
255
  [[config-capture-body]]
235
256
  ==== `capture_body`
257
+
258
+ <<dynamic-configuration, image:./images/dynamic-config.svg[] >>
259
+
236
260
  |============
237
261
  | Environment | `Config` key | Default | Example |
238
262
  | `ELASTIC_APM_CAPTURE_BODY` | `capture_body` | `"off"` | `"all"`
@@ -253,6 +277,9 @@ If your service handles data like this, we advise to only enable this feature wi
253
277
  [float]
254
278
  [[config-capture-headers]]
255
279
  ==== `capture_headers`
280
+
281
+ <<dynamic-configuration, image:./images/dynamic-config.svg[] >>
282
+
256
283
  |============
257
284
  | Environment | `Config` key | Default
258
285
  | `ELASTIC_APM_CAPTURE_HEADERS` | `capture_headers` | `true`
@@ -260,6 +287,16 @@ If your service handles data like this, we advise to only enable this feature wi
260
287
 
261
288
  Whether or not to attach the request headers to transactions and errors.
262
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
+
263
300
  [float]
264
301
  [[config-capture-env]]
265
302
  ==== `capture_env`
@@ -278,7 +315,7 @@ Whether or not to attach `ENV` from Rack to transactions and errors.
278
315
  | `ELASTIC_APM_CENTRAL_CONFIG` | `central_config` | `true`
279
316
  |============
280
317
 
281
- 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].
282
319
  If set to `true`, the client will poll the APM Server regularly for new agent configuration.
283
320
 
284
321
  Usually APM Server determines how often to poll, but if not the default interval is 5 minutes.
@@ -383,6 +420,18 @@ Use this option to disable any of these.
383
420
 
384
421
  Get an array of enabled instrumentations with `ElasticAPM.agent.config.enabled_instrumentations`.
385
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
+
386
435
  [float]
387
436
  [[config-environment]]
388
437
  ==== `environment`
@@ -514,6 +563,8 @@ Elastic APM can instrument your Rake tasks but given that they are used for a mu
514
563
  [[config-log-level]]
515
564
  ==== `log_level`
516
565
 
566
+ <<dynamic-configuration, image:./images/dynamic-config.svg[] >>
567
+
517
568
  [options="header"]
518
569
  |============
519
570
  | Environment | `Config` key | Default
@@ -610,6 +661,23 @@ There are also `ENV` version of these following the same pattern of putting `ELA
610
661
 
611
662
  See https://github.com/httprb/http/wiki/Proxy-Support[Http.rb's docs].
612
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
+
613
681
  [float]
614
682
  [[config-sanitize-field-names]]
615
683
  ==== `sanitize_field_names`
@@ -649,6 +717,23 @@ NOTE: The service name must conform to this regular expression: `^[a-zA-Z0-9 _-]
649
717
  In layman's terms: Your service name must only contain characters from the ASCII
650
718
  alphabet, numbers, dashes, underscores and spaces.
651
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
+
652
737
  [float]
653
738
  [[config-service-version]]
654
739
  ==== `service_version`
@@ -694,6 +779,8 @@ storage use in your Elasticsearch cluster.
694
779
  [[config-span-frames-min-duration-ms]]
695
780
  ==== `span_frames_min_duration`
696
781
 
782
+ <<dynamic-configuration, image:./images/dynamic-config.svg[] >>
783
+
697
784
  |============
698
785
  | Environment | `Config` key | Default
699
786
  | `ELASTIC_APM_SPAN_FRAMES_MIN_DURATION` | `span_frames_min_duration` | `"5ms"`
@@ -737,6 +824,8 @@ The maximum number of stack trace lines per span/error.
737
824
  [[config-transaction-max-spans]]
738
825
  ==== `transaction_max_spans`
739
826
 
827
+ <<dynamic-configuration, image:./images/dynamic-config.svg[] >>
828
+
740
829
  |============
741
830
  | Environment | `Config` key | Default
742
831
  | `ELASTIC_APM_TRANSACTION_MAX_SPANS` | `transaction_max_spans` | `500`
@@ -752,6 +841,8 @@ too much work for such edge cases.
752
841
  [[config-transaction-sample-rate]]
753
842
  ==== `transaction_sample_rate`
754
843
 
844
+ <<dynamic-configuration, image:./images/dynamic-config.svg[] >>
845
+
755
846
  |============
756
847
  | Environment | `Config` key | Default
757
848
  | `ELASTIC_APM_TRANSACTION_SAMPLE_RATE` | `transaction_sample_rate` | `1.0`
@@ -765,20 +856,14 @@ context information, tags, or spans.
765
856
 
766
857
  [float]
767
858
  [[config-use-experimental-sql-parser]]
768
- ==== `use_experimental_sql_parser`
859
+ ==== `use_legacy_sql_parser`
769
860
  |============
770
- | Environment | `Config` key | Default
771
- | `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`
772
863
  |============
773
864
 
774
- Use a newer, more precise but still experimental approach to generating summaries of
775
- your app's SQL statements.
776
- Without this, your SQL statements will still be summarized albeit less accurately.
777
-
778
- The summaries become the spans' names -- what it says in the waterfall view in Kibana.
779
-
780
- NOTE: This should work just fine but is still deamed experimental. That means it is
781
- 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.
782
867
 
783
868
  [float]
784
869
  [[config-verify-server-cert]]
@@ -832,3 +917,13 @@ The unit is provided as suffix directly after the number, without any separation
832
917
  * `gb` (gigabytes)
833
918
 
834
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.