elastic-apm 1.1.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of elastic-apm might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rspec +1 -0
- data/.rubocop.yml +7 -1
- data/CHANGELOG.md +45 -0
- data/Gemfile +17 -12
- data/bench/app.rb +1 -2
- data/bench/benchmark.rb +1 -1
- data/bench/stackprof.rb +1 -1
- data/docs/api.asciidoc +115 -76
- data/docs/configuration.asciidoc +232 -167
- data/docs/context.asciidoc +7 -3
- data/docs/custom-instrumentation.asciidoc +17 -28
- data/docs/index.asciidoc +13 -7
- data/docs/supported-technologies.asciidoc +65 -0
- data/elastic-apm.gemspec +3 -2
- data/lib/elastic_apm.rb +272 -121
- data/lib/elastic_apm/agent.rb +56 -107
- data/lib/elastic_apm/config.rb +130 -106
- data/lib/elastic_apm/config/duration.rb +25 -0
- data/lib/elastic_apm/config/size.rb +28 -0
- data/lib/elastic_apm/context_builder.rb +1 -0
- data/lib/elastic_apm/deprecations.rb +19 -0
- data/lib/elastic_apm/error.rb +5 -2
- data/lib/elastic_apm/error/exception.rb +1 -1
- data/lib/elastic_apm/error_builder.rb +5 -0
- data/lib/elastic_apm/instrumenter.rb +121 -53
- data/lib/elastic_apm/internal_error.rb +1 -0
- data/lib/elastic_apm/{log.rb → logging.rb} +16 -11
- data/lib/elastic_apm/metadata.rb +20 -0
- data/lib/elastic_apm/metadata/process_info.rb +26 -0
- data/lib/elastic_apm/metadata/service_info.rb +56 -0
- data/lib/elastic_apm/metadata/system_info.rb +30 -0
- data/lib/elastic_apm/middleware.rb +31 -15
- data/lib/elastic_apm/normalizers/action_controller.rb +1 -1
- data/lib/elastic_apm/normalizers/action_mailer.rb +1 -1
- data/lib/elastic_apm/normalizers/action_view.rb +3 -3
- data/lib/elastic_apm/normalizers/active_record.rb +2 -1
- data/lib/elastic_apm/railtie.rb +1 -1
- data/lib/elastic_apm/span.rb +59 -29
- data/lib/elastic_apm/span/context.rb +30 -4
- data/lib/elastic_apm/span_helpers.rb +1 -1
- data/lib/elastic_apm/spies/delayed_job.rb +7 -7
- data/lib/elastic_apm/spies/elasticsearch.rb +4 -4
- data/lib/elastic_apm/spies/http.rb +38 -0
- data/lib/elastic_apm/spies/mongo.rb +22 -11
- data/lib/elastic_apm/spies/net_http.rb +7 -4
- data/lib/elastic_apm/spies/rake.rb +5 -6
- data/lib/elastic_apm/spies/redis.rb +1 -1
- data/lib/elastic_apm/spies/sequel.rb +9 -7
- data/lib/elastic_apm/spies/sidekiq.rb +5 -5
- data/lib/elastic_apm/spies/tilt.rb +2 -2
- data/lib/elastic_apm/sql_summarizer.rb +3 -3
- data/lib/elastic_apm/stacktrace_builder.rb +6 -6
- data/lib/elastic_apm/subscriber.rb +3 -3
- data/lib/elastic_apm/traceparent.rb +62 -0
- data/lib/elastic_apm/transaction.rb +62 -93
- data/lib/elastic_apm/transport/base.rb +98 -0
- data/lib/elastic_apm/transport/connection.rb +175 -0
- data/lib/elastic_apm/transport/filters.rb +45 -0
- data/lib/elastic_apm/transport/filters/request_body_filter.rb +31 -0
- data/lib/elastic_apm/transport/filters/secrets_filter.rb +59 -0
- data/lib/elastic_apm/transport/serializers.rb +58 -0
- data/lib/elastic_apm/transport/serializers/error_serializer.rb +59 -0
- data/lib/elastic_apm/transport/serializers/span_serializer.rb +30 -0
- data/lib/elastic_apm/transport/serializers/transaction_serializer.rb +33 -0
- data/lib/elastic_apm/transport/worker.rb +73 -0
- data/lib/elastic_apm/util.rb +11 -8
- data/lib/elastic_apm/version.rb +1 -1
- metadata +40 -21
- data/.travis.yml +0 -5
- data/docs/troubleshooting.asciidoc +0 -28
- data/lib/elastic_apm/filters.rb +0 -46
- data/lib/elastic_apm/filters/request_body_filter.rb +0 -33
- data/lib/elastic_apm/filters/secrets_filter.rb +0 -59
- data/lib/elastic_apm/http.rb +0 -139
- data/lib/elastic_apm/process_info.rb +0 -24
- data/lib/elastic_apm/serializers.rb +0 -28
- data/lib/elastic_apm/serializers/errors.rb +0 -61
- data/lib/elastic_apm/serializers/transactions.rb +0 -51
- data/lib/elastic_apm/service_info.rb +0 -54
- data/lib/elastic_apm/system_info.rb +0 -28
- data/lib/elastic_apm/util/dig.rb +0 -31
- data/lib/elastic_apm/util/inspector.rb +0 -61
- data/lib/elastic_apm/worker.rb +0 -106
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bfb206def6af3e002dc6b946add05afddaa93909016ca654711a6efd4a9353c9
|
4
|
+
data.tar.gz: fc4edd5a2209f1babfe9277865024eb71eb24a7713b2f77c8d80a4ed6c12117f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 464029e0c25e3a1b3ab9417f16e3b73ca8c6f5e779f37a4e45d0648c76bd2a58ff417fa95fa55adb97c5da465e637dc270df63e4b86ed2a1584ccc9040d32bbd
|
7
|
+
data.tar.gz: ddebff0d47f88aaa983b46764ecafd4e12073c33434d8c7bb275e3f0655466fb237bf72ea2a3ebc8dc6583c97bf97e6903699e49efd39e74143981e3d608b8aa
|
data/.gitignore
CHANGED
data/.rspec
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
AllCops:
|
2
|
-
TargetRubyVersion: 2.
|
2
|
+
TargetRubyVersion: 2.3
|
3
3
|
Exclude:
|
4
4
|
- 'elastic-apm.gemspec'
|
5
5
|
- 'vendor/**/*'
|
@@ -59,3 +59,9 @@ Style/EmptyMethod:
|
|
59
59
|
|
60
60
|
Rails/Delegate:
|
61
61
|
Enabled: false
|
62
|
+
|
63
|
+
Style/NumericPredicate:
|
64
|
+
Enabled: false
|
65
|
+
|
66
|
+
Layout/EmptyLineAfterGuardClause:
|
67
|
+
Enabled: false
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,51 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
|
5
5
|
This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
|
+
## 2.0.0 (2018-11-14)
|
8
|
+
|
9
|
+
Version adds support for APM Server 6.5 and needs at least that.
|
10
|
+
|
11
|
+
### Added
|
12
|
+
|
13
|
+
- Support for APM Server 6.5 (Intake v2)
|
14
|
+
- Support for Distributed Tracing (beta)
|
15
|
+
- Support for RUM Agent correlation (Distributed Tracing)
|
16
|
+
- Support for [HTTP.rb](https://github.com/httprb/http) (Instrumentation + Distributed Tracing)
|
17
|
+
|
18
|
+
### Changed
|
19
|
+
|
20
|
+
- Custom instrumentation APIs ([#209](https://github.com/elastic/apm-agent-ruby/pull/209))
|
21
|
+
- Tag keys will convert disallowed chars to `_`
|
22
|
+
- Default log level changed to `info`
|
23
|
+
- Laxed version requirement of concurrent-ruby
|
24
|
+
- Change `log_level` to only concern agent log
|
25
|
+
|
26
|
+
### Deprecated
|
27
|
+
|
28
|
+
#### APIs:
|
29
|
+
|
30
|
+
- `ElasticAPM.transaction`
|
31
|
+
- `ElasticAPM.span`
|
32
|
+
|
33
|
+
#### Options:
|
34
|
+
|
35
|
+
- `compression_level`
|
36
|
+
- `compression_minimum_size`
|
37
|
+
- `debug_http`
|
38
|
+
- `debug_transactions`
|
39
|
+
- `flush_interval`
|
40
|
+
- `http_open_timeout`
|
41
|
+
- `http_read_timeout`
|
42
|
+
- `enabled_environments`
|
43
|
+
- `disable_environment_warning`
|
44
|
+
|
45
|
+
Some options that used to take a certain unit for granted now expects explicit units – but will fall back to old default.
|
46
|
+
|
47
|
+
### Removed
|
48
|
+
|
49
|
+
- Support for APM Server versions prior to 6.5.
|
50
|
+
- Support for Ruby 2.2 (eol)
|
51
|
+
|
7
52
|
## 1.1.0 (2018-09-07)
|
8
53
|
|
9
54
|
### Added
|
data/Gemfile
CHANGED
@@ -6,21 +6,22 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
|
6
6
|
|
7
7
|
gemspec
|
8
8
|
|
9
|
-
gem 'elasticsearch'
|
10
|
-
gem 'fakeredis', require: nil
|
11
|
-
gem 'json-schema'
|
12
|
-
gem 'mongo'
|
13
9
|
gem 'pry'
|
14
10
|
gem 'rack-test'
|
15
|
-
gem 'rake'
|
16
|
-
gem 'redis', require: nil
|
17
11
|
gem 'rspec'
|
18
|
-
gem '
|
19
|
-
gem '
|
20
|
-
gem 'sidekiq'
|
12
|
+
gem 'rspec-its'
|
13
|
+
gem 'rubocop', require: nil
|
21
14
|
gem 'timecop'
|
22
15
|
gem 'webmock'
|
23
|
-
|
16
|
+
|
17
|
+
gem 'elasticsearch', require: nil
|
18
|
+
gem 'fakeredis', require: nil
|
19
|
+
gem 'json-schema', require: nil
|
20
|
+
gem 'mongo', require: nil
|
21
|
+
gem 'rake', require: nil
|
22
|
+
gem 'sequel', require: nil
|
23
|
+
gem 'sidekiq', require: nil
|
24
|
+
gem 'yard', require: nil
|
24
25
|
gem 'yarjuf'
|
25
26
|
|
26
27
|
if RUBY_PLATFORM == 'java'
|
@@ -41,7 +42,11 @@ else
|
|
41
42
|
gem framework
|
42
43
|
end
|
43
44
|
|
45
|
+
unless version == 'master'
|
46
|
+
gem 'delayed_job', require: nil
|
47
|
+
end
|
48
|
+
|
44
49
|
group :bench do
|
45
|
-
gem 'ruby-prof', platforms: %i[ruby]
|
46
|
-
gem 'stackprof', platforms: %i[ruby]
|
50
|
+
gem 'ruby-prof', require: nil, platforms: %i[ruby]
|
51
|
+
gem 'stackprof', require: nil, platforms: %i[ruby]
|
47
52
|
end
|
data/bench/app.rb
CHANGED
@@ -20,11 +20,10 @@ class App
|
|
20
20
|
@config = ElasticAPM::Config.new(
|
21
21
|
{
|
22
22
|
environment: 'bench',
|
23
|
-
enabled_environments: ['bench'],
|
24
23
|
disable_send: true
|
25
24
|
}.merge(config)
|
26
25
|
)
|
27
|
-
@serializer = ElasticAPM::Serializers::Transactions.new(@config)
|
26
|
+
# @serializer = ElasticAPM::Serializers::Transactions.new(@config)
|
28
27
|
@mock_env = Rack::MockRequest.env_for('/')
|
29
28
|
end
|
30
29
|
|
data/bench/benchmark.rb
CHANGED
data/bench/stackprof.rb
CHANGED
data/docs/api.asciidoc
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
[[api]]
|
2
2
|
== Public API
|
3
3
|
|
4
|
-
Although most usage is covered automatically, Elastic APM also has a public
|
5
|
-
allows custom usage.
|
4
|
+
Although most usage is covered automatically, Elastic APM also has a public
|
5
|
+
API that allows custom usage.
|
6
6
|
|
7
7
|
[float]
|
8
8
|
[[agent-life-cycle]]
|
@@ -24,7 +24,8 @@ ElasticAPM.start(server_url: 'http://localhost:8200')
|
|
24
24
|
* `config`: An optional hash or `ElasticAPM::Config` instance with configuration
|
25
25
|
options. See <<configuration,Configuration>>.
|
26
26
|
|
27
|
-
If you are using <<getting-started-rails,Ruby on Rails>> this is done
|
27
|
+
If you are using <<getting-started-rails,Ruby on Rails>> this is done
|
28
|
+
automatically for you.
|
28
29
|
If not see <<getting-started-rack,Getting started with Rack>>.
|
29
30
|
|
30
31
|
[float]
|
@@ -56,61 +57,103 @@ Returns the currently running agent or nil.
|
|
56
57
|
Returns the current `ElasticAPM::Transaction` or nil.
|
57
58
|
|
58
59
|
[float]
|
59
|
-
[[api-agent-
|
60
|
-
==== `ElasticAPM.
|
60
|
+
[[api-agent-start_transaction]]
|
61
|
+
==== `ElasticAPM.start_transaction`
|
61
62
|
|
62
|
-
Start a _transaction_ eg.
|
63
|
-
|
64
|
-
If called without a block you are expected to end the transaction yourself.
|
65
|
-
If given a block, the code inside will be wrapped in a transaction.
|
66
|
-
|
67
|
-
You need to submit it yourself with `transaction.submit(status)`.
|
63
|
+
Start a _transaction_ eg. an incoming web request or a background job.
|
68
64
|
|
69
65
|
[source,ruby]
|
70
66
|
----
|
71
67
|
# call with block
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
transaction.submit(200)
|
77
|
-
|
78
|
-
# without block
|
79
|
-
transaction = ElasticAPM.transaction('Do things')
|
80
|
-
do_work
|
81
|
-
transaction.submit(200) # .submit(result) will also .done(result)
|
68
|
+
ElasticAPM.start_transaction('Name')
|
69
|
+
do_work # ...
|
70
|
+
ElasticAPM.end_transaction('result')
|
82
71
|
----
|
83
72
|
|
84
73
|
Arguments:
|
85
74
|
|
86
75
|
* `name`: A name for your transaction. Transactions are grouped by name. **Required**.
|
87
76
|
* `type`: A `type` for your transaction eg. `db.postgresql.sql`.
|
88
|
-
* `context:`: An optional <<api-context,Context>> used to enrich the
|
89
|
-
information about the current request.
|
90
|
-
*
|
91
|
-
transaction as an optional argument.
|
77
|
+
* `context:`: An optional <<api-context,Context>> used to enrich the
|
78
|
+
transaction with information about the current request.
|
79
|
+
* `traceparent:`: An optional `Traceparent` object for Distributed Tracing.
|
92
80
|
|
93
81
|
Returns the transaction.
|
94
82
|
|
95
83
|
[float]
|
96
|
-
[[api-agent-
|
97
|
-
==== `ElasticAPM.
|
84
|
+
[[api-agent-end_transaction]]
|
85
|
+
==== `ElasticAPM.end_transaction`
|
86
|
+
|
87
|
+
Ends the currently running transaction.
|
88
|
+
|
89
|
+
Arguments:
|
98
90
|
|
99
|
-
|
100
|
-
queries or external web requests.
|
91
|
+
* `result`: A `String` result of the transaction, eg. `'success'`.
|
101
92
|
|
102
|
-
|
103
|
-
|
93
|
+
[float]
|
94
|
+
[[api-agent-with_transaction]]
|
95
|
+
==== `ElasticAPM.with_transaction`
|
96
|
+
|
97
|
+
Wrap a block in a Transaction, starting and ending around the block
|
104
98
|
|
105
99
|
[source,ruby]
|
106
100
|
----
|
107
|
-
ElasticAPM.transaction 'Do things' do
|
108
|
-
|
109
|
-
|
110
|
-
|
101
|
+
ElasticAPM.transaction 'Do things' do |transaction|
|
102
|
+
do_work # ...
|
103
|
+
|
104
|
+
transaction.result = 'success'
|
111
105
|
end
|
112
106
|
----
|
113
107
|
|
108
|
+
Arguments:
|
109
|
+
|
110
|
+
* `name`: A name for your transaction. Transactions are grouped by name. **Required**.
|
111
|
+
* `type`: A `type` for your transaction eg. `db.postgresql.sql`.
|
112
|
+
* `context:`: An optional <<api-context,Context>> used to enrich the
|
113
|
+
transaction with information about the current request.
|
114
|
+
* `traceparent:`: An optional `Traceparent` object for Distributed Tracing.
|
115
|
+
* `&block`: A block to wrap. Optionally yields the transaction.
|
116
|
+
|
117
|
+
Returns the return value of the given block.
|
118
|
+
|
119
|
+
[float]
|
120
|
+
[[api-agent-start_span]]
|
121
|
+
==== `ElasticAPM.start_span`
|
122
|
+
|
123
|
+
Start a new span.
|
124
|
+
|
125
|
+
[source,ruby]
|
126
|
+
----
|
127
|
+
ElasticAPM.with_transaction 'Do things' do
|
128
|
+
ElasticAPM.start_span 'Do one of the things'
|
129
|
+
Database.query # ...
|
130
|
+
ElasticAPM.end_span
|
131
|
+
end
|
132
|
+
----
|
133
|
+
|
134
|
+
Arguments:
|
135
|
+
|
136
|
+
* `name`: A name for your span. **Required**.
|
137
|
+
* `type`: The type of work eg. `db.postgresql.query`.
|
138
|
+
* `context`: An instance of `Span::Context`.
|
139
|
+
* `include_stacktrace`: Whether or not to collect a Stacktrace.
|
140
|
+
* `&block`: An optional block to wrap with the span.
|
141
|
+
The block is passed the span as an optional argument.
|
142
|
+
|
143
|
+
Returns the created span.
|
144
|
+
|
145
|
+
[float]
|
146
|
+
[[api-agent-end_span]]
|
147
|
+
==== `ElasticAPM.end_span`
|
148
|
+
|
149
|
+
Ends the currently running span.
|
150
|
+
|
151
|
+
[float]
|
152
|
+
[[api-agent-with_span]]
|
153
|
+
==== `ElasticAPM.with_span`
|
154
|
+
|
155
|
+
Wraps a block in a Span.
|
156
|
+
|
114
157
|
Arguments:
|
115
158
|
|
116
159
|
* `name`: A name for your span. **Required**.
|
@@ -120,7 +163,7 @@ Arguments:
|
|
120
163
|
* `&block`: An optional block to wrap with the span.
|
121
164
|
The block is passed the span as an optional argument.
|
122
165
|
|
123
|
-
|
166
|
+
Returns the return value of the given block.
|
124
167
|
|
125
168
|
[float]
|
126
169
|
[[api-agent-build-context]]
|
@@ -191,8 +234,8 @@ Returns `[ElasticAPM::Error]`.
|
|
191
234
|
==== `ElasticAPM.set_tag`
|
192
235
|
|
193
236
|
Add a tag to the current transaction.
|
194
|
-
Tags are basic key-value pairs that are indexed in your Elasticsearch database
|
195
|
-
therefore searchable.
|
237
|
+
Tags are basic key-value pairs that are indexed in your Elasticsearch database
|
238
|
+
and therefore searchable.
|
196
239
|
|
197
240
|
[source,ruby]
|
198
241
|
----
|
@@ -203,7 +246,7 @@ end
|
|
203
246
|
|
204
247
|
Arguments:
|
205
248
|
|
206
|
-
* `key`: A string key.
|
249
|
+
* `key`: A string key. Note that `.`, `*` or `"` will be converted to `_`.
|
207
250
|
* `value`: A string value.
|
208
251
|
|
209
252
|
Returns the set `value`.
|
@@ -287,51 +330,48 @@ end
|
|
287
330
|
|
288
331
|
- `name`: String
|
289
332
|
- `type`: String
|
333
|
+
- `result`: String
|
334
|
+
- `trace_id`: String (readonly)
|
290
335
|
|
291
336
|
[float]
|
292
|
-
[[api-transaction-
|
293
|
-
====
|
294
|
-
|
295
|
-
Makes sure the transaction is no longer `ElasticAPM.current_transaction`.
|
296
|
-
|
297
|
-
[float]
|
298
|
-
[[api-transaction-done]]
|
299
|
-
==== `#done(result)`
|
300
|
-
|
301
|
-
*Args:*
|
302
|
-
|
303
|
-
- `result`: String result of transaction, eg. `success`. Default: `nil`.
|
304
|
-
|
305
|
-
Ends the transaction, settings its `duration` to µs since it began and sets its result.
|
306
|
-
|
307
|
-
Returns `self`.
|
308
|
-
|
309
|
-
[float]
|
310
|
-
[[api-transaction-done_]]
|
311
|
-
==== `#done?`
|
337
|
+
[[api-transaction-sampled_]]
|
338
|
+
==== #sampled?
|
312
339
|
|
313
|
-
|
340
|
+
Whether the transaction is _sampled_ eg. it includes stacktraces for its spans.
|
314
341
|
|
315
342
|
[float]
|
316
|
-
[[api-transaction-
|
317
|
-
====
|
343
|
+
[[api-transaction-ensure_parent_id]]
|
344
|
+
==== #ensure_parent_id
|
318
345
|
|
319
|
-
|
346
|
+
If the transaction does not have a parent-ID yet, calling this method generates
|
347
|
+
a new ID, sets it as the parent-ID of this transaction, and returns it as a
|
348
|
+
`String`.
|
320
349
|
|
321
|
-
|
322
|
-
|
323
|
-
|
350
|
+
This enables the correlation of the spans the JavaScript Real User Monitoring
|
351
|
+
(RUM) agent creates for the initial page load with the transaction of the
|
352
|
+
backend service.
|
324
353
|
|
325
|
-
|
326
|
-
|
354
|
+
If your service generates the HTML page dynamically, initializing the
|
355
|
+
JavaScript RUM agent with the value of this method allows analyzing the time
|
356
|
+
spent in the browser vs in the backend services.
|
327
357
|
|
328
|
-
|
358
|
+
To enable the JavaScript RUM agent, initilialize the RUM agent with the Ruby
|
359
|
+
agent'a current transaction:
|
329
360
|
|
330
|
-
[
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
361
|
+
[source,html]
|
362
|
+
----
|
363
|
+
<script src="elastic-apm-js-base/dist/bundles/elastic-apm-js-base.umd.min.js"></script>
|
364
|
+
<script>
|
365
|
+
var elasticApm = initApm({
|
366
|
+
serviceName: '',
|
367
|
+
serverUrl: 'http://localhost:8200',
|
368
|
+
pageLoadTraceId: "<%= ElasticAPM.current_transaction&.trace_id %>",
|
369
|
+
pageLoadSpanId: "<%= ElasticAPM.current_transaction&.ensure_parent_id %>",
|
370
|
+
pageLoadSampled: <%= ElasticAPM.current_transaction&.sampled? %>
|
371
|
+
})
|
372
|
+
</script>
|
373
|
+
----
|
374
|
+
See the {apm-rum-ref}[JavaScript RUM agent documentation] for more information.
|
335
375
|
|
336
376
|
[float]
|
337
377
|
[[api-span]]
|
@@ -347,5 +387,4 @@ Whether the transaction is _sampled_ eg. it includes stacktraces for its spans.
|
|
347
387
|
[[api-context]]
|
348
388
|
=== Context
|
349
389
|
|
350
|
-
|
351
|
-
|
390
|
+
See https://www.elastic.co/guide/en/apm/server/current/transaction-api.html#transaction-context-schema[APM Server API Specs].
|
data/docs/configuration.asciidoc
CHANGED
@@ -56,7 +56,7 @@ Some options can be set with `ENV` variables and all of them may be set in
|
|
56
56
|
your source code.
|
57
57
|
|
58
58
|
When setting values for lists using `ENV` variables, strings are split by comma
|
59
|
-
eg `
|
59
|
+
eg `ELASTIC_APM_ENABLED_ENVIRONMENTS=development,production`.
|
60
60
|
|
61
61
|
[float]
|
62
62
|
[[config-config-file]]
|
@@ -68,7 +68,7 @@ eg `ELASTIC_APM_ENBALED_ENVIRONMENTS=development,production`.
|
|
68
68
|
| `ELASTIC_APM_CONFIG_FILE` | `config_file` | `config/elastic_apm.yml`
|
69
69
|
|============
|
70
70
|
|
71
|
-
Path to the configuration
|
71
|
+
Path to the configuration YAML-file.
|
72
72
|
Elastic APM will load config options from this if the file exists.
|
73
73
|
|
74
74
|
[float]
|
@@ -107,37 +107,103 @@ ruby -r securerandom -e 'print SecureRandom.uuid'
|
|
107
107
|
WARNING: Secret tokens only provide any real security if your APM server use TLS.
|
108
108
|
|
109
109
|
[float]
|
110
|
-
[[config-
|
111
|
-
==== `
|
110
|
+
[[config-api-buffer-size]]
|
111
|
+
==== `api_buffer_size`
|
112
|
+
|============
|
113
|
+
| Environment | `Config` key | Default
|
114
|
+
| `ELASTIC_APM_API_BUFFER_SIZE` | `api_buffer_size` | `256`
|
115
|
+
|============
|
116
|
+
|
117
|
+
Maximum amount of objects kept in queue, before sending to APM Server.
|
118
|
+
|
119
|
+
If you hit this limit you either have to increase the agent's
|
120
|
+
<<config-pool-size,worker pool size>> or it could mean the agent has trouble
|
121
|
+
connecting to APM Server. The <<config-log-path,logs>> should tell you what
|
122
|
+
went wrong.
|
123
|
+
|
124
|
+
[float]
|
125
|
+
[[config-api-request-size]]
|
126
|
+
==== `api_request_size`
|
127
|
+
|============
|
128
|
+
| Environment | `Config` key | Default
|
129
|
+
| `ELASTIC_APM_API_REQUEST_SIZE` | `api_request_size` | `"750kb"`
|
130
|
+
|============
|
131
|
+
|
132
|
+
Maximum amount of bytes sent over one request to APM Server. When reached the agent
|
133
|
+
will open a new request.
|
134
|
+
|
135
|
+
It has to be provided in *<<config-format-size, size format>>*.
|
136
|
+
|
137
|
+
[float]
|
138
|
+
[[config-api-request-time]]
|
139
|
+
==== `api_request_time`
|
140
|
+
|============
|
141
|
+
| Environment | `Config` key | Default
|
142
|
+
| `ELASTIC_APM_API_REQUEST_TIME` | `api_request_time` | `"10s"`
|
143
|
+
|============
|
144
|
+
|
145
|
+
Maximum duration of a single streaming request to APM Server before opening
|
146
|
+
a new one.
|
147
|
+
|
148
|
+
APM Server has its own limit of 30 seconds before it will close requests.
|
112
149
|
|
150
|
+
It has to be provided in *<<config-format-duration, duration format>>*.
|
151
|
+
|
152
|
+
[float]
|
153
|
+
[[config-custom-key-filters]]
|
154
|
+
==== `custom_key_filters`
|
113
155
|
[options="header"]
|
114
156
|
|============
|
115
|
-
| Environment
|
116
|
-
| `
|
157
|
+
| Environment | `Config` key | Default | Example
|
158
|
+
| `ELASTIC_APM_CUSTOM_KEY_FILTERS` | `custom_key_filters` | `[]` | `['MyAuthHeader']`
|
117
159
|
|============
|
118
160
|
|
119
|
-
|
120
|
-
|
121
|
-
|
161
|
+
Elastic APM strips
|
162
|
+
https://github.com/elastic/apm-agent-ruby/blob/1.x/lib/elastic_apm/filters/secrets_filter.rb[
|
163
|
+
what looks like confidential information] from the request/response headers.
|
164
|
+
Use this option to add your own custom header keys to the list of filtered keys.
|
122
165
|
|
123
|
-
|
124
|
-
|
166
|
+
When setting this option via `ENV`, use a comma separated string.
|
167
|
+
Eg. `ELASTIC_APM_CUSTOM_KEY_FILTERS="a,b" # => [/a/, /b/]`
|
125
168
|
|
126
|
-
|
127
|
-
|
128
|
-
|
169
|
+
[float]
|
170
|
+
[[config-default-tags]]
|
171
|
+
==== `default_tags`
|
172
|
+
|
173
|
+
[options="header"]
|
174
|
+
|============
|
175
|
+
| Environment | `Config` key | Default | Example
|
176
|
+
| `ELASTIC_APM_DEFAULT_TAGS` | `default_tags` | `{}` | `region=us1`
|
177
|
+
|============
|
178
|
+
|
179
|
+
Add default tags to add to every transaction.
|
180
|
+
|
181
|
+
WARNING: Be aware that tags are indexed in Elasticsearch. Using too many unique keys will result in *https://www.elastic.co/blog/found-crash-elasticsearch#mapping-explosion[Mapping explosion]*.
|
129
182
|
|
130
183
|
[float]
|
131
|
-
[[config-
|
132
|
-
==== `
|
184
|
+
[[config-disable-send]]
|
185
|
+
==== `disable_send`
|
186
|
+
|============
|
187
|
+
| Environment | `Config` key | Default
|
188
|
+
| N/A | `disable_send` | `false`
|
189
|
+
|============
|
190
|
+
|
191
|
+
Disables sending payloads to APM Server.
|
192
|
+
|
193
|
+
[float]
|
194
|
+
[[config-disabled-spies]]
|
195
|
+
==== `disabled_spies`
|
196
|
+
|
133
197
|
[options="header"]
|
134
198
|
|============
|
135
|
-
| Environment
|
136
|
-
| `
|
199
|
+
| Environment | `Config` key | Default
|
200
|
+
| `ELASTIC_APM_DISABLED_SPIES` | `disabled_spies` | `['json']`
|
137
201
|
|============
|
138
202
|
|
139
|
-
|
140
|
-
|
203
|
+
Elastic APM automatically instruments select third party libraries.
|
204
|
+
Use this option to disable any of these.
|
205
|
+
|
206
|
+
Get an array of enabled spies with `ElasticAPM.agent.config.enabled_spies`.
|
141
207
|
|
142
208
|
[float]
|
143
209
|
[[config-environment]]
|
@@ -154,22 +220,19 @@ e.g. "production" or "staging".
|
|
154
220
|
|
155
221
|
Defaults to `ENV['RAILS_ENV'] || ENV['RACK_ENV']`.
|
156
222
|
|
157
|
-
|
158
|
-
|
159
|
-
|
223
|
+
NOTE: Kibana will not differentiate between different environments. To avoid
|
224
|
+
mixing data from multiple environments, consider appending the environment to
|
225
|
+
`service_name`.
|
160
226
|
|
161
|
-
[
|
227
|
+
[float]
|
228
|
+
[[config-filter-exception-types]]
|
229
|
+
==== `filter_exception_types`
|
162
230
|
|============
|
163
|
-
| Environment
|
164
|
-
| `
|
231
|
+
| Environment | `Config` key | Default | Example
|
232
|
+
| N/A | `filter_exception_types` | `[]` | `[MyApp::Errors::IgnoredError]`
|
165
233
|
|============
|
166
234
|
|
167
|
-
|
168
|
-
|
169
|
-
If the current envrironment isn't included, the agent will effectively be a _noop_
|
170
|
-
and do nothing.
|
171
|
-
So you can keep in your custom instrumentation code without the agent sending
|
172
|
-
anything nor complain.
|
235
|
+
Use this to filter error tracking for specific error constants.
|
173
236
|
|
174
237
|
[float]
|
175
238
|
[[config-framework-name]]
|
@@ -210,20 +273,44 @@ otherwise, the default is `nil`.
|
|
210
273
|
The host name to use when sending error and transaction data to the APM server.
|
211
274
|
|
212
275
|
[float]
|
213
|
-
[[config-
|
214
|
-
==== `
|
276
|
+
[[config-custom-ignore-url-patterns]]
|
277
|
+
==== `ignore_url_patterns`
|
278
|
+
[options="header"]
|
279
|
+
|============
|
280
|
+
| Environment | `Config` key | Default | Example
|
281
|
+
| `ELASTIC_APM_IGNORE_URL_PATTERNS` | `ignore_url_patterns` | `[]` | `['^/ping', %r{^/admin}]`
|
282
|
+
|============
|
283
|
+
|
284
|
+
Use this option to ignore certain URL patterns eg. healthchecks or admin sections.
|
285
|
+
|
286
|
+
_Ignoring_ in this context means _don't wrap in a <<api-transaction,Transaction>>_.
|
287
|
+
Errors will still be reported.
|
215
288
|
|
289
|
+
When setting this option via `ENV`, use a comma separated string.
|
290
|
+
Eg. `ELASTIC_APM_IGNORE_URL_PATTERNS="a,b" # => [/a/, /b/]`
|
291
|
+
|
292
|
+
[float]
|
293
|
+
[[config-instrument]]
|
294
|
+
==== `instrument`
|
216
295
|
[options="header"]
|
217
296
|
|============
|
218
|
-
| Environment
|
219
|
-
| `
|
297
|
+
| Environment | `Config` key | Default | Example
|
298
|
+
| `ELASTIC_APM_INSTRUMENT` | `instrument` | `true` | `0`
|
220
299
|
|============
|
221
300
|
|
222
|
-
|
301
|
+
Use this option to ignore certain URL patterns eg. healthchecks or admin sections.
|
223
302
|
|
224
|
-
|
303
|
+
[float]
|
304
|
+
[[config-instrumented-rake-tasks]]
|
305
|
+
==== `instrumented_rake_tasks`
|
225
306
|
|
226
|
-
|
307
|
+
[options="header"]
|
308
|
+
|============
|
309
|
+
| Environment | `Config` key | Default | Example
|
310
|
+
| `ELASTIC_APM_INSTRUMENTED_RAKE_TASKS` | `instrumented_rake_tasks` | `[]` | `['my_task']`
|
311
|
+
|============
|
312
|
+
|
313
|
+
Elastic APM can instrument your Rake tasks but given that they are used for a multitude of sometimes very different and not always relevant things, this is opt in.
|
227
314
|
|
228
315
|
[float]
|
229
316
|
[[config-log-level]]
|
@@ -237,6 +324,22 @@ Should support both absolute and relative paths. Just make sure the directory ex
|
|
237
324
|
|
238
325
|
By default Elastic APM logs to `stdout` or uses `Rails.log` when used with Rails.
|
239
326
|
|
327
|
+
[float]
|
328
|
+
[[config-log-path]]
|
329
|
+
==== `log_path`
|
330
|
+
|
331
|
+
[options="header"]
|
332
|
+
|============
|
333
|
+
| Environment | `Config` key | Default | Example
|
334
|
+
| `ELASTIC_APM_LOG_PATH` | `log_path` | `nil` | `log/elastic_apm.log`
|
335
|
+
|============
|
336
|
+
|
337
|
+
A path to a log file.
|
338
|
+
|
339
|
+
By default Elastic APM logs to `stdout` or uses `Rails.log` when used with Rails.
|
340
|
+
|
341
|
+
Should support both absolute and relative paths. Just make sure the directory exists.
|
342
|
+
|
240
343
|
[float]
|
241
344
|
[[config-logger]]
|
242
345
|
==== `logger`
|
@@ -251,6 +354,56 @@ By default Elastic APM logs to `stdout` or uses `Rails.log` when used with Rails
|
|
251
354
|
|
252
355
|
Use this to provide another logger. Expected to have the same API as Ruby's built-in `Logger`.
|
253
356
|
|
357
|
+
[float]
|
358
|
+
[[config-pool-size]]
|
359
|
+
==== `pool_size`
|
360
|
+
|
361
|
+
[options="header"]
|
362
|
+
|============
|
363
|
+
| Environment | `Config` key | Default | Example
|
364
|
+
| `ELASTIC_APM_POOL_SIZE` | `pool_size` | `1` | `2`
|
365
|
+
|============
|
366
|
+
|
367
|
+
Elastic APM uses a thread pool to send its data to APM Server.
|
368
|
+
|
369
|
+
This makes sure the agent doesn't block the main thread any more than necessary.
|
370
|
+
|
371
|
+
If you have high load and get warnings about the buffer being full, increasing
|
372
|
+
the worker pool size might help.
|
373
|
+
|
374
|
+
[float]
|
375
|
+
[[config-service-name]]
|
376
|
+
==== `service_name`
|
377
|
+
|
378
|
+
[options="header"]
|
379
|
+
|============
|
380
|
+
| Environment | `Config` key | Default | Example
|
381
|
+
| `ELASTIC_APM_SERVICE_NAME` | `service_name` | App's name | `MyApp`
|
382
|
+
|============
|
383
|
+
|
384
|
+
The name of your service.
|
385
|
+
This is used to keep all the errors and transactions of your service together and is
|
386
|
+
the primary filter in the Elastic APM user interface.
|
387
|
+
|
388
|
+
If you're using Ruby on Rails this will default to your app's name.
|
389
|
+
If you're using Sinatra it will default to the name of your app's class.
|
390
|
+
|
391
|
+
NOTE: The service name must conform to this regular expression: `^[a-zA-Z0-9 _-]+$`.
|
392
|
+
In layman's terms: Your service name must only contain characters from the ASCII
|
393
|
+
alphabet, numbers, dashes, underscores and spaces.
|
394
|
+
|
395
|
+
[float]
|
396
|
+
[[config-service-version]]
|
397
|
+
==== `service_version`
|
398
|
+
[options="header"]
|
399
|
+
|============
|
400
|
+
| Environment | `Config` key | Default | Example
|
401
|
+
| `ELASTIC_APM_SERVICE_VERSION` | `service_version` | `git` sha | A string indicating the version of the deployed service
|
402
|
+
|============
|
403
|
+
|
404
|
+
Deployed version of your service.
|
405
|
+
Defaults to `git rev-parse --verify HEAD`.
|
406
|
+
|
254
407
|
[float]
|
255
408
|
[[config-source-lines-error-app-frames]]
|
256
409
|
==== `source_lines_error_app_frames`
|
@@ -286,51 +439,33 @@ storage use in your Elasticsearch cluster.
|
|
286
439
|
|
287
440
|
|============
|
288
441
|
| Environment | `Config` key | Default
|
289
|
-
| `ELASTIC_APM_SPAN_FRAMES_MIN_DURATION` | `span_frames_min_duration` | `
|
442
|
+
| `ELASTIC_APM_SPAN_FRAMES_MIN_DURATION` | `span_frames_min_duration` | `"5ms"`
|
290
443
|
|============
|
291
444
|
|
292
|
-
Use this to disable stacktrace collection for spans with a duration shorter
|
293
|
-
|
294
|
-
The default is 5ms.
|
295
|
-
|
296
|
-
Set it to `-1` to disable the feature and collect stack traces for all spans.
|
297
|
-
Setting it to a positive value, e.g. `5`, will limit stack trace collection to spans
|
298
|
-
with durations equal or longer than the given value in milliseconds, e.g. 5 milliseconds.
|
299
|
-
|
300
|
-
To disable stack trace collection for spans completely, set the value to `0`.
|
301
|
-
|
302
|
-
[float]
|
303
|
-
[[config-max-queue-size]]
|
304
|
-
==== `max_queue_size`
|
445
|
+
Use this to disable stacktrace frame collection for spans with a duration shorter
|
446
|
+
than or equal to the given amount of milleseconds.
|
305
447
|
|
306
|
-
|
307
|
-
| Environment | `Config` key | Default
|
308
|
-
| `ELASTIC_APM_MAX_QUEUE_SIZE` | `max_queue_size` | `500`
|
309
|
-
|============
|
448
|
+
The default is `"5ms"`.
|
310
449
|
|
311
|
-
|
312
|
-
|
313
|
-
while a higher value can increase the memory pressure of your app.
|
314
|
-
A higher value also impacts the time until transactions are indexed and searchable
|
315
|
-
in Elasticsearch.
|
450
|
+
Set it to `-1` to collect stack traces for all spans.
|
451
|
+
Set it to `0` to disable stack trace collection for all spans.
|
316
452
|
|
317
|
-
|
318
|
-
of traffic.
|
453
|
+
It has to be provided in *<<config-format-duration, duration format>>*.
|
319
454
|
|
320
455
|
[float]
|
321
|
-
[[config-
|
322
|
-
==== `
|
456
|
+
[[config-transaction-max-spans]]
|
457
|
+
==== `transaction_max_spans`
|
323
458
|
|
324
459
|
|============
|
325
|
-
| Environment
|
326
|
-
| `
|
460
|
+
| Environment | `Config` key | Default
|
461
|
+
| `ELASTIC_APM_TRANSACTION_MAX_SPANS` | `transaction_max_spans` | `500`
|
327
462
|
|============
|
328
463
|
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
464
|
+
Limits the amount of spans that are recorded per transaction.
|
465
|
+
This is helpful in cases where a transaction creates a very high amount of spans
|
466
|
+
(e.g. thousands of SQL queries).
|
467
|
+
Setting an upper limit will prevent overloading the agent and the APM server with
|
468
|
+
too much work for such edge cases.
|
334
469
|
|
335
470
|
[float]
|
336
471
|
[[config-transaction-sample-rate]]
|
@@ -347,21 +482,6 @@ between `0.0` and `1.0`.
|
|
347
482
|
We still record overall time and the result for unsampled transactions, but no
|
348
483
|
context information, tags, or spans.
|
349
484
|
|
350
|
-
[float]
|
351
|
-
[[config-transaction-max-spans]]
|
352
|
-
==== `transaction_max_spans`
|
353
|
-
|
354
|
-
|============
|
355
|
-
| Environment | `Config` key | Default
|
356
|
-
| `ELASTIC_APM_TRANSACTION_MAX_SPANS` | `transaction_max_spans` | `500`
|
357
|
-
|============
|
358
|
-
|
359
|
-
Limits the amount of spans that are recorded per transaction.
|
360
|
-
This is helpful in cases where a transaction creates a very high amount of spans
|
361
|
-
(e.g. thousands of SQL queries).
|
362
|
-
Setting an upper limit will prevent overloading the agent and the APM server with
|
363
|
-
too much work for such edge cases.
|
364
|
-
|
365
485
|
[float]
|
366
486
|
[[config-verify-server-cert]]
|
367
487
|
==== `verify_server_cert`
|
@@ -375,97 +495,42 @@ the APM server.
|
|
375
495
|
Verification can be disabled by changing this setting to `false`.
|
376
496
|
|
377
497
|
[float]
|
378
|
-
[[config-
|
379
|
-
|
498
|
+
[[config-formats]]
|
499
|
+
=== Configuration formats
|
380
500
|
|
381
|
-
|
382
|
-
|
383
|
-
| Environment | `Config` key | Default
|
384
|
-
| `ELASTIC_APM_DISABLED_SPIES` | `disabled_spies` | `['json']`
|
385
|
-
|============
|
386
|
-
|
387
|
-
Elastic APM automatically instruments select third party libraries.
|
388
|
-
Use this option to disable any of these.
|
389
|
-
|
390
|
-
Get an array of enabled spies with `ElasticAPM.agent.config.enabled_spies`.
|
501
|
+
Some options require a unit, either duration or size.
|
502
|
+
These need to be provided in a specific format.
|
391
503
|
|
392
504
|
[float]
|
393
|
-
[[config-
|
394
|
-
====
|
395
|
-
|
396
|
-
[options="header"]
|
397
|
-
|============
|
398
|
-
| Environment | `Config` key | Default | Example
|
399
|
-
| `ELASTIC_APM_INSTRUMENTED_RAKE_TASKS` | `instrumented_rake_tasks` | `[]` | `['my_task']`
|
400
|
-
|============
|
505
|
+
[[config-format-duration]]
|
506
|
+
==== Duration format
|
401
507
|
|
402
|
-
|
403
|
-
|
404
|
-
[float]
|
405
|
-
[[config-default-tags]]
|
406
|
-
==== `default_tags`
|
508
|
+
The _duration_ format is used for options like timeouts.
|
509
|
+
The unit is provided as suffix directly after the number, without any separation by whitespace.
|
407
510
|
|
408
|
-
|
409
|
-
|============
|
410
|
-
| Environment | `Config` key | Default | Example
|
411
|
-
| `ELASTIC_APM_DEFAULT_TAGS` | `default_tags` | `{}` | `region=us1`
|
412
|
-
|============
|
511
|
+
*Example*: `"5ms"`
|
413
512
|
|
414
|
-
|
513
|
+
*Supported units*
|
415
514
|
|
416
|
-
|
515
|
+
* `ms` (milliseconds)
|
516
|
+
* `s` (seconds)
|
517
|
+
* `m` (minutes)
|
417
518
|
|
418
519
|
[float]
|
419
|
-
[[config-
|
420
|
-
====
|
421
|
-
[options="header"]
|
422
|
-
|============
|
423
|
-
| Environment | `Config` key | Default | Example
|
424
|
-
| `ELASTIC_APM_CUSTOM_KEY_FILTERS` | `custom_key_filters` | `[]` | `['MyAuthHeader']`
|
425
|
-
|============
|
520
|
+
[[config-format-size]]
|
521
|
+
==== Size format
|
426
522
|
|
427
|
-
|
428
|
-
|
429
|
-
what looks like confidential information] from the request/response headers.
|
430
|
-
Use this option to add your own custom header keys to the list of filtered keys.
|
523
|
+
The _size_ format is used for options like maximum buffer sizes.
|
524
|
+
The unit is provided as suffix directly after the number, without any separation by whitespace.
|
431
525
|
|
432
|
-
When setting this option via `ENV`, use a comma separated string.
|
433
|
-
Eg. `ELASTIC_APM_CUSTOM_KEY_FILTERS="a,b" # => [/a/, /b/]`
|
434
|
-
|
435
|
-
[float]
|
436
|
-
[[config-custom-ignore-url-patterns]]
|
437
|
-
==== `ignore_url_patterns`
|
438
|
-
[options="header"]
|
439
|
-
|============
|
440
|
-
| Environment | `Config` key | Default | Example
|
441
|
-
| `ELASTIC_APM_IGNORE_URL_PATTERNS` | `ignore_url_patterns` | `[]` | `['^/ping', %r{^/admin}]`
|
442
|
-
|============
|
443
526
|
|
444
|
-
|
527
|
+
*Example*: `10kb`
|
445
528
|
|
446
|
-
|
447
|
-
Errors will still be reported.
|
529
|
+
*Supported units*:
|
448
530
|
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
[[config-filter-exception-types]]
|
454
|
-
==== `filter_exception_types`
|
455
|
-
|============
|
456
|
-
| Environment | `Config` key | Default | Example
|
457
|
-
| N/A | `filter_exception_types` | `[]` | `[MyApp::Errors::IgnoredError]`
|
458
|
-
|============
|
459
|
-
|
460
|
-
Use this to filter error tracking for specific error constants.
|
461
|
-
|
462
|
-
[float]
|
463
|
-
[[config-disable-send]]
|
464
|
-
==== `disable_send`
|
465
|
-
|============
|
466
|
-
| Environment | `Config` key | Default
|
467
|
-
| N/A | `disable_send` | `false`
|
468
|
-
|============
|
469
|
-
|
470
|
-
Disables sending payloads to APM Server.
|
531
|
+
* `b` (bytes)
|
532
|
+
* `kb` (kilobytes)
|
533
|
+
* `mb` (megabytes)
|
534
|
+
* `gb` (gigabytes)
|
471
535
|
|
536
|
+
NOTE: we use the power-of-two sizing convention, e.g. `1 kilobyte == 1024 bytes`
|