elastic-apm 3.3.0 → 3.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ci/.jenkins_exclude.yml +43 -24
- data/.ci/.jenkins_framework.yml +2 -2
- data/.ci/.jenkins_ruby.yml +1 -1
- data/.ci/Jenkinsfile +288 -170
- data/.ci/docker/jruby/11-jdk/Dockerfile +40 -0
- data/.ci/docker/jruby/12-jdk/Dockerfile +40 -0
- data/.ci/docker/jruby/13-jdk/Dockerfile +40 -0
- data/.ci/docker/jruby/7-jdk/Dockerfile +40 -0
- data/.ci/docker/jruby/8-jdk/Dockerfile +40 -0
- data/.ci/docker/jruby/README.md +31 -0
- data/.ci/docker/jruby/run.sh +73 -0
- data/.ci/docker/jruby/test.sh +13 -0
- data/.ci/jobs/apm-agent-ruby-downstream.yml +1 -0
- data/.ci/jobs/apm-agent-ruby-linting-mbp.yml +1 -0
- data/.ci/jobs/apm-agent-ruby-mbp.yml +1 -0
- data/.ci/jobs/defaults.yml +1 -1
- data/.ci/packer_cache.sh +16 -0
- data/.github/ISSUE_TEMPLATE/Bug_report.md +40 -0
- data/.github/ISSUE_TEMPLATE/Feature_request.md +17 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +60 -0
- data/.gitignore +8 -0
- data/.rspec +0 -1
- data/.rubocop.yml +18 -0
- data/CHANGELOG.asciidoc +104 -1
- data/CONTRIBUTING.md +6 -48
- data/Gemfile +38 -10
- data/README.md +62 -13
- data/Rakefile +37 -5
- data/bench/sql.rb +49 -0
- data/bin/build_docs +1 -1
- data/bin/run-tests +4 -1
- data/docker-compose.yml +7 -0
- data/docs/api.asciidoc +52 -3
- data/docs/configuration.asciidoc +171 -22
- data/docs/getting-started-rails.asciidoc +2 -0
- data/docs/graphql.asciidoc +23 -0
- data/docs/images/dynamic-config.svg +1 -0
- data/docs/index.asciidoc +6 -1
- data/docs/introduction.asciidoc +2 -1
- data/docs/performance-tuning.asciidoc +106 -0
- data/docs/set-up.asciidoc +5 -2
- data/docs/supported-technologies.asciidoc +86 -1
- data/docs/upgrading.asciidoc +45 -0
- data/elastic-apm.gemspec +17 -0
- data/lib/elastic-apm.rb +17 -0
- data/lib/elastic_apm.rb +58 -5
- data/lib/elastic_apm/agent.rb +55 -4
- data/lib/elastic_apm/central_config.rb +27 -8
- data/lib/elastic_apm/central_config/cache_control.rb +17 -0
- data/lib/elastic_apm/child_durations.rb +26 -4
- data/lib/elastic_apm/config.rb +86 -5
- data/lib/elastic_apm/config/bytes.rb +17 -0
- data/lib/elastic_apm/config/duration.rb +17 -0
- data/lib/elastic_apm/config/options.rb +21 -5
- data/lib/elastic_apm/config/regexp_list.rb +17 -0
- data/lib/elastic_apm/config/wildcard_pattern_list.rb +20 -1
- data/lib/elastic_apm/context.rb +17 -0
- data/lib/elastic_apm/context/request.rb +17 -0
- data/lib/elastic_apm/context/request/socket.rb +17 -0
- data/lib/elastic_apm/context/request/url.rb +17 -0
- data/lib/elastic_apm/context/response.rb +27 -2
- data/lib/elastic_apm/context/user.rb +17 -0
- data/lib/elastic_apm/context_builder.rb +17 -0
- data/lib/elastic_apm/deprecations.rb +17 -0
- data/lib/elastic_apm/error.rb +17 -0
- data/lib/elastic_apm/error/exception.rb +17 -0
- data/lib/elastic_apm/error/log.rb +17 -0
- data/lib/elastic_apm/error_builder.rb +17 -0
- data/lib/elastic_apm/grape.rb +17 -0
- data/lib/elastic_apm/graphql.rb +91 -0
- data/lib/elastic_apm/grpc.rb +99 -0
- data/lib/elastic_apm/instrumenter.rb +49 -15
- data/lib/elastic_apm/internal_error.rb +17 -0
- data/lib/elastic_apm/logging.rb +17 -0
- data/lib/elastic_apm/metadata.rb +17 -0
- data/lib/elastic_apm/metadata/process_info.rb +17 -0
- data/lib/elastic_apm/metadata/service_info.rb +22 -2
- data/lib/elastic_apm/metadata/system_info.rb +17 -0
- data/lib/elastic_apm/metadata/system_info/container_info.rb +17 -0
- data/lib/elastic_apm/metrics.rb +33 -1
- data/lib/elastic_apm/metrics/breakdown_set.rb +17 -0
- data/lib/elastic_apm/metrics/cpu_mem_set.rb +17 -0
- data/lib/elastic_apm/metrics/metric.rb +23 -4
- data/lib/elastic_apm/metrics/set.rb +17 -0
- data/lib/elastic_apm/metrics/span_scoped_set.rb +17 -0
- data/lib/elastic_apm/metrics/transaction_set.rb +17 -0
- data/lib/elastic_apm/metrics/vm_set.rb +17 -0
- data/lib/elastic_apm/metricset.rb +17 -0
- data/lib/elastic_apm/middleware.rb +20 -4
- data/lib/elastic_apm/naively_hashable.rb +17 -0
- data/lib/elastic_apm/normalizers.rb +17 -0
- data/lib/elastic_apm/normalizers/grape.rb +17 -0
- data/lib/elastic_apm/normalizers/grape/endpoint_run.rb +18 -1
- data/lib/elastic_apm/normalizers/rails.rb +17 -0
- data/lib/elastic_apm/normalizers/rails/action_controller.rb +17 -0
- data/lib/elastic_apm/normalizers/rails/action_mailer.rb +17 -0
- data/lib/elastic_apm/normalizers/rails/action_view.rb +17 -0
- data/lib/elastic_apm/normalizers/rails/active_record.rb +29 -5
- data/lib/elastic_apm/opentracing.rb +66 -24
- data/lib/elastic_apm/rails.rb +18 -10
- data/lib/elastic_apm/railtie.rb +18 -1
- data/lib/elastic_apm/resque.rb +29 -0
- data/lib/elastic_apm/sinatra.rb +17 -0
- data/lib/elastic_apm/span.rb +20 -2
- data/lib/elastic_apm/span/context.rb +43 -44
- data/lib/elastic_apm/span/context/db.rb +43 -0
- data/lib/elastic_apm/span/context/destination.rb +77 -0
- data/lib/elastic_apm/span/context/http.rb +43 -0
- data/lib/elastic_apm/span_helpers.rb +17 -0
- data/lib/elastic_apm/spies.rb +33 -14
- data/lib/elastic_apm/spies/action_dispatch.rb +17 -0
- data/lib/elastic_apm/spies/delayed_job.rb +17 -0
- data/lib/elastic_apm/spies/elasticsearch.rb +49 -5
- data/lib/elastic_apm/spies/faraday.rb +53 -18
- data/lib/elastic_apm/spies/http.rb +35 -3
- data/lib/elastic_apm/spies/json.rb +17 -0
- data/lib/elastic_apm/spies/mongo.rb +23 -1
- data/lib/elastic_apm/spies/net_http.rb +50 -8
- data/lib/elastic_apm/spies/rake.rb +17 -0
- data/lib/elastic_apm/spies/redis.rb +17 -0
- data/lib/elastic_apm/spies/resque.rb +53 -0
- data/lib/elastic_apm/spies/sequel.rb +52 -15
- data/lib/elastic_apm/spies/shoryuken.rb +65 -0
- data/lib/elastic_apm/spies/sidekiq.rb +17 -0
- data/lib/elastic_apm/spies/sinatra.rb +17 -0
- data/lib/elastic_apm/spies/sneakers.rb +74 -0
- data/lib/elastic_apm/spies/sucker_punch.rb +54 -0
- data/lib/elastic_apm/spies/tilt.rb +17 -0
- data/lib/elastic_apm/sql.rb +36 -0
- data/lib/elastic_apm/sql/signature.rb +169 -0
- data/lib/elastic_apm/sql/tokenizer.rb +264 -0
- data/lib/elastic_apm/sql/tokens.rb +63 -0
- data/lib/elastic_apm/sql_summarizer.rb +18 -2
- data/lib/elastic_apm/stacktrace.rb +17 -0
- data/lib/elastic_apm/stacktrace/frame.rb +17 -0
- data/lib/elastic_apm/stacktrace_builder.rb +23 -1
- data/lib/elastic_apm/subscriber.rb +17 -0
- data/lib/elastic_apm/trace_context.rb +85 -49
- data/lib/elastic_apm/trace_context/traceparent.rb +113 -0
- data/lib/elastic_apm/trace_context/tracestate.rb +43 -0
- data/lib/elastic_apm/transaction.rb +43 -15
- data/lib/elastic_apm/transport/base.rb +39 -23
- data/lib/elastic_apm/transport/connection.rb +17 -0
- data/lib/elastic_apm/transport/connection/http.rb +17 -0
- data/lib/elastic_apm/transport/connection/proxy_pipe.rb +24 -2
- data/lib/elastic_apm/transport/filters.rb +17 -0
- data/lib/elastic_apm/transport/filters/hash_sanitizer.rb +77 -0
- data/lib/elastic_apm/transport/filters/secrets_filter.rb +29 -53
- data/lib/elastic_apm/transport/headers.rb +21 -0
- data/lib/elastic_apm/transport/serializers.rb +17 -0
- data/lib/elastic_apm/transport/serializers/context_serializer.rb +17 -0
- data/lib/elastic_apm/transport/serializers/error_serializer.rb +17 -0
- data/lib/elastic_apm/transport/serializers/metadata_serializer.rb +44 -20
- data/lib/elastic_apm/transport/serializers/metricset_serializer.rb +17 -0
- data/lib/elastic_apm/transport/serializers/span_serializer.rb +45 -8
- data/lib/elastic_apm/transport/serializers/transaction_serializer.rb +17 -0
- data/lib/elastic_apm/transport/user_agent.rb +17 -0
- data/lib/elastic_apm/transport/worker.rb +17 -0
- data/lib/elastic_apm/util.rb +17 -0
- data/lib/elastic_apm/util/inflector.rb +17 -0
- data/lib/elastic_apm/util/lru_cache.rb +17 -0
- data/lib/elastic_apm/util/throttle.rb +17 -0
- data/lib/elastic_apm/version.rb +18 -1
- metadata +36 -7
- data/.ci/downstreamTests.groovy +0 -185
- data/.ci/prepare-git-context.sh +0 -24
- data/.github/workflows/main.yml +0 -14
- data/CHANGELOG.md +0 -1
data/bench/sql.rb
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
$LOAD_PATH.unshift(File.expand_path('../lib', __dir__))
|
5
|
+
|
6
|
+
require 'json'
|
7
|
+
require 'benchmark'
|
8
|
+
include Benchmark # rubocop:disable Style/MixinUsage
|
9
|
+
|
10
|
+
require 'elastic_apm/sql_summarizer'
|
11
|
+
require 'elastic_apm/sql/signature'
|
12
|
+
|
13
|
+
examples =
|
14
|
+
JSON
|
15
|
+
.parse(File.read('../apm/tests/random_sql_query_set.json'))
|
16
|
+
.map { |ex| ex['input'] }
|
17
|
+
|
18
|
+
puts "#{'=' * 14} Parsing #{examples.length} examples #{'=' * 14}"
|
19
|
+
|
20
|
+
summarizer = ElasticAPM::SqlSummarizer.new
|
21
|
+
|
22
|
+
result_old = nil
|
23
|
+
result_new = nil
|
24
|
+
|
25
|
+
benchmark(CAPTION, 7, FORMAT, 'avg/ex:') do |bm|
|
26
|
+
old = bm.report('old:') do
|
27
|
+
result_old = examples.map { |i| summarizer.summarize(i) }
|
28
|
+
end
|
29
|
+
new = bm.report('new:') do
|
30
|
+
result_new = examples.map { |i| ElasticAPM::Sql::Signature.parse(i) }
|
31
|
+
end
|
32
|
+
|
33
|
+
[(new - old) / examples.length]
|
34
|
+
end
|
35
|
+
|
36
|
+
pp(result_old.count { |res| res == 'SQL' })
|
37
|
+
pp(result_new.count { |res| res =~ /(--|\/\*\*)/ })
|
38
|
+
|
39
|
+
## Stackprof
|
40
|
+
|
41
|
+
require 'stackprof'
|
42
|
+
|
43
|
+
puts 'Running stackprof'
|
44
|
+
profile = StackProf.run(mode: :wall, interval: 1) do
|
45
|
+
examples.each { |i| ElasticAPM::Sql::Signature.parse(i) }
|
46
|
+
end
|
47
|
+
puts ''
|
48
|
+
|
49
|
+
StackProf::Report.new(profile).print_text
|
data/bin/build_docs
CHANGED
data/bin/run-tests
CHANGED
@@ -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
|
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
|
|
data/docker-compose.yml
CHANGED
data/docs/api.asciidoc
CHANGED
@@ -42,6 +42,18 @@ If you're not using Rails, see <
|
|
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?`
|
@@ -146,11 +158,30 @@ Arguments:
|
|
146
158
|
* `action`: The action type of span eg. `connect` or `query`.
|
147
159
|
* `context`: An instance of `Span::Context`.
|
148
160
|
* `include_stacktrace`: Whether or not to collect a Stacktrace.
|
161
|
+
* `trace_context:`: An optional `TraceContext` object for Distributed Tracing.
|
162
|
+
* `parent:`: An optional parent transaction or span. Relevant when the span is created in another thread.
|
163
|
+
* `sync:`: An boolean to indicate whether the span is created synchronously or not.
|
149
164
|
* `&block`: An optional block to wrap with the span.
|
150
165
|
The block is passed the span as an optional argument.
|
151
166
|
|
152
167
|
Returns the created span.
|
153
168
|
|
169
|
+
If you'd like to create an asynchronous span, you have to pass the parent `Span` or `Transaction` to the `start_span` method.
|
170
|
+
You can also set the `sync` flag to `false`, if you'd like the span to be marked as asynchronous. This has no effect other than being queryable in Elasticsearch.
|
171
|
+
|
172
|
+
[source,ruby]
|
173
|
+
----
|
174
|
+
transaction = ElasticAPM.current_transaction # or start one with `.start_transaction`
|
175
|
+
Thread.new do
|
176
|
+
ElasticAPM.start_span(
|
177
|
+
'job 1',
|
178
|
+
parent: transaction,
|
179
|
+
sync: false
|
180
|
+
) { Worker.perform }
|
181
|
+
ElasticAPM.end_span
|
182
|
+
end
|
183
|
+
----
|
184
|
+
|
154
185
|
[float]
|
155
186
|
[[api-agent-end_span]]
|
156
187
|
==== `ElasticAPM.end_span`
|
@@ -171,11 +202,29 @@ Arguments:
|
|
171
202
|
* `action`: The action type of span eg. `connect` or `query`.
|
172
203
|
* `context`: An instance of `Span::Context`.
|
173
204
|
* `include_stacktrace`: Whether or not to collect a Stacktrace.
|
205
|
+
* `trace_context:`: An optional `TraceContext` object for Distributed Tracing.
|
206
|
+
* `parent:`: An optional parent transaction or span. Relevant when the span is created in another thread.
|
207
|
+
* `sync:`: An boolean to indicate whether the span is created synchronously or not.
|
174
208
|
* `&block`: An optional block to wrap with the span.
|
175
209
|
The block is passed the span as an optional argument.
|
176
210
|
|
177
211
|
Returns the return value of the given block.
|
178
212
|
|
213
|
+
If you'd like to create an asynchronous span, you have to pass the parent `Span` or `Transaction` to the `with_span` method.
|
214
|
+
You can also set the `sync` flag to `false`, if you'd like the span to be marked as asynchronous.
|
215
|
+
|
216
|
+
[source,ruby]
|
217
|
+
----
|
218
|
+
transaction = ElasticAPM.current_transaction # or start one with `.start_transaction`
|
219
|
+
Thread.new do
|
220
|
+
ElasticAPM.with_span(
|
221
|
+
'job 1',
|
222
|
+
parent: transaction,
|
223
|
+
sync: false
|
224
|
+
) { Worker.perform }
|
225
|
+
end
|
226
|
+
----
|
227
|
+
|
179
228
|
[float]
|
180
229
|
[[api-agent-build-context]]
|
181
230
|
==== `ElasticAPM.build_context`
|
@@ -388,13 +437,13 @@ end
|
|
388
437
|
|
389
438
|
[float]
|
390
439
|
[[api-transaction-sampled_]]
|
391
|
-
====
|
440
|
+
==== `#sampled?`
|
392
441
|
|
393
442
|
Whether the transaction is _sampled_ eg. it includes stacktraces for its spans.
|
394
443
|
|
395
444
|
[float]
|
396
445
|
[[api-transaction-ensure_parent_id]]
|
397
|
-
====
|
446
|
+
==== `#ensure_parent_id`
|
398
447
|
|
399
448
|
If the transaction does not have a parent-ID yet, calling this method generates
|
400
449
|
a new ID, sets it as the parent-ID of this transaction, and returns it as a
|
@@ -409,7 +458,7 @@ JavaScript RUM agent with the value of this method allows analyzing the time
|
|
409
458
|
spent in the browser vs in the backend services.
|
410
459
|
|
411
460
|
To enable the JavaScript RUM agent, initilialize the RUM agent with the Ruby
|
412
|
-
agent'
|
461
|
+
agent's current transaction:
|
413
462
|
|
414
463
|
[source,html]
|
415
464
|
----
|
data/docs/configuration.asciidoc
CHANGED
@@ -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
|
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
|
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
|
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 <
|
|
69
87
|
[float]
|
70
88
|
=== Grape and Rack
|
71
89
|
|
72
|
-
When using
|
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 <
|
|
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`
|
@@ -145,11 +157,28 @@ One example to generate a secure secret token is:
|
|
145
157
|
ruby -r securerandom -e 'print SecureRandom.uuid'
|
146
158
|
----
|
147
159
|
|
148
|
-
WARNING: Secret tokens only provide any real security if your APM server
|
160
|
+
WARNING: Secret tokens only provide any real security if your APM server uses TLS.
|
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.
|
149
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 use TLS
|
|
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 *<
|
|
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
|
-
|
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
|
-
==== `
|
410
|
+
==== `disable_instrumentations`
|
355
411
|
|
356
412
|
[options="header"]
|
357
413
|
|============
|
358
|
-
| Environment
|
359
|
-
| `
|
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`
|
@@ -726,6 +854,17 @@ between `0.0` and `1.0`.
|
|
726
854
|
We still record overall time and the result for unsampled transactions, but no
|
727
855
|
context information, tags, or spans.
|
728
856
|
|
857
|
+
[float]
|
858
|
+
[[config-use-experimental-sql-parser]]
|
859
|
+
==== `use_legacy_sql_parser`
|
860
|
+
|============
|
861
|
+
| Environment | `Config` key | Default
|
862
|
+
| `ELASTIC_APM_USE_LEGACY_SQL_PARSER` | `use_legacy_sql_parser` | `false`
|
863
|
+
|============
|
864
|
+
|
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.
|
867
|
+
|
729
868
|
[float]
|
730
869
|
[[config-verify-server-cert]]
|
731
870
|
==== `verify_server_cert`
|
@@ -778,3 +917,13 @@ The unit is provided as suffix directly after the number, without any separation
|
|
778
917
|
* `gb` (gigabytes)
|
779
918
|
|
780
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.
|