elastic-apm 3.12.0 → 3.15.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_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 +68 -0
- data/Gemfile +25 -8
- data/Rakefile +10 -10
- data/docs/configuration.asciidoc +20 -3
- data/docs/supported-technologies.asciidoc +2 -0
- data/lib/elastic_apm.rb +4 -4
- data/lib/elastic_apm/central_config.rb +7 -2
- data/lib/elastic_apm/config.rb +38 -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/naively_hashable.rb +1 -0
- data/lib/elastic_apm/normalizers/rails/active_record.rb +22 -4
- data/lib/elastic_apm/opentracing.rb +2 -1
- data/lib/elastic_apm/span.rb +1 -2
- data/lib/elastic_apm/span/context.rb +10 -2
- data/lib/elastic_apm/span/context/db.rb +1 -1
- data/lib/elastic_apm/span/context/destination.rb +15 -2
- data/lib/elastic_apm/span/context/http.rb +2 -0
- data/lib/elastic_apm/span/context/message.rb +40 -0
- data/lib/elastic_apm/spies/delayed_job.rb +9 -3
- data/lib/elastic_apm/spies/dynamo_db.rb +41 -1
- data/lib/elastic_apm/spies/elasticsearch.rb +4 -2
- data/lib/elastic_apm/spies/faraday.rb +18 -11
- data/lib/elastic_apm/spies/mongo.rb +8 -4
- data/lib/elastic_apm/spies/net_http.rb +3 -1
- data/lib/elastic_apm/spies/s3.rb +124 -0
- data/lib/elastic_apm/spies/sequel.rb +2 -0
- data/lib/elastic_apm/spies/sns.rb +131 -0
- data/lib/elastic_apm/spies/sqs.rb +240 -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 +5 -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 +8 -7
- data/lib/elastic_apm/transport/serializers/span_serializer.rb +28 -8
- 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 +12 -3
data/CHANGELOG.asciidoc
CHANGED
|
@@ -35,6 +35,74 @@ endif::[]
|
|
|
35
35
|
[[release-notes-3.x]]
|
|
36
36
|
=== Ruby Agent version 3.x
|
|
37
37
|
|
|
38
|
+
[[release-notes-3.15.1]]
|
|
39
|
+
==== 3.15.1 (2021-04-06)
|
|
40
|
+
|
|
41
|
+
[float]
|
|
42
|
+
===== Fixed
|
|
43
|
+
|
|
44
|
+
- AWS S3 spy accepts symbol bucket names {pull}998[#998]
|
|
45
|
+
- AWS S3 spy passing on blocks {pull}998[#998]
|
|
46
|
+
|
|
47
|
+
[[release-notes-3.15.0]]
|
|
48
|
+
==== 3.15.0 (2021-03-22)
|
|
49
|
+
|
|
50
|
+
[float]
|
|
51
|
+
===== Changed
|
|
52
|
+
|
|
53
|
+
- Changed DynamoDB instrumentation to match spec. Span names now follow the format `DynamoDB
|
|
54
|
+
Operation [table]` {pull}976[#976]
|
|
55
|
+
|
|
56
|
+
[float]
|
|
57
|
+
===== Added
|
|
58
|
+
- Support for AWS S3 {pull}977[#977]
|
|
59
|
+
- Support for AWS SQS {pull}978[#978]
|
|
60
|
+
- Support for AWS SNS {pull}978[#978]
|
|
61
|
+
|
|
62
|
+
[[release-notes-3.14.0]]
|
|
63
|
+
==== 3.14.0 (2021-03-17)
|
|
64
|
+
|
|
65
|
+
[float]
|
|
66
|
+
===== Added
|
|
67
|
+
|
|
68
|
+
- Expanded support for extracting ActiveRecord adapter name from notification payload when using
|
|
69
|
+
ActiveRecord versions before 6.0 {pull}953[#953]
|
|
70
|
+
|
|
71
|
+
[float]
|
|
72
|
+
===== Fixed
|
|
73
|
+
|
|
74
|
+
- Fixed setting outcome in Mongo spy when not traced {pull}937[#937]
|
|
75
|
+
- Fixed missing container metadata in payloads {pull}942[#942]
|
|
76
|
+
- Fixed outgoing HTTP request spans with no Host {pull}962[#962]
|
|
77
|
+
|
|
78
|
+
[[release-notes-3.13.0]]
|
|
79
|
+
==== 3.13.0 (2020-12-22)
|
|
80
|
+
|
|
81
|
+
[float]
|
|
82
|
+
===== Fixed
|
|
83
|
+
|
|
84
|
+
- Handle invalid utf-8 byte sequences in sql summarizer and DB statement {pull}896[#896]
|
|
85
|
+
- Expand Kubernetes metadata discovery {pull}916[#916]
|
|
86
|
+
- Fix fetching cloud info on Http.rb 3.x versions {pull}919[#919]
|
|
87
|
+
|
|
88
|
+
[float]
|
|
89
|
+
===== Added
|
|
90
|
+
|
|
91
|
+
- Support both integer and string log levels, and extra central config values {pull}902[#902]
|
|
92
|
+
|
|
93
|
+
[float]
|
|
94
|
+
===== Changed
|
|
95
|
+
|
|
96
|
+
- Rename server_ca_cert to server_ca_cert_file {pull}908[#908]
|
|
97
|
+
|
|
98
|
+
[[release-notes-3.12.1]]
|
|
99
|
+
==== 3.12.1 (2020-11-16)
|
|
100
|
+
|
|
101
|
+
[float]
|
|
102
|
+
===== Fixed
|
|
103
|
+
|
|
104
|
+
- `capture_elasticsearch_queries` no longer modifies the original query {pull}894[#894]
|
|
105
|
+
|
|
38
106
|
[[release-notes-3.12.0]]
|
|
39
107
|
==== 3.12.0 (2020-11-10)
|
|
40
108
|
|
data/Gemfile
CHANGED
|
@@ -23,7 +23,6 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
|
|
23
23
|
|
|
24
24
|
# Tools
|
|
25
25
|
gem 'cucumber', require: false
|
|
26
|
-
gem 'pry'
|
|
27
26
|
gem 'rack-test'
|
|
28
27
|
gem 'rspec', '~> 3'
|
|
29
28
|
gem 'rspec-its'
|
|
@@ -32,13 +31,17 @@ gem 'webmock'
|
|
|
32
31
|
|
|
33
32
|
# Integrations
|
|
34
33
|
gem 'aws-sdk-dynamodb', require: nil
|
|
34
|
+
gem 'aws-sdk-s3', require: nil
|
|
35
35
|
gem 'aws-sdk-sqs', require: nil
|
|
36
|
+
gem 'aws-sdk-sns', require: nil
|
|
36
37
|
gem 'elasticsearch', require: nil
|
|
37
38
|
gem 'fakeredis', require: nil
|
|
38
39
|
gem 'faraday', require: nil
|
|
39
40
|
gem 'graphql', require: nil
|
|
40
|
-
|
|
41
|
-
gem '
|
|
41
|
+
if !defined?(JRUBY_VERSION) && RUBY_VERSION < '2.5'
|
|
42
|
+
gem 'google-protobuf', '< 3.12'
|
|
43
|
+
end
|
|
44
|
+
gem 'grpc' if !defined?(JRUBY_VERSION) && RUBY_VERSION < '3.0'
|
|
42
45
|
gem 'json'
|
|
43
46
|
gem 'json-schema', require: nil
|
|
44
47
|
gem 'mongo', require: nil
|
|
@@ -55,6 +58,10 @@ gem 'sucker_punch', '~> 2.0', require: nil
|
|
|
55
58
|
gem 'yard', require: nil
|
|
56
59
|
gem 'yarjuf'
|
|
57
60
|
|
|
61
|
+
# See issue #6547 in the JRuby repo. When that bug is fixed,
|
|
62
|
+
# we can use the latest version of the i18n gem.
|
|
63
|
+
gem 'i18n', '< 1.8.8'
|
|
64
|
+
|
|
58
65
|
## Install Framework
|
|
59
66
|
GITHUB_REPOS = {
|
|
60
67
|
'grape' => 'ruby-grape/grape',
|
|
@@ -72,8 +79,10 @@ end
|
|
|
72
79
|
|
|
73
80
|
frameworks_versions.each do |framework, version|
|
|
74
81
|
case version
|
|
75
|
-
when 'master'
|
|
82
|
+
when 'master' # sinatra, grape
|
|
76
83
|
gem framework, github: GITHUB_REPOS.fetch(framework)
|
|
84
|
+
when 'main' # rails
|
|
85
|
+
gem framework, github: GITHUB_REPOS.fetch(framework), branch: 'main'
|
|
77
86
|
when /.+/
|
|
78
87
|
gem framework, "~> #{version}.0"
|
|
79
88
|
else
|
|
@@ -82,18 +91,26 @@ frameworks_versions.each do |framework, version|
|
|
|
82
91
|
end
|
|
83
92
|
|
|
84
93
|
if frameworks_versions.key?('rails')
|
|
85
|
-
unless frameworks_versions['rails'] =~ /^(
|
|
94
|
+
unless frameworks_versions['rails'] =~ /^(main|6)/
|
|
86
95
|
gem 'delayed_job', require: nil
|
|
87
96
|
end
|
|
88
97
|
end
|
|
89
98
|
|
|
90
99
|
if RUBY_PLATFORM == 'java'
|
|
91
|
-
|
|
92
|
-
|
|
100
|
+
case rails = frameworks_versions['rails']
|
|
101
|
+
when 'main'
|
|
102
|
+
gem 'activerecord-jdbcsqlite3-adapter', git: 'https://github.com/jruby/activerecord-jdbc-adapter', glob: 'activerecord-jdbcsqlite3-adapter/*.gemspec'
|
|
103
|
+
when ''
|
|
104
|
+
gem 'activerecord-jdbcsqlite3-adapter', "~> 61.0"
|
|
105
|
+
when nil
|
|
106
|
+
gem 'jdbc-sqlite3'
|
|
107
|
+
else
|
|
108
|
+
gem 'activerecord-jdbcsqlite3-adapter', "~> #{rails.tr('.', '')}.0"
|
|
109
|
+
end
|
|
93
110
|
elsif frameworks_versions['rails'] =~ /^(4|5)/
|
|
94
111
|
gem 'sqlite3', '~> 1.3.6'
|
|
95
112
|
else
|
|
96
|
-
gem 'sqlite3'
|
|
113
|
+
gem 'sqlite3'
|
|
97
114
|
end
|
|
98
115
|
|
|
99
116
|
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/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
|
#
|
|
@@ -293,12 +295,10 @@ module ElasticAPM
|
|
|
293
295
|
sync: sync
|
|
294
296
|
)
|
|
295
297
|
result = yield span
|
|
296
|
-
span&.outcome
|
|
297
|
-
Span::Outcome::SUCCESS unless span&.outcome
|
|
298
|
+
span&.outcome ||= Span::Outcome::SUCCESS
|
|
298
299
|
result
|
|
299
300
|
rescue
|
|
300
|
-
span&.outcome
|
|
301
|
-
Span::Outcome::FAILURE unless span&.outcome
|
|
301
|
+
span&.outcome ||= Span::Outcome::FAILURE
|
|
302
302
|
raise
|
|
303
303
|
ensure
|
|
304
304
|
end_span
|
|
@@ -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
|
|
|
@@ -150,11 +151,14 @@ module ElasticAPM
|
|
|
150
151
|
rake
|
|
151
152
|
redis
|
|
152
153
|
resque
|
|
154
|
+
s3
|
|
153
155
|
sequel
|
|
154
156
|
shoryuken
|
|
155
157
|
sidekiq
|
|
156
158
|
sinatra
|
|
157
159
|
sneakers
|
|
160
|
+
sns
|
|
161
|
+
sqs
|
|
158
162
|
sucker_punch
|
|
159
163
|
tilt
|
|
160
164
|
]
|
|
@@ -201,8 +205,9 @@ module ElasticAPM
|
|
|
201
205
|
def sanitize_field_names=(value)
|
|
202
206
|
list = WildcardPatternList.new.call(value)
|
|
203
207
|
defaults = WildcardPatternList.new.call(SANITIZE_FIELD_NAMES_DEFAULT)
|
|
208
|
+
# use regex pattern for comparisons
|
|
204
209
|
get(:sanitize_field_names).value =
|
|
205
|
-
defaults.concat(list).uniq(&:pattern)
|
|
210
|
+
defaults.concat(list).uniq(&:pattern)
|
|
206
211
|
end
|
|
207
212
|
|
|
208
213
|
def span_frames_min_duration?
|
|
@@ -223,8 +228,8 @@ module ElasticAPM
|
|
|
223
228
|
|
|
224
229
|
@ssl_context ||=
|
|
225
230
|
OpenSSL::SSL::SSLContext.new.tap do |context|
|
|
226
|
-
if
|
|
227
|
-
context.ca_file =
|
|
231
|
+
if server_ca_cert_file
|
|
232
|
+
context.ca_file = server_ca_cert_file
|
|
228
233
|
else
|
|
229
234
|
context.cert_store =
|
|
230
235
|
OpenSSL::X509::Store.new.tap(&:set_default_paths)
|
|
@@ -278,15 +283,20 @@ module ElasticAPM
|
|
|
278
283
|
end
|
|
279
284
|
alias active? active
|
|
280
285
|
|
|
286
|
+
def server_ca_cert
|
|
287
|
+
server_ca_cert_file
|
|
288
|
+
end
|
|
289
|
+
|
|
281
290
|
def disabled_instrumentations=(value)
|
|
282
291
|
warn '[DEPRECATED] The option disabled_instrumentations has been ' \
|
|
283
292
|
'renamed to disable_instrumentations to align with other agents.'
|
|
284
293
|
self.disable_instrumentations = value
|
|
285
294
|
end
|
|
286
295
|
|
|
287
|
-
def use_experimental_sql_parser=(
|
|
288
|
-
warn '[DEPRECATED] The new SQL parser is now the default. To use the
|
|
289
|
-
|
|
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.'
|
|
290
300
|
end
|
|
291
301
|
|
|
292
302
|
def active=(value)
|
|
@@ -295,6 +305,15 @@ module ElasticAPM
|
|
|
295
305
|
self.enabled = value
|
|
296
306
|
end
|
|
297
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
|
+
|
|
298
317
|
private
|
|
299
318
|
|
|
300
319
|
def load_config_file
|
|
@@ -313,7 +332,7 @@ module ElasticAPM
|
|
|
313
332
|
end
|
|
314
333
|
|
|
315
334
|
def build_logger
|
|
316
|
-
Logger.new(log_path == '-' ?
|
|
335
|
+
Logger.new(log_path == '-' ? $stdout : log_path).tap do |logger|
|
|
317
336
|
logger.level = log_level
|
|
318
337
|
end
|
|
319
338
|
end
|
|
@@ -344,7 +363,8 @@ module ElasticAPM
|
|
|
344
363
|
self.logger ||= ::Rails.logger
|
|
345
364
|
|
|
346
365
|
self.__root_path = ::Rails.root.to_s
|
|
347
|
-
self.__view_paths = app.config.paths['app/views'].existent +
|
|
366
|
+
self.__view_paths = app.config.paths['app/views'].existent +
|
|
367
|
+
[::Rails.root.to_s]
|
|
348
368
|
end
|
|
349
369
|
|
|
350
370
|
def rails_app_name(app)
|