elastic-apm 3.15.1 → 4.0.0.beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.ci/.jenkins_ruby.yml +0 -1
- data/.rubocop.yml +0 -7
- data/CHANGELOG.asciidoc +22 -7
- data/Gemfile +3 -1
- data/bench/report.rb +1 -1
- data/docs/configuration.asciidoc +3 -80
- data/lib/elastic_apm/agent.rb +2 -2
- data/lib/elastic_apm/central_config.rb +4 -4
- data/lib/elastic_apm/config/regexp_list.rb +1 -1
- data/lib/elastic_apm/config/wildcard_pattern_list.rb +1 -1
- data/lib/elastic_apm/config.rb +1 -88
- data/lib/elastic_apm/context/response.rb +1 -3
- data/lib/elastic_apm/instrumenter.rb +1 -1
- data/lib/elastic_apm/metrics/cpu_mem_set.rb +1 -1
- data/lib/elastic_apm/normalizers/rails/active_record.rb +2 -2
- data/lib/elastic_apm/normalizers.rb +2 -2
- data/lib/elastic_apm/opentracing.rb +3 -2
- data/lib/elastic_apm/span_helpers.rb +6 -8
- data/lib/elastic_apm/spies/action_dispatch.rb +10 -9
- data/lib/elastic_apm/spies/dynamo_db.rb +9 -7
- data/lib/elastic_apm/spies/elasticsearch.rb +34 -33
- data/lib/elastic_apm/spies/faraday.rb +62 -56
- data/lib/elastic_apm/spies/http.rb +34 -32
- data/lib/elastic_apm/spies/net_http.rb +51 -52
- data/lib/elastic_apm/spies/rake.rb +28 -26
- data/lib/elastic_apm/spies/redis.rb +11 -10
- data/lib/elastic_apm/spies/resque.rb +18 -21
- data/lib/elastic_apm/spies/s3.rb +17 -12
- data/lib/elastic_apm/spies/sequel.rb +42 -48
- data/lib/elastic_apm/spies/sidekiq.rb +13 -15
- data/lib/elastic_apm/spies/sinatra.rb +20 -21
- data/lib/elastic_apm/spies/sns.rb +1 -1
- data/lib/elastic_apm/spies/sqs.rb +18 -22
- data/lib/elastic_apm/spies/tilt.rb +10 -9
- data/lib/elastic_apm/sql/tokenizer.rb +2 -2
- data/lib/elastic_apm/stacktrace_builder.rb +3 -1
- data/lib/elastic_apm/trace_context/traceparent.rb +5 -6
- data/lib/elastic_apm/trace_context.rb +5 -13
- data/lib/elastic_apm/transport/connection/http.rb +1 -1
- data/lib/elastic_apm/transport/connection/proxy_pipe.rb +1 -2
- data/lib/elastic_apm/transport/connection.rb +1 -1
- data/lib/elastic_apm/transport/filters/hash_sanitizer.rb +5 -23
- data/lib/elastic_apm/transport/serializers/metricset_serializer.rb +2 -2
- data/lib/elastic_apm/transport/worker.rb +1 -1
- data/lib/elastic_apm/util/deep_dup.rb +1 -1
- data/lib/elastic_apm/version.rb +1 -1
- data/lib/elastic_apm.rb +1 -1
- metadata +5 -7
- data/lib/elastic_apm/sql.rb +0 -36
- data/lib/elastic_apm/sql_summarizer.rb +0 -53
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d2edbff5770e48799701579f045a0ed3871da1b65037ec0a951ecd106138202c
|
|
4
|
+
data.tar.gz: 750e7a30a2a69e5c36d35373d842eec64e8e89b5bab66ce6d4c25c69564fb38e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6add102bc8f803850243de2c7ef517f0be8ab57b8cc89f0d251034b86d83d5073685b3266123b3813496fd1c57fbc7f9c8855df63c5bcf8c35c807a746800803
|
|
7
|
+
data.tar.gz: fadf416339fa263a2bae03832fa9d46038953f563117c1bfb0623118364bc0bd40d75ca31585cb775d2d69cf708c0848e033c4b7dcae231b2832b6f83da41918
|
data/.ci/.jenkins_ruby.yml
CHANGED
data/.rubocop.yml
CHANGED
|
@@ -132,10 +132,3 @@ Style/StringConcatenation:
|
|
|
132
132
|
|
|
133
133
|
Style/DocumentDynamicEvalDefinition:
|
|
134
134
|
Enabled: false
|
|
135
|
-
|
|
136
|
-
# Applies to > ruby 2.3, enable when 2.3 support is dropped
|
|
137
|
-
Performance/RegexpMatch:
|
|
138
|
-
Enabled: false
|
|
139
|
-
|
|
140
|
-
Style/HashTransformValues:
|
|
141
|
-
Enabled: false
|
data/CHANGELOG.asciidoc
CHANGED
|
@@ -32,17 +32,32 @@ endif::[]
|
|
|
32
32
|
==== Unreleased
|
|
33
33
|
////
|
|
34
34
|
|
|
35
|
-
[[release-notes-
|
|
36
|
-
=== Ruby Agent version
|
|
35
|
+
[[release-notes-4.x]]
|
|
36
|
+
=== Ruby Agent version 4.x
|
|
37
37
|
|
|
38
|
-
[[release-notes-
|
|
39
|
-
====
|
|
38
|
+
[[release-notes-4.0.0]]
|
|
39
|
+
==== 4.0.0.beta.1
|
|
40
40
|
|
|
41
41
|
[float]
|
|
42
|
-
=====
|
|
42
|
+
===== Removed
|
|
43
|
+
|
|
44
|
+
- Removed support for Ruby 2.3 and JRuby 9.1 {pull}901[#901]
|
|
45
|
+
- Config option `active`, see `enabled` {pull}900[#900]
|
|
46
|
+
- Config option `custom_key_filters`, see `sanitize_field_names` {pull}900[#900]
|
|
47
|
+
- Config option `default_tags`, see `global_labels` {pull}900[#900]
|
|
48
|
+
- Config option `default_labels`, see `global_labels` {pull}900[#900]
|
|
49
|
+
- Config option `ignore_url_patterns`, see `transaction_ignore_urls` {pull}900[#900]
|
|
50
|
+
- Config option `use_legacy_sql_parser`, legacy parser no longer included {pull}900[#900]
|
|
43
51
|
|
|
44
|
-
|
|
45
|
-
|
|
52
|
+
[float]
|
|
53
|
+
===== Changed
|
|
54
|
+
|
|
55
|
+
- Integrations (Spies) use Module#prepend over class_eval {pull}890[#890]
|
|
56
|
+
- The secrets filter no longer filters based on values, see `sanitize_field_names` {pull}900[#900]
|
|
57
|
+
- The secrets filter is aligned with other agents, see `sanitize_field_names` {pull}900[#900]
|
|
58
|
+
|
|
59
|
+
[[release-notes-3.x]]
|
|
60
|
+
=== Ruby Agent version 3.x
|
|
46
61
|
|
|
47
62
|
[[release-notes-3.15.0]]
|
|
48
63
|
==== 3.15.0 (2021-03-22)
|
data/Gemfile
CHANGED
|
@@ -26,6 +26,8 @@ gem 'cucumber', require: false
|
|
|
26
26
|
gem 'rack-test'
|
|
27
27
|
gem 'rspec', '~> 3'
|
|
28
28
|
gem 'rspec-its'
|
|
29
|
+
gem 'rubocop', require: false
|
|
30
|
+
gem 'rubocop-performance', require: false
|
|
29
31
|
gem 'timecop'
|
|
30
32
|
gem 'webmock'
|
|
31
33
|
|
|
@@ -91,7 +93,7 @@ frameworks_versions.each do |framework, version|
|
|
|
91
93
|
end
|
|
92
94
|
|
|
93
95
|
if frameworks_versions.key?('rails')
|
|
94
|
-
unless frameworks_versions['rails']
|
|
96
|
+
unless /^(main|6)/.match?(frameworks_versions['rails'])
|
|
95
97
|
gem 'delayed_job', require: nil
|
|
96
98
|
end
|
|
97
99
|
end
|
data/bench/report.rb
CHANGED
|
@@ -18,7 +18,7 @@ end
|
|
|
18
18
|
meta = {
|
|
19
19
|
executed_at: Time.new.iso8601,
|
|
20
20
|
'git.commit' => git_sha,
|
|
21
|
-
'git.date' => String(git_date).strip != '' && Time.parse(git_date).iso8601,
|
|
21
|
+
'git.date' => (String(git_date).strip != '' && Time.parse(git_date).iso8601) || Time.now.iso8601,
|
|
22
22
|
'git.subject' => git_msg,
|
|
23
23
|
hostname: `hostname`.chomp,
|
|
24
24
|
engine: RUBY_ENGINE,
|
data/docs/configuration.asciidoc
CHANGED
|
@@ -176,19 +176,6 @@ APM server in version 7.6.
|
|
|
176
176
|
|
|
177
177
|
WARNING: Api keys only provide any real security if your APM server uses TLS.
|
|
178
178
|
|
|
179
|
-
[float]
|
|
180
|
-
[[config-active]]
|
|
181
|
-
==== `active` deprecated:[3.7.0,See <<config-enabled>> instead.]
|
|
182
|
-
|============
|
|
183
|
-
| Environment | `Config` key | Default
|
|
184
|
-
| `ELASTIC_APM_ACTIVE` | `active` | `true`
|
|
185
|
-
|============
|
|
186
|
-
|
|
187
|
-
Whether or not to start the agent.
|
|
188
|
-
If `active` is `false`, `ElasticAPM.start` will do nothing and all calls to the root API will return `nil`.
|
|
189
|
-
|
|
190
|
-
NOTE: This option is being removed. See <<config-enabled>> instead.
|
|
191
|
-
|
|
192
179
|
[float]
|
|
193
180
|
[[config-api-buffer-size]]
|
|
194
181
|
==== `api_buffer_size`
|
|
@@ -339,57 +326,6 @@ If set to `"none"`, no cloud metadata will be collected.
|
|
|
339
326
|
If set to any of `"aws"`, `"gcp"`, or `"azure"`,
|
|
340
327
|
attempts to collect metadata will only be performed from the chosen provider.
|
|
341
328
|
|
|
342
|
-
[float]
|
|
343
|
-
[[config-custom-key-filters]]
|
|
344
|
-
==== `custom_key_filters` deprecated:[3.5.0,See <<config-sanitize-field-names>> instead.]
|
|
345
|
-
[options="header"]
|
|
346
|
-
|============
|
|
347
|
-
| Environment | `Config` key | Default | Example
|
|
348
|
-
| `ELASTIC_APM_CUSTOM_KEY_FILTERS` | `custom_key_filters` | `[]` | `['MyAuthHeader']`
|
|
349
|
-
|============
|
|
350
|
-
|
|
351
|
-
Elastic APM strips
|
|
352
|
-
https://github.com/elastic/apm-agent-ruby/blob/1.x/lib/elastic_apm/filters/secrets_filter.rb[
|
|
353
|
-
what looks like confidential information] from the request/response headers.
|
|
354
|
-
Use this option to add your own custom header keys to the list of filtered keys.
|
|
355
|
-
|
|
356
|
-
When setting this option via `ENV`, use a comma separated string.
|
|
357
|
-
Eg. `ELASTIC_APM_CUSTOM_KEY_FILTERS="a,b" # => [/a/, /b/]`
|
|
358
|
-
|
|
359
|
-
NOTE: This option is being removed. See <<config-sanitize-field-names>> instead.
|
|
360
|
-
|
|
361
|
-
[float]
|
|
362
|
-
[[config-default-tags]]
|
|
363
|
-
==== `default_tags`
|
|
364
|
-
|
|
365
|
-
[options="header"]
|
|
366
|
-
|============
|
|
367
|
-
| Environment | `Config` key | Default | Example
|
|
368
|
-
| `ELASTIC_APM_DEFAULT_LABELS` | `default_labels` | `{}` | `region=us1`
|
|
369
|
-
|============
|
|
370
|
-
|
|
371
|
-
Add default labels to every transaction. Note that this will eventually be deprecated in favor of `global_labels`.
|
|
372
|
-
|
|
373
|
-
WARNING: Be aware that labels are indexed in Elasticsearch. Using too many unique keys will result in *https://www.elastic.co/blog/found-crash-elasticsearch#mapping-explosion[Mapping explosion]*.
|
|
374
|
-
|
|
375
|
-
NOTE: `global_labels` are supported as of APM server version 7.2. `default_tags` and `default_labels` will eventually be
|
|
376
|
-
deprecated so please transition to using `global_labels` instead. In the meantime, any `default_labels`
|
|
377
|
-
that are set will override `global_labels`.
|
|
378
|
-
|
|
379
|
-
[options="header"]
|
|
380
|
-
|============
|
|
381
|
-
| Environment | `Config` key | Default | Example
|
|
382
|
-
| `ELASTIC_APM_DEFAULT_TAGS` | `default_tags` | `{}` | `region=us1`
|
|
383
|
-
|============
|
|
384
|
-
|
|
385
|
-
Add default tags to add to every transaction. Note that this option has been deprecated in favor of `default_labels`.
|
|
386
|
-
|
|
387
|
-
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]*.
|
|
388
|
-
|
|
389
|
-
NOTE: `global_labels` are supported as of APM server version 7.2. `default_tags` and `default_labels` will eventually be
|
|
390
|
-
deprecated so please transition to using `global_labels` instead. In the meantime, any `default_tags`
|
|
391
|
-
that are set will override `global_labels`.
|
|
392
|
-
|
|
393
329
|
[float]
|
|
394
330
|
[[config-disable_metrics]]
|
|
395
331
|
==== `disable_metrics`
|
|
@@ -520,9 +456,7 @@ otherwise, the default is `nil`.
|
|
|
520
456
|
Labels added to all events, with the format key=value[,key=value[,...]].
|
|
521
457
|
|
|
522
458
|
NOTE: This option requires APM Server 7.2 or greater, and will have no effect when using older
|
|
523
|
-
server versions.
|
|
524
|
-
will override any `global_labels`. Please transition to using `global_labels` instead of
|
|
525
|
-
`default_tags` in light of this deprecation.
|
|
459
|
+
server versions.
|
|
526
460
|
|
|
527
461
|
[float]
|
|
528
462
|
[[config-hostname]]
|
|
@@ -701,8 +635,8 @@ when this option is false.
|
|
|
701
635
|
|
|
702
636
|
[options="header"]
|
|
703
637
|
|============
|
|
704
|
-
| Environment | `Config` key | Default
|
|
705
|
-
| `ELASTIC_APM_SANITIZE_FIELD_NAMES` | `sanitize_field_names` | `
|
|
638
|
+
| Environment | `Config` key | Default | Example
|
|
639
|
+
| `ELASTIC_APM_SANITIZE_FIELD_NAMES` | `sanitize_field_names` | `"password,passwd,pwd,secret,*key,*token*,*session*,*credit*,*card*,authorization,set-cookie"` | `Auth*tion,abc*,*xyz`
|
|
706
640
|
|============
|
|
707
641
|
|
|
708
642
|
Sometimes it is necessary to sanitize the data sent to Elastic APM, e.g. remove sensitive data.
|
|
@@ -872,17 +806,6 @@ We still record overall time and the result for unsampled transactions, but no
|
|
|
872
806
|
context information, tags, or spans.
|
|
873
807
|
Note that the sample rate will be rounded to 4 digits of precision.
|
|
874
808
|
|
|
875
|
-
[float]
|
|
876
|
-
[[config-use-experimental-sql-parser]]
|
|
877
|
-
==== `use_legacy_sql_parser`
|
|
878
|
-
|============
|
|
879
|
-
| Environment | `Config` key | Default
|
|
880
|
-
| `ELASTIC_APM_USE_LEGACY_SQL_PARSER` | `use_legacy_sql_parser` | `false`
|
|
881
|
-
|============
|
|
882
|
-
|
|
883
|
-
Use the older, less precise approach to generating summaries of your app's SQL statements.
|
|
884
|
-
Try this if you're experiencing trouble using the new default.
|
|
885
|
-
|
|
886
809
|
[float]
|
|
887
810
|
[[config-verify-server-cert]]
|
|
888
811
|
==== `verify_server_cert`
|
data/lib/elastic_apm/agent.rb
CHANGED
|
@@ -127,7 +127,7 @@ module ElasticAPM
|
|
|
127
127
|
end
|
|
128
128
|
|
|
129
129
|
def stop
|
|
130
|
-
|
|
130
|
+
info 'Stopping agent'
|
|
131
131
|
|
|
132
132
|
central_config.stop
|
|
133
133
|
metrics.stop
|
|
@@ -276,7 +276,7 @@ module ElasticAPM
|
|
|
276
276
|
def detect_forking!
|
|
277
277
|
return if @pid == Process.pid
|
|
278
278
|
|
|
279
|
-
config.logger.debug "
|
|
279
|
+
config.logger.debug "Forked process detected,
|
|
280
280
|
restarting threads in process [PID:#{Process.pid}]"
|
|
281
281
|
|
|
282
282
|
central_config.handle_forking!
|
|
@@ -66,9 +66,9 @@ module ElasticAPM
|
|
|
66
66
|
def fetch_and_apply_config
|
|
67
67
|
@promise =
|
|
68
68
|
Concurrent::Promise
|
|
69
|
-
.execute
|
|
70
|
-
.on_success(
|
|
71
|
-
.rescue(
|
|
69
|
+
.execute { fetch_config }
|
|
70
|
+
.on_success { |resp| handle_success(resp) }
|
|
71
|
+
.rescue { |err| handle_error(err) }
|
|
72
72
|
end
|
|
73
73
|
|
|
74
74
|
def fetch_config
|
|
@@ -182,7 +182,7 @@ module ElasticAPM
|
|
|
182
182
|
|
|
183
183
|
@scheduled_task =
|
|
184
184
|
Concurrent::ScheduledTask
|
|
185
|
-
.execute(seconds
|
|
185
|
+
.execute(seconds) { fetch_and_apply_config }
|
|
186
186
|
end
|
|
187
187
|
end
|
|
188
188
|
end
|
data/lib/elastic_apm/config.rb
CHANGED
|
@@ -30,14 +30,8 @@ module ElasticAPM
|
|
|
30
30
|
class Config
|
|
31
31
|
extend Options
|
|
32
32
|
|
|
33
|
-
DEPRECATED_OPTIONS = %i[].freeze
|
|
34
|
-
|
|
35
|
-
# DEPRECATED: To align with other agents, change on next major bump to:
|
|
36
|
-
# "password, passwd, pwd, secret, *key, *token*, *session*, *credit*,
|
|
37
|
-
# *card*, authorization, set-cookie"
|
|
38
33
|
SANITIZE_FIELD_NAMES_DEFAULT =
|
|
39
|
-
%w[
|
|
40
|
-
*credit* *card* *authorization* *set-cookie*].freeze
|
|
34
|
+
%w[password passwd pwd secret *key *token* *session* *credit* *card* authorization set-cookie].freeze
|
|
41
35
|
|
|
42
36
|
# rubocop:disable Layout/LineLength, Layout/ExtraSpacing
|
|
43
37
|
option :config_file, type: :string, default: 'config/elastic_apm.yml'
|
|
@@ -101,7 +95,6 @@ module ElasticAPM
|
|
|
101
95
|
option :transaction_max_spans, type: :int, default: 500
|
|
102
96
|
option :transaction_sample_rate, type: :float, default: 1.0, converter: RoundFloat.new
|
|
103
97
|
option :use_elastic_traceparent_header, type: :bool, default: true
|
|
104
|
-
option :use_legacy_sql_parser, type: :bool, default: false
|
|
105
98
|
option :verify_server_cert, type: :bool, default: true
|
|
106
99
|
|
|
107
100
|
# rubocop:enable Layout/LineLength, Layout/ExtraSpacing
|
|
@@ -168,11 +161,6 @@ module ElasticAPM
|
|
|
168
161
|
available_instrumentations - disable_instrumentations
|
|
169
162
|
end
|
|
170
163
|
|
|
171
|
-
def method_missing(name, *args)
|
|
172
|
-
return super unless DEPRECATED_OPTIONS.include?(name)
|
|
173
|
-
warn "The option `#{name}' has been removed."
|
|
174
|
-
end
|
|
175
|
-
|
|
176
164
|
def replace_options(new_options)
|
|
177
165
|
return if new_options.nil? || new_options.empty?
|
|
178
166
|
options_copy = @options.dup
|
|
@@ -201,15 +189,6 @@ module ElasticAPM
|
|
|
201
189
|
metrics_interval > 0
|
|
202
190
|
end
|
|
203
191
|
|
|
204
|
-
# DEPRECATED: Remove this in next major version
|
|
205
|
-
def sanitize_field_names=(value)
|
|
206
|
-
list = WildcardPatternList.new.call(value)
|
|
207
|
-
defaults = WildcardPatternList.new.call(SANITIZE_FIELD_NAMES_DEFAULT)
|
|
208
|
-
# use regex pattern for comparisons
|
|
209
|
-
get(:sanitize_field_names).value =
|
|
210
|
-
defaults.concat(list).uniq(&:pattern)
|
|
211
|
-
end
|
|
212
|
-
|
|
213
192
|
def span_frames_min_duration?
|
|
214
193
|
span_frames_min_duration != 0
|
|
215
194
|
end
|
|
@@ -248,72 +227,6 @@ module ElasticAPM
|
|
|
248
227
|
super.split.first + '>'
|
|
249
228
|
end
|
|
250
229
|
|
|
251
|
-
# Deprecations
|
|
252
|
-
|
|
253
|
-
def default_tags=(value)
|
|
254
|
-
warn '[DEPRECATED] The option default_tags has been renamed to ' \
|
|
255
|
-
'default_labels.'
|
|
256
|
-
self.default_labels = value
|
|
257
|
-
end
|
|
258
|
-
|
|
259
|
-
def ignore_url_patterns=(value)
|
|
260
|
-
unless value == self.class.schema[:ignore_url_patterns][:default]
|
|
261
|
-
warn '[DEPRECATED] The option ignore_url_patterns is being removed. ' \
|
|
262
|
-
'Consider using transaction_ignore_urls instead.'
|
|
263
|
-
end
|
|
264
|
-
|
|
265
|
-
set(:ignore_url_patterns, value)
|
|
266
|
-
end
|
|
267
|
-
|
|
268
|
-
def custom_key_filters=(value)
|
|
269
|
-
unless value == self.class.schema[:custom_key_filters][:default]
|
|
270
|
-
warn '[DEPRECATED] The option custom_key_filters is being removed. ' \
|
|
271
|
-
'See sanitize_field_names for an alternative.'
|
|
272
|
-
end
|
|
273
|
-
|
|
274
|
-
set(:custom_key_filters, value)
|
|
275
|
-
end
|
|
276
|
-
|
|
277
|
-
def disabled_instrumentations
|
|
278
|
-
disable_instrumentations
|
|
279
|
-
end
|
|
280
|
-
|
|
281
|
-
def active
|
|
282
|
-
enabled
|
|
283
|
-
end
|
|
284
|
-
alias active? active
|
|
285
|
-
|
|
286
|
-
def server_ca_cert
|
|
287
|
-
server_ca_cert_file
|
|
288
|
-
end
|
|
289
|
-
|
|
290
|
-
def disabled_instrumentations=(value)
|
|
291
|
-
warn '[DEPRECATED] The option disabled_instrumentations has been ' \
|
|
292
|
-
'renamed to disable_instrumentations to align with other agents.'
|
|
293
|
-
self.disable_instrumentations = value
|
|
294
|
-
end
|
|
295
|
-
|
|
296
|
-
def use_experimental_sql_parser=(_value)
|
|
297
|
-
warn '[DEPRECATED] The new SQL parser is now the default. To use the ' \
|
|
298
|
-
'old one, use use_legacy_sql_parser and please report why you ' \
|
|
299
|
-
'wish to do so.'
|
|
300
|
-
end
|
|
301
|
-
|
|
302
|
-
def active=(value)
|
|
303
|
-
warn '[DEPRECATED] The option active has been renamed to enabled ' \
|
|
304
|
-
'to align with other agents and with the remote config.'
|
|
305
|
-
self.enabled = value
|
|
306
|
-
end
|
|
307
|
-
|
|
308
|
-
def server_ca_cert=(value)
|
|
309
|
-
unless value == self.class.schema[:server_ca_cert_file][:default]
|
|
310
|
-
warn '[DEPRECATED] The option server_ca_cert has been ' \
|
|
311
|
-
'renamed to server_ca_cert_file to align with other agents.'
|
|
312
|
-
end
|
|
313
|
-
|
|
314
|
-
self.server_ca_cert_file = value
|
|
315
|
-
end
|
|
316
|
-
|
|
317
230
|
private
|
|
318
231
|
|
|
319
232
|
def load_config_file
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
# frozen_string_literal: true
|
|
19
19
|
|
|
20
|
-
require 'elastic_apm/sql'
|
|
20
|
+
require 'elastic_apm/sql/signature'
|
|
21
21
|
|
|
22
22
|
module ElasticAPM
|
|
23
23
|
module Normalizers
|
|
@@ -34,7 +34,7 @@ module ElasticAPM
|
|
|
34
34
|
def initialize(*args)
|
|
35
35
|
super
|
|
36
36
|
|
|
37
|
-
@summarizer = Sql.
|
|
37
|
+
@summarizer = Sql::Signature::Summarizer.new
|
|
38
38
|
|
|
39
39
|
@adapters = {}
|
|
40
40
|
end
|
|
@@ -39,8 +39,8 @@ module ElasticAPM # :nodoc:
|
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
def self.build(config)
|
|
42
|
-
normalizers = @registered.
|
|
43
|
-
|
|
42
|
+
normalizers = @registered.transform_values do |klass|
|
|
43
|
+
klass.new(config)
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
Collection.new(normalizers)
|
|
@@ -129,8 +129,9 @@ module ElasticAPM
|
|
|
129
129
|
def self.from_header(header)
|
|
130
130
|
return unless header
|
|
131
131
|
|
|
132
|
-
trace_context =
|
|
133
|
-
|
|
132
|
+
trace_context = TraceContext.new(
|
|
133
|
+
traceparent: TraceContext::Traceparent.parse(header)
|
|
134
|
+
)
|
|
134
135
|
|
|
135
136
|
trace_context.traceparent.id = trace_context.parent_id
|
|
136
137
|
trace_context.traceparent.parent_id = nil
|
|
@@ -36,19 +36,17 @@ module ElasticAPM
|
|
|
36
36
|
name ||= method.to_s
|
|
37
37
|
type ||= Span::DEFAULT_TYPE
|
|
38
38
|
|
|
39
|
-
klass.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
def #{method}(*args, &block)
|
|
39
|
+
klass.prepend(Module.new do
|
|
40
|
+
define_method(method) do |*args|
|
|
43
41
|
unless ElasticAPM.current_transaction
|
|
44
|
-
return
|
|
42
|
+
return super(*args)
|
|
45
43
|
end
|
|
46
44
|
|
|
47
|
-
ElasticAPM.with_span
|
|
48
|
-
|
|
45
|
+
ElasticAPM.with_span name.to_s, type.to_s do
|
|
46
|
+
super(*args)
|
|
49
47
|
end
|
|
50
48
|
end
|
|
51
|
-
|
|
49
|
+
end)
|
|
52
50
|
end
|
|
53
51
|
end
|
|
54
52
|
|
|
@@ -22,18 +22,19 @@ module ElasticAPM
|
|
|
22
22
|
module Spies
|
|
23
23
|
# @api private
|
|
24
24
|
class ActionDispatchSpy
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
context = ElasticAPM.build_context(rack_env: env, for_type: :error)
|
|
31
|
-
ElasticAPM.report(exception, context: context, handled: false)
|
|
25
|
+
# @api private
|
|
26
|
+
module Ext
|
|
27
|
+
def render_exception(env, exception)
|
|
28
|
+
context = ElasticAPM.build_context(rack_env: env, for_type: :error)
|
|
29
|
+
ElasticAPM.report(exception, context: context, handled: false)
|
|
32
30
|
|
|
33
|
-
|
|
34
|
-
end
|
|
31
|
+
super(env, exception)
|
|
35
32
|
end
|
|
36
33
|
end
|
|
34
|
+
|
|
35
|
+
def install
|
|
36
|
+
::ActionDispatch::ShowExceptions.prepend(Ext)
|
|
37
|
+
end
|
|
37
38
|
end
|
|
38
39
|
|
|
39
40
|
register(
|
|
@@ -49,12 +49,11 @@ module ElasticAPM
|
|
|
49
49
|
end
|
|
50
50
|
end
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
# @api private
|
|
53
|
+
module Ext
|
|
54
|
+
def self.prepended(mod)
|
|
54
55
|
# Alias all available operations
|
|
55
|
-
api.operation_names.each do |operation_name|
|
|
56
|
-
alias :"#{operation_name}_without_apm" :"#{operation_name}"
|
|
57
|
-
|
|
56
|
+
mod.api.operation_names.each do |operation_name|
|
|
58
57
|
define_method(operation_name) do |params = {}, options = {}|
|
|
59
58
|
cloud = ElasticAPM::Span::Context::Destination::Cloud.new(region: config.region)
|
|
60
59
|
|
|
@@ -79,14 +78,17 @@ module ElasticAPM
|
|
|
79
78
|
context: context
|
|
80
79
|
) do
|
|
81
80
|
ElasticAPM::Spies::DynamoDBSpy.without_net_http do
|
|
82
|
-
|
|
83
|
-
original_method.call(params, options)
|
|
81
|
+
super(params, options)
|
|
84
82
|
end
|
|
85
83
|
end
|
|
86
84
|
end
|
|
87
85
|
end
|
|
88
86
|
end
|
|
89
87
|
end
|
|
88
|
+
|
|
89
|
+
def install
|
|
90
|
+
::Aws::DynamoDB::Client.prepend(Ext)
|
|
91
|
+
end
|
|
90
92
|
end
|
|
91
93
|
|
|
92
94
|
register(
|
|
@@ -37,47 +37,48 @@ module ElasticAPM
|
|
|
37
37
|
end
|
|
38
38
|
end
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
return perform_request_without_apm(method, path, *args, &block)
|
|
47
|
-
end
|
|
40
|
+
# @api private
|
|
41
|
+
module Ext
|
|
42
|
+
def perform_request(method, path, *args, &block)
|
|
43
|
+
unless ElasticAPM.current_transaction
|
|
44
|
+
return super(method, path, *args, &block)
|
|
45
|
+
end
|
|
48
46
|
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
name = format(NAME_FORMAT, method, path)
|
|
48
|
+
statement = []
|
|
51
49
|
|
|
52
|
-
|
|
50
|
+
statement << { params: args&.[](0) }
|
|
53
51
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
end
|
|
52
|
+
if ElasticAPM.agent.config.capture_elasticsearch_queries
|
|
53
|
+
unless args[1].nil? || args[1].empty?
|
|
54
|
+
body =
|
|
55
|
+
ElasticAPM::Spies::ElasticsearchSpy
|
|
56
|
+
.sanitizer.strip_from(args[1])
|
|
57
|
+
statement << { body: body }
|
|
61
58
|
end
|
|
59
|
+
end
|
|
62
60
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
61
|
+
context = Span::Context.new(
|
|
62
|
+
db: { statement: statement.reduce({}, :merge).to_json },
|
|
63
|
+
destination: {
|
|
64
|
+
name: SUBTYPE,
|
|
65
|
+
resource: SUBTYPE,
|
|
66
|
+
type: TYPE
|
|
67
|
+
}
|
|
68
|
+
)
|
|
71
69
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
end
|
|
70
|
+
ElasticAPM.with_span(
|
|
71
|
+
name,
|
|
72
|
+
TYPE,
|
|
73
|
+
subtype: SUBTYPE,
|
|
74
|
+
context: context
|
|
75
|
+
) { super(method, path, *args, &block) }
|
|
79
76
|
end
|
|
80
77
|
end
|
|
78
|
+
|
|
79
|
+
def install
|
|
80
|
+
::Elasticsearch::Transport::Client.prepend(Ext)
|
|
81
|
+
end
|
|
81
82
|
end
|
|
82
83
|
|
|
83
84
|
register(
|