elastic-apm 3.11.0 → 3.14.0
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_codecov.yml +1 -1
- data/.ci/.jenkins_exclude.yml +46 -61
- data/.ci/.jenkins_framework.yml +3 -4
- data/.ci/.jenkins_master_framework.yml +1 -1
- data/.ci/.jenkins_ruby.yml +1 -3
- data/.ci/Jenkinsfile +22 -2
- data/.ci/docker/jruby/11-jdk/Dockerfile +2 -1
- data/.ci/docker/jruby/12-jdk/Dockerfile +2 -1
- data/.ci/docker/jruby/13-jdk/Dockerfile +2 -1
- data/.ci/docker/jruby/7-jdk/Dockerfile +2 -1
- data/.ci/docker/jruby/8-jdk/Dockerfile +2 -1
- data/.github/labeler-config.yml +3 -0
- data/.github/workflows/addToProject.yml +29 -0
- data/.github/workflows/labeler.yml +16 -0
- data/.rubocop.yml +33 -4
- data/CHANGELOG.asciidoc +58 -0
- data/Gemfile +23 -9
- data/Rakefile +10 -10
- data/docs/api.asciidoc +2 -1
- data/docs/configuration.asciidoc +20 -3
- data/docs/supported-technologies.asciidoc +2 -0
- data/lib/elastic_apm.rb +14 -2
- data/lib/elastic_apm/central_config.rb +7 -2
- data/lib/elastic_apm/config.rb +35 -18
- data/lib/elastic_apm/config/log_level_map.rb +47 -0
- data/lib/elastic_apm/context.rb +2 -8
- data/lib/elastic_apm/graphql.rb +2 -0
- data/lib/elastic_apm/grpc.rb +3 -3
- data/lib/elastic_apm/instrumenter.rb +1 -1
- data/lib/elastic_apm/metadata/cloud_info.rb +6 -4
- data/lib/elastic_apm/metadata/service_info.rb +2 -2
- data/lib/elastic_apm/metadata/system_info/container_info.rb +16 -5
- data/lib/elastic_apm/metrics.rb +1 -0
- data/lib/elastic_apm/metrics/cpu_mem_set.rb +1 -0
- data/lib/elastic_apm/middleware.rb +8 -3
- data/lib/elastic_apm/normalizers/rails/active_record.rb +16 -4
- data/lib/elastic_apm/opentracing.rb +2 -1
- data/lib/elastic_apm/span.rb +13 -2
- data/lib/elastic_apm/span/context/db.rb +1 -1
- data/lib/elastic_apm/span/context/http.rb +2 -0
- data/lib/elastic_apm/spies/delayed_job.rb +11 -3
- data/lib/elastic_apm/spies/dynamo_db.rb +8 -1
- data/lib/elastic_apm/spies/elasticsearch.rb +4 -2
- data/lib/elastic_apm/spies/faraday.rb +19 -11
- data/lib/elastic_apm/spies/http.rb +1 -0
- data/lib/elastic_apm/spies/mongo.rb +10 -2
- data/lib/elastic_apm/spies/net_http.rb +4 -1
- data/lib/elastic_apm/spies/rake.rb +4 -2
- data/lib/elastic_apm/spies/resque.rb +4 -2
- data/lib/elastic_apm/spies/sequel.rb +12 -1
- data/lib/elastic_apm/spies/shoryuken.rb +2 -0
- data/lib/elastic_apm/spies/sidekiq.rb +2 -0
- data/lib/elastic_apm/spies/sneakers.rb +2 -0
- data/lib/elastic_apm/spies/sucker_punch.rb +2 -0
- data/lib/elastic_apm/sql/signature.rb +4 -2
- data/lib/elastic_apm/sql/tokenizer.rb +2 -2
- data/lib/elastic_apm/stacktrace/frame.rb +1 -0
- data/lib/elastic_apm/stacktrace_builder.rb +2 -4
- data/lib/elastic_apm/trace_context.rb +0 -2
- data/lib/elastic_apm/trace_context/traceparent.rb +0 -2
- data/lib/elastic_apm/trace_context/tracestate.rb +7 -5
- data/lib/elastic_apm/transaction.rb +17 -4
- data/lib/elastic_apm/transport/connection.rb +1 -1
- data/lib/elastic_apm/transport/filters/hash_sanitizer.rb +8 -1
- data/lib/elastic_apm/transport/filters/secrets_filter.rb +32 -10
- data/lib/elastic_apm/transport/serializers.rb +1 -0
- data/lib/elastic_apm/transport/serializers/metadata_serializer.rb +23 -8
- data/lib/elastic_apm/transport/serializers/span_serializer.rb +2 -3
- data/lib/elastic_apm/transport/serializers/transaction_serializer.rb +1 -0
- data/lib/elastic_apm/util/deep_dup.rb +65 -0
- data/lib/elastic_apm/util/precision_validator.rb +1 -1
- data/lib/elastic_apm/version.rb +1 -1
- metadata +7 -2
data/CHANGELOG.asciidoc
CHANGED
@@ -35,6 +35,64 @@ endif::[]
|
|
35
35
|
[[release-notes-3.x]]
|
36
36
|
=== Ruby Agent version 3.x
|
37
37
|
|
38
|
+
[[release-notes-3.14.0]]
|
39
|
+
==== 3.14.0 (2021-03-17)
|
40
|
+
|
41
|
+
[float]
|
42
|
+
===== Added
|
43
|
+
- Expanded support for extracting ActiveRecord adapter name from notification payload when using ActiveRecord versions before 6.0 {pull}953[#953]
|
44
|
+
|
45
|
+
[float]
|
46
|
+
===== Fixed
|
47
|
+
|
48
|
+
- Fixed setting outcome in Mongo spy when not traced {pull}937[#937]
|
49
|
+
- Fixed missing container metadata in payloads {pull}942[#942]
|
50
|
+
- Fixed outgoing HTTP request spans with no Host {pull}962[#962]
|
51
|
+
|
52
|
+
[[release-notes-3.13.0]]
|
53
|
+
==== 3.13.0 (2020-12-22)
|
54
|
+
|
55
|
+
[float]
|
56
|
+
===== Fixed
|
57
|
+
|
58
|
+
- Handle invalid utf-8 byte sequences in sql summarizer and DB statement {pull}896[#896]
|
59
|
+
- Expand Kubernetes metadata discovery {pull}916[#916]
|
60
|
+
- Fix fetching cloud info on Http.rb 3.x versions {pull}919[#919]
|
61
|
+
|
62
|
+
[float]
|
63
|
+
===== Added
|
64
|
+
|
65
|
+
- Support both integer and string log levels, and extra central config values {pull}902[#902]
|
66
|
+
|
67
|
+
[float]
|
68
|
+
===== Changed
|
69
|
+
|
70
|
+
- Rename server_ca_cert to server_ca_cert_file {pull}908[#908]
|
71
|
+
|
72
|
+
[[release-notes-3.12.1]]
|
73
|
+
==== 3.12.1 (2020-11-16)
|
74
|
+
|
75
|
+
[float]
|
76
|
+
===== Fixed
|
77
|
+
|
78
|
+
- `capture_elasticsearch_queries` no longer modifies the original query {pull}894[#894]
|
79
|
+
|
80
|
+
[[release-notes-3.12.0]]
|
81
|
+
==== 3.12.0 (2020-11-10)
|
82
|
+
|
83
|
+
[float]
|
84
|
+
===== Added
|
85
|
+
|
86
|
+
- Add outcome to transactions and spans {pull}883[#883]
|
87
|
+
|
88
|
+
[[release-notes-3.11.1]]
|
89
|
+
==== 3.11.1 (2020-11-05)
|
90
|
+
|
91
|
+
[float]
|
92
|
+
===== Fixed
|
93
|
+
|
94
|
+
- Fix reporting from Kubernetes based deploys to APM Server 7.9.x {pull}885[#885]
|
95
|
+
|
38
96
|
[[release-notes-3.11.0]]
|
39
97
|
==== 3.11.0 (2020-10-27)
|
40
98
|
|
data/Gemfile
CHANGED
@@ -22,9 +22,7 @@ source 'https://rubygems.org'
|
|
22
22
|
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
23
23
|
|
24
24
|
# Tools
|
25
|
-
gem 'bootsnap', require: false
|
26
25
|
gem 'cucumber', require: false
|
27
|
-
gem 'pry'
|
28
26
|
gem 'rack-test'
|
29
27
|
gem 'rspec', '~> 3'
|
30
28
|
gem 'rspec-its'
|
@@ -38,8 +36,10 @@ gem 'elasticsearch', require: nil
|
|
38
36
|
gem 'fakeredis', require: nil
|
39
37
|
gem 'faraday', require: nil
|
40
38
|
gem 'graphql', require: nil
|
41
|
-
|
42
|
-
gem '
|
39
|
+
if !defined?(JRUBY_VERSION) && RUBY_VERSION < '2.5'
|
40
|
+
gem 'google-protobuf', '< 3.12'
|
41
|
+
end
|
42
|
+
gem 'grpc' if !defined?(JRUBY_VERSION) && RUBY_VERSION < '3.0'
|
43
43
|
gem 'json'
|
44
44
|
gem 'json-schema', require: nil
|
45
45
|
gem 'mongo', require: nil
|
@@ -56,6 +56,10 @@ gem 'sucker_punch', '~> 2.0', require: nil
|
|
56
56
|
gem 'yard', require: nil
|
57
57
|
gem 'yarjuf'
|
58
58
|
|
59
|
+
# See issue #6547 in the JRuby repo. When that bug is fixed,
|
60
|
+
# we can use the latest version of the i18n gem.
|
61
|
+
gem 'i18n', '< 1.8.8'
|
62
|
+
|
59
63
|
## Install Framework
|
60
64
|
GITHUB_REPOS = {
|
61
65
|
'grape' => 'ruby-grape/grape',
|
@@ -73,8 +77,10 @@ end
|
|
73
77
|
|
74
78
|
frameworks_versions.each do |framework, version|
|
75
79
|
case version
|
76
|
-
when 'master'
|
80
|
+
when 'master' # sinatra, grape
|
77
81
|
gem framework, github: GITHUB_REPOS.fetch(framework)
|
82
|
+
when 'main' # rails
|
83
|
+
gem framework, github: GITHUB_REPOS.fetch(framework), branch: 'main'
|
78
84
|
when /.+/
|
79
85
|
gem framework, "~> #{version}.0"
|
80
86
|
else
|
@@ -83,18 +89,26 @@ frameworks_versions.each do |framework, version|
|
|
83
89
|
end
|
84
90
|
|
85
91
|
if frameworks_versions.key?('rails')
|
86
|
-
unless frameworks_versions['rails'] =~ /^(
|
92
|
+
unless frameworks_versions['rails'] =~ /^(main|6)/
|
87
93
|
gem 'delayed_job', require: nil
|
88
94
|
end
|
89
95
|
end
|
90
96
|
|
91
97
|
if RUBY_PLATFORM == 'java'
|
92
|
-
|
93
|
-
|
98
|
+
case rails = frameworks_versions['rails']
|
99
|
+
when 'main'
|
100
|
+
gem 'activerecord-jdbcsqlite3-adapter', git: 'https://github.com/jruby/activerecord-jdbc-adapter', glob: 'activerecord-jdbcsqlite3-adapter/*.gemspec'
|
101
|
+
when ''
|
102
|
+
gem 'activerecord-jdbcsqlite3-adapter', "~> 61.0"
|
103
|
+
when nil
|
104
|
+
gem 'jdbc-sqlite3'
|
105
|
+
else
|
106
|
+
gem 'activerecord-jdbcsqlite3-adapter', "~> #{rails.tr('.', '')}.0"
|
107
|
+
end
|
94
108
|
elsif frameworks_versions['rails'] =~ /^(4|5)/
|
95
109
|
gem 'sqlite3', '~> 1.3.6'
|
96
110
|
else
|
97
|
-
gem 'sqlite3'
|
111
|
+
gem 'sqlite3'
|
98
112
|
end
|
99
113
|
|
100
114
|
group :bench do
|
data/Rakefile
CHANGED
@@ -19,9 +19,9 @@
|
|
19
19
|
|
20
20
|
require 'bundler/gem_tasks'
|
21
21
|
|
22
|
-
desc
|
23
|
-
Update `3.x` branch to be at released commit and push it to GitHub.
|
24
|
-
|
22
|
+
desc 'Post release action:'\
|
23
|
+
'Update `3.x` branch to be at released commit and push it to GitHub.'
|
24
|
+
|
25
25
|
namespace :release do
|
26
26
|
task :update_branch do
|
27
27
|
`git checkout 3.x &&
|
@@ -41,11 +41,11 @@ task docs: :yard
|
|
41
41
|
task default: :spec
|
42
42
|
|
43
43
|
namespace :coverage do
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
end
|
44
|
+
desc "Collates all result sets generated by the different test runners"
|
45
|
+
task :report do
|
46
|
+
require 'simplecov'
|
47
|
+
require 'simplecov-cobertura'
|
48
|
+
SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter
|
49
|
+
SimpleCov.collate Dir["coverage/matrix_results/**/.resultset.json"]
|
51
50
|
end
|
51
|
+
end
|
data/docs/api.asciidoc
CHANGED
@@ -433,6 +433,7 @@ end
|
|
433
433
|
- `name`: String
|
434
434
|
- `type`: String
|
435
435
|
- `result`: String
|
436
|
+
- `outcome`: String ('unknown', 'success', 'failure', nil)
|
436
437
|
- `trace_id`: String (readonly)
|
437
438
|
|
438
439
|
[float]
|
@@ -457,7 +458,7 @@ If your service generates the HTML page dynamically, initializing the
|
|
457
458
|
JavaScript RUM agent with the value of this method allows analyzing the time
|
458
459
|
spent in the browser vs in the backend services.
|
459
460
|
|
460
|
-
To enable the JavaScript RUM agent,
|
461
|
+
To enable the JavaScript RUM agent, initialize the RUM agent with the Ruby
|
461
462
|
agent's current transaction:
|
462
463
|
|
463
464
|
[source,html]
|
data/docs/configuration.asciidoc
CHANGED
@@ -322,6 +322,23 @@ Usually APM Server determines how often to poll, but if not the default interval
|
|
322
322
|
|
323
323
|
NOTE: This feature requires APM Server v7.3 or later and that the APM Server is configured with `kibana.enabled: true`.
|
324
324
|
|
325
|
+
[float]
|
326
|
+
[[config-cloud-provider]]
|
327
|
+
==== `cloud_provider`
|
328
|
+
|============
|
329
|
+
| Environment | `Config` key | Default
|
330
|
+
| `ELASTIC_APM_CLOUD_PROVIDER` | `cloud_provider` | `"auto"`
|
331
|
+
|============
|
332
|
+
|
333
|
+
Specify the cloud provider for metadata collection.
|
334
|
+
Defaults to `"auto"`, which means the agent uses trial and
|
335
|
+
error to collect metadata from all supported cloud providers.
|
336
|
+
|
337
|
+
Valid options are `"auto"`, `"aws"`, `"gcp"`, `"azure"`, and `"none"`.
|
338
|
+
If set to `"none"`, no cloud metadata will be collected.
|
339
|
+
If set to any of `"aws"`, `"gcp"`, or `"azure"`,
|
340
|
+
attempts to collect metadata will only be performed from the chosen provider.
|
341
|
+
|
325
342
|
[float]
|
326
343
|
[[config-custom-key-filters]]
|
327
344
|
==== `custom_key_filters` deprecated:[3.5.0,See <<config-sanitize-field-names>> instead.]
|
@@ -798,12 +815,12 @@ It has to be provided in *<<config-format-duration, duration format>>*.
|
|
798
815
|
|
799
816
|
[float]
|
800
817
|
[[config-ssl-ca-cert]]
|
801
|
-
==== `
|
818
|
+
==== `server_ca_cert_file`
|
802
819
|
|
803
820
|
[options="header"]
|
804
821
|
|============
|
805
|
-
| Environment
|
806
|
-
| `
|
822
|
+
| Environment | `Config` key | Default | Example
|
823
|
+
| `ELASTIC_APM_SERVER_CA_CERT_FILE` | `server_ca_cert_file` | `nil` | `'/path/to/ca.pem'`
|
807
824
|
|============
|
808
825
|
|
809
826
|
The path to a custom CA certificate for connecting to APM Server.
|
@@ -77,6 +77,8 @@ requests using these libraries:
|
|
77
77
|
- Http.rb (v0.6+)
|
78
78
|
- Faraday (v0.2.1+)
|
79
79
|
|
80
|
+
*Note:* These libraries usually assume `localhost` if no `Host` is specified, so the agent does as well.
|
81
|
+
|
80
82
|
[float]
|
81
83
|
[[supported-technologies-backgroud-processing]]
|
82
84
|
=== Background Processing
|
data/lib/elastic_apm.rb
CHANGED
@@ -106,6 +106,7 @@ module ElasticAPM
|
|
106
106
|
# @yield [String|nil, String|nil, String|nil] The transaction, span,
|
107
107
|
# and trace ids.
|
108
108
|
# @return [String] Unless block given
|
109
|
+
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
109
110
|
def log_ids
|
110
111
|
trace_id = (current_transaction || current_span)&.trace_id
|
111
112
|
if block_given?
|
@@ -118,6 +119,7 @@ module ElasticAPM
|
|
118
119
|
ids << "trace.id=#{trace_id}" if trace_id
|
119
120
|
ids.join(' ')
|
120
121
|
end
|
122
|
+
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
121
123
|
|
122
124
|
# Start a new transaction
|
123
125
|
#
|
@@ -183,7 +185,12 @@ module ElasticAPM
|
|
183
185
|
context: context,
|
184
186
|
trace_context: trace_context
|
185
187
|
)
|
186
|
-
yield transaction
|
188
|
+
result = yield transaction
|
189
|
+
transaction&.outcome ||= Transaction::Outcome::SUCCESS
|
190
|
+
result
|
191
|
+
rescue
|
192
|
+
transaction&.outcome ||= Transaction::Outcome::FAILURE
|
193
|
+
raise
|
187
194
|
ensure
|
188
195
|
end_transaction
|
189
196
|
end
|
@@ -287,7 +294,12 @@ module ElasticAPM
|
|
287
294
|
parent: parent,
|
288
295
|
sync: sync
|
289
296
|
)
|
290
|
-
yield span
|
297
|
+
result = yield span
|
298
|
+
span&.outcome ||= Span::Outcome::SUCCESS
|
299
|
+
result
|
300
|
+
rescue
|
301
|
+
span&.outcome ||= Span::Outcome::FAILURE
|
302
|
+
raise
|
291
303
|
ensure
|
292
304
|
end_span
|
293
305
|
end
|
@@ -19,6 +19,7 @@
|
|
19
19
|
|
20
20
|
require 'elastic_apm/central_config/cache_control'
|
21
21
|
|
22
|
+
# rubocop:disable Style/AccessorGrouping
|
22
23
|
module ElasticAPM
|
23
24
|
# @api private
|
24
25
|
class CentralConfig
|
@@ -27,6 +28,7 @@ module ElasticAPM
|
|
27
28
|
# @api private
|
28
29
|
class ResponseError < InternalError
|
29
30
|
def initialize(response)
|
31
|
+
super
|
30
32
|
@response = response
|
31
33
|
end
|
32
34
|
|
@@ -72,6 +74,7 @@ module ElasticAPM
|
|
72
74
|
def fetch_config
|
73
75
|
resp = perform_request
|
74
76
|
|
77
|
+
# rubocop:disable Lint/DuplicateBranch
|
75
78
|
case resp.status
|
76
79
|
when 200..299
|
77
80
|
resp
|
@@ -82,6 +85,7 @@ module ElasticAPM
|
|
82
85
|
when 500..599
|
83
86
|
raise ServerError, resp
|
84
87
|
end
|
88
|
+
# rubocop:enable Lint/DuplicateBranch
|
85
89
|
end
|
86
90
|
|
87
91
|
def assign(update)
|
@@ -122,7 +126,7 @@ module ElasticAPM
|
|
122
126
|
assign(update)
|
123
127
|
end
|
124
128
|
|
125
|
-
if update
|
129
|
+
if update&.any?
|
126
130
|
info 'Updated config from Kibana'
|
127
131
|
debug 'Modified: %s', update.inspect
|
128
132
|
debug 'Modified original options: %s', @modified_options.inspect
|
@@ -160,7 +164,7 @@ module ElasticAPM
|
|
160
164
|
@server_url ||=
|
161
165
|
config.server_url +
|
162
166
|
'/config/v1/agents' \
|
163
|
-
"?service.name=#{config.service_name}"
|
167
|
+
"?service.name=#{CGI.escape(config.service_name)}"
|
164
168
|
end
|
165
169
|
|
166
170
|
def headers
|
@@ -182,3 +186,4 @@ module ElasticAPM
|
|
182
186
|
end
|
183
187
|
end
|
184
188
|
end
|
189
|
+
# rubocop:enable Style/AccessorGrouping
|
data/lib/elastic_apm/config.rb
CHANGED
@@ -19,6 +19,7 @@
|
|
19
19
|
|
20
20
|
require 'elastic_apm/config/bytes'
|
21
21
|
require 'elastic_apm/config/duration'
|
22
|
+
require 'elastic_apm/config/log_level_map'
|
22
23
|
require 'elastic_apm/config/options'
|
23
24
|
require 'elastic_apm/config/round_float'
|
24
25
|
require 'elastic_apm/config/regexp_list'
|
@@ -32,11 +33,13 @@ module ElasticAPM
|
|
32
33
|
DEPRECATED_OPTIONS = %i[].freeze
|
33
34
|
|
34
35
|
# DEPRECATED: To align with other agents, change on next major bump to:
|
35
|
-
# "password, passwd, pwd, secret, *key, *token*, *session*, *credit*,
|
36
|
+
# "password, passwd, pwd, secret, *key, *token*, *session*, *credit*,
|
37
|
+
# *card*, authorization, set-cookie"
|
36
38
|
SANITIZE_FIELD_NAMES_DEFAULT =
|
37
|
-
%w[*password* *passwd* *pwd* *secret* *key* *token* *session*
|
39
|
+
%w[*password* *passwd* *pwd* *secret* *key* *token* *session*
|
40
|
+
*credit* *card* *authorization* *set-cookie*].freeze
|
38
41
|
|
39
|
-
# rubocop:disable
|
42
|
+
# rubocop:disable Layout/LineLength, Layout/ExtraSpacing
|
40
43
|
option :config_file, type: :string, default: 'config/elastic_apm.yml'
|
41
44
|
option :server_url, type: :url, default: 'http://localhost:8200'
|
42
45
|
option :secret_token, type: :string
|
@@ -73,7 +76,7 @@ module ElasticAPM
|
|
73
76
|
option :ignore_url_patterns, type: :list, default: [], converter: RegexpList.new
|
74
77
|
option :instrument, type: :bool, default: true
|
75
78
|
option :instrumented_rake_tasks, type: :list, default: []
|
76
|
-
option :log_level, type: :int, default: Logger::INFO
|
79
|
+
option :log_level, type: :int, default: Logger::INFO, converter: LogLevelMap.new
|
77
80
|
option :log_path, type: :string
|
78
81
|
option :metrics_interval, type: :int, default: '30s', converter: Duration.new
|
79
82
|
option :pool_size, type: :int, default: 1
|
@@ -83,9 +86,8 @@ module ElasticAPM
|
|
83
86
|
option :proxy_port, type: :int
|
84
87
|
option :proxy_username, type: :string
|
85
88
|
option :recording, type: :bool, default: true
|
86
|
-
option :sanitize_field_names, type: :list,
|
87
|
-
|
88
|
-
option :server_ca_cert, type: :string
|
89
|
+
option :sanitize_field_names, type: :list, default: SANITIZE_FIELD_NAMES_DEFAULT, converter: WildcardPatternList.new
|
90
|
+
option :server_ca_cert_file, type: :string
|
89
91
|
option :service_name, type: :string
|
90
92
|
option :service_node_name, type: :string
|
91
93
|
option :service_version, type: :string
|
@@ -102,7 +104,7 @@ module ElasticAPM
|
|
102
104
|
option :use_legacy_sql_parser, type: :bool, default: false
|
103
105
|
option :verify_server_cert, type: :bool, default: true
|
104
106
|
|
105
|
-
# rubocop:enable
|
107
|
+
# rubocop:enable Layout/LineLength, Layout/ExtraSpacing
|
106
108
|
def initialize(options = {})
|
107
109
|
@options = load_schema
|
108
110
|
|
@@ -126,8 +128,7 @@ module ElasticAPM
|
|
126
128
|
@__root_path ||= Dir.pwd
|
127
129
|
end
|
128
130
|
|
129
|
-
attr_accessor :__view_paths, :__root_path
|
130
|
-
attr_accessor :logger
|
131
|
+
attr_accessor :__view_paths, :__root_path, :logger
|
131
132
|
|
132
133
|
attr_reader :options
|
133
134
|
|
@@ -201,8 +202,9 @@ module ElasticAPM
|
|
201
202
|
def sanitize_field_names=(value)
|
202
203
|
list = WildcardPatternList.new.call(value)
|
203
204
|
defaults = WildcardPatternList.new.call(SANITIZE_FIELD_NAMES_DEFAULT)
|
205
|
+
# use regex pattern for comparisons
|
204
206
|
get(:sanitize_field_names).value =
|
205
|
-
defaults.concat(list).uniq(&:pattern)
|
207
|
+
defaults.concat(list).uniq(&:pattern)
|
206
208
|
end
|
207
209
|
|
208
210
|
def span_frames_min_duration?
|
@@ -223,8 +225,8 @@ module ElasticAPM
|
|
223
225
|
|
224
226
|
@ssl_context ||=
|
225
227
|
OpenSSL::SSL::SSLContext.new.tap do |context|
|
226
|
-
if
|
227
|
-
context.ca_file =
|
228
|
+
if server_ca_cert_file
|
229
|
+
context.ca_file = server_ca_cert_file
|
228
230
|
else
|
229
231
|
context.cert_store =
|
230
232
|
OpenSSL::X509::Store.new.tap(&:set_default_paths)
|
@@ -278,15 +280,20 @@ module ElasticAPM
|
|
278
280
|
end
|
279
281
|
alias active? active
|
280
282
|
|
283
|
+
def server_ca_cert
|
284
|
+
server_ca_cert_file
|
285
|
+
end
|
286
|
+
|
281
287
|
def disabled_instrumentations=(value)
|
282
288
|
warn '[DEPRECATED] The option disabled_instrumentations has been ' \
|
283
289
|
'renamed to disable_instrumentations to align with other agents.'
|
284
290
|
self.disable_instrumentations = value
|
285
291
|
end
|
286
292
|
|
287
|
-
def use_experimental_sql_parser=(
|
288
|
-
warn '[DEPRECATED] The new SQL parser is now the default. To use the
|
289
|
-
|
293
|
+
def use_experimental_sql_parser=(_value)
|
294
|
+
warn '[DEPRECATED] The new SQL parser is now the default. To use the ' \
|
295
|
+
'old one, use use_legacy_sql_parser and please report why you ' \
|
296
|
+
'wish to do so.'
|
290
297
|
end
|
291
298
|
|
292
299
|
def active=(value)
|
@@ -295,6 +302,15 @@ module ElasticAPM
|
|
295
302
|
self.enabled = value
|
296
303
|
end
|
297
304
|
|
305
|
+
def server_ca_cert=(value)
|
306
|
+
unless value == self.class.schema[:server_ca_cert_file][:default]
|
307
|
+
warn '[DEPRECATED] The option server_ca_cert has been ' \
|
308
|
+
'renamed to server_ca_cert_file to align with other agents.'
|
309
|
+
end
|
310
|
+
|
311
|
+
self.server_ca_cert_file = value
|
312
|
+
end
|
313
|
+
|
298
314
|
private
|
299
315
|
|
300
316
|
def load_config_file
|
@@ -313,7 +329,7 @@ module ElasticAPM
|
|
313
329
|
end
|
314
330
|
|
315
331
|
def build_logger
|
316
|
-
Logger.new(log_path == '-' ?
|
332
|
+
Logger.new(log_path == '-' ? $stdout : log_path).tap do |logger|
|
317
333
|
logger.level = log_level
|
318
334
|
end
|
319
335
|
end
|
@@ -344,7 +360,8 @@ module ElasticAPM
|
|
344
360
|
self.logger ||= ::Rails.logger
|
345
361
|
|
346
362
|
self.__root_path = ::Rails.root.to_s
|
347
|
-
self.__view_paths = app.config.paths['app/views'].existent +
|
363
|
+
self.__view_paths = app.config.paths['app/views'].existent +
|
364
|
+
[::Rails.root.to_s]
|
348
365
|
end
|
349
366
|
|
350
367
|
def rails_app_name(app)
|