elastic-apm 3.15.1 → 4.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ci/.jenkins_exclude.yml +13 -0
- data/.ci/.jenkins_ruby.yml +0 -1
- data/.ci/Jenkinsfile +1 -0
- data/.github/dependabot.yml +16 -0
- data/.rubocop.yml +0 -7
- data/CHANGELOG.asciidoc +77 -4
- data/Gemfile +4 -1
- data/README.md +12 -0
- data/SECURITY.md +7 -0
- data/bench/report.rb +1 -1
- data/bin/run-bdd +17 -0
- data/bin/run-tests +1 -1
- data/docker-compose.yml +1 -1
- data/docs/configuration.asciidoc +62 -147
- data/docs/release-notes.asciidoc +1 -0
- data/docs/upgrading.asciidoc +0 -27
- data/lib/elastic_apm.rb +12 -1
- data/lib/elastic_apm/agent.rb +7 -3
- data/lib/elastic_apm/central_config.rb +8 -7
- data/lib/elastic_apm/config.rb +2 -88
- 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/context/response.rb +1 -3
- data/lib/elastic_apm/fields.rb +88 -0
- data/lib/elastic_apm/grpc.rb +2 -4
- data/lib/elastic_apm/instrumenter.rb +1 -1
- data/lib/elastic_apm/metadata/cloud_info.rb +32 -5
- data/lib/elastic_apm/metadata/system_info.rb +14 -4
- data/lib/elastic_apm/metrics/cpu_mem_set.rb +1 -1
- data/lib/elastic_apm/normalizers.rb +2 -2
- data/lib/elastic_apm/normalizers/rails/active_record.rb +3 -3
- data/lib/elastic_apm/opentracing.rb +3 -2
- data/lib/elastic_apm/span.rb +26 -1
- data/lib/elastic_apm/span/context.rb +2 -1
- data/lib/elastic_apm/span/context/destination.rb +53 -40
- data/lib/elastic_apm/span_helpers.rb +6 -8
- data/lib/elastic_apm/spies.rb +20 -0
- data/lib/elastic_apm/spies/action_dispatch.rb +10 -9
- data/lib/elastic_apm/spies/azure_storage_table.rb +148 -0
- data/lib/elastic_apm/spies/dynamo_db.rb +12 -12
- data/lib/elastic_apm/spies/elasticsearch.rb +32 -29
- data/lib/elastic_apm/spies/faraday.rb +83 -63
- data/lib/elastic_apm/spies/http.rb +33 -34
- data/lib/elastic_apm/spies/mongo.rb +5 -3
- data/lib/elastic_apm/spies/net_http.rb +59 -56
- 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 +14 -15
- 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 +39 -44
- data/lib/elastic_apm/spies/sqs.rb +21 -31
- data/lib/elastic_apm/spies/tilt.rb +10 -9
- data/lib/elastic_apm/sql/tokenizer.rb +21 -5
- data/lib/elastic_apm/stacktrace_builder.rb +3 -1
- data/lib/elastic_apm/subscriber.rb +1 -0
- data/lib/elastic_apm/trace_context.rb +5 -13
- data/lib/elastic_apm/trace_context/traceparent.rb +5 -6
- data/lib/elastic_apm/transport/connection.rb +1 -1
- data/lib/elastic_apm/transport/connection/http.rb +4 -2
- data/lib/elastic_apm/transport/connection/proxy_pipe.rb +1 -2
- data/lib/elastic_apm/transport/filters/hash_sanitizer.rb +5 -23
- data/lib/elastic_apm/transport/serializers/metadata_serializer.rb +3 -2
- data/lib/elastic_apm/transport/serializers/metricset_serializer.rb +2 -2
- data/lib/elastic_apm/transport/serializers/span_serializer.rb +12 -12
- data/lib/elastic_apm/transport/user_agent.rb +3 -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
- metadata +12 -9
- data/lib/elastic_apm/sql.rb +0 -36
- data/lib/elastic_apm/sql_summarizer.rb +0 -53
@@ -93,19 +93,19 @@ module ElasticAPM
|
|
93
93
|
end
|
94
94
|
|
95
95
|
def build_destination(destination)
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
96
|
+
return unless destination
|
97
|
+
|
98
|
+
base = {
|
99
|
+
address: keyword_field(destination.address),
|
100
|
+
port: destination.port
|
101
|
+
}
|
102
|
+
|
103
|
+
unless destination.service&.empty?
|
104
|
+
base[:service] = destination.service.to_h
|
105
|
+
end
|
106
106
|
|
107
|
-
|
108
|
-
base[:cloud] =
|
107
|
+
unless destination.cloud&.empty?
|
108
|
+
base[:cloud] = destination.cloud.to_h
|
109
109
|
end
|
110
110
|
|
111
111
|
base
|
@@ -21,7 +21,8 @@ module ElasticAPM
|
|
21
21
|
module Transport
|
22
22
|
# @api private
|
23
23
|
class UserAgent
|
24
|
-
def initialize(config)
|
24
|
+
def initialize(config, version: VERSION)
|
25
|
+
@version = version
|
25
26
|
@built = build(config)
|
26
27
|
end
|
27
28
|
|
@@ -35,7 +36,7 @@ module ElasticAPM
|
|
35
36
|
service = Metadata::ServiceInfo.new(config)
|
36
37
|
|
37
38
|
[
|
38
|
-
"elastic-apm-ruby/#{
|
39
|
+
"elastic-apm-ruby/#{@version}",
|
39
40
|
HTTP::Request::USER_AGENT,
|
40
41
|
[
|
41
42
|
service.runtime.name,
|
data/lib/elastic_apm/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elastic-apm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mikkel Malmberg
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-07-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -38,7 +38,7 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '3.0'
|
41
|
-
description:
|
41
|
+
description:
|
42
42
|
email:
|
43
43
|
- mikkel@elastic.co
|
44
44
|
executables: []
|
@@ -69,6 +69,7 @@ files:
|
|
69
69
|
- ".github/ISSUE_TEMPLATE/Bug_report.md"
|
70
70
|
- ".github/ISSUE_TEMPLATE/Feature_request.md"
|
71
71
|
- ".github/PULL_REQUEST_TEMPLATE.md"
|
72
|
+
- ".github/dependabot.yml"
|
72
73
|
- ".github/labeler-config.yml"
|
73
74
|
- ".github/workflows/addToProject.yml"
|
74
75
|
- ".github/workflows/labeler.yml"
|
@@ -84,6 +85,7 @@ files:
|
|
84
85
|
- LICENSE
|
85
86
|
- README.md
|
86
87
|
- Rakefile
|
88
|
+
- SECURITY.md
|
87
89
|
- bench/.gitignore
|
88
90
|
- bench/app.rb
|
89
91
|
- bench/benchmark.rb
|
@@ -95,6 +97,7 @@ files:
|
|
95
97
|
- bin/build_docs
|
96
98
|
- bin/console
|
97
99
|
- bin/dev
|
100
|
+
- bin/run-bdd
|
98
101
|
- bin/run-tests
|
99
102
|
- bin/setup
|
100
103
|
- bin/with_framework
|
@@ -146,6 +149,7 @@ files:
|
|
146
149
|
- lib/elastic_apm/error/exception.rb
|
147
150
|
- lib/elastic_apm/error/log.rb
|
148
151
|
- lib/elastic_apm/error_builder.rb
|
152
|
+
- lib/elastic_apm/fields.rb
|
149
153
|
- lib/elastic_apm/grape.rb
|
150
154
|
- lib/elastic_apm/graphql.rb
|
151
155
|
- lib/elastic_apm/grpc.rb
|
@@ -191,6 +195,7 @@ files:
|
|
191
195
|
- lib/elastic_apm/span_helpers.rb
|
192
196
|
- lib/elastic_apm/spies.rb
|
193
197
|
- lib/elastic_apm/spies/action_dispatch.rb
|
198
|
+
- lib/elastic_apm/spies/azure_storage_table.rb
|
194
199
|
- lib/elastic_apm/spies/delayed_job.rb
|
195
200
|
- lib/elastic_apm/spies/dynamo_db.rb
|
196
201
|
- lib/elastic_apm/spies/elasticsearch.rb
|
@@ -212,11 +217,9 @@ files:
|
|
212
217
|
- lib/elastic_apm/spies/sqs.rb
|
213
218
|
- lib/elastic_apm/spies/sucker_punch.rb
|
214
219
|
- lib/elastic_apm/spies/tilt.rb
|
215
|
-
- lib/elastic_apm/sql.rb
|
216
220
|
- lib/elastic_apm/sql/signature.rb
|
217
221
|
- lib/elastic_apm/sql/tokenizer.rb
|
218
222
|
- lib/elastic_apm/sql/tokens.rb
|
219
|
-
- lib/elastic_apm/sql_summarizer.rb
|
220
223
|
- lib/elastic_apm/stacktrace.rb
|
221
224
|
- lib/elastic_apm/stacktrace/frame.rb
|
222
225
|
- lib/elastic_apm/stacktrace_builder.rb
|
@@ -254,7 +257,7 @@ licenses:
|
|
254
257
|
- Apache-2.0
|
255
258
|
metadata:
|
256
259
|
source_code_uri: https://github.com/elastic/apm-agent-ruby
|
257
|
-
post_install_message:
|
260
|
+
post_install_message:
|
258
261
|
rdoc_options: []
|
259
262
|
require_paths:
|
260
263
|
- lib
|
@@ -269,8 +272,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
269
272
|
- !ruby/object:Gem::Version
|
270
273
|
version: '0'
|
271
274
|
requirements: []
|
272
|
-
rubygems_version: 3.1
|
273
|
-
signing_key:
|
275
|
+
rubygems_version: 3.0.3.1
|
276
|
+
signing_key:
|
274
277
|
specification_version: 4
|
275
278
|
summary: The official Elastic APM agent for Ruby
|
276
279
|
test_files: []
|
data/lib/elastic_apm/sql.rb
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
# Licensed to Elasticsearch B.V. under one or more contributor
|
2
|
-
# license agreements. See the NOTICE file distributed with
|
3
|
-
# this work for additional information regarding copyright
|
4
|
-
# ownership. Elasticsearch B.V. licenses this file to you under
|
5
|
-
# the Apache License, Version 2.0 (the "License"); you may
|
6
|
-
# not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing,
|
12
|
-
# software distributed under the License is distributed on an
|
13
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
-
# KIND, either express or implied. See the License for the
|
15
|
-
# specific language governing permissions and limitations
|
16
|
-
# under the License.
|
17
|
-
|
18
|
-
# frozen_string_literal: true
|
19
|
-
|
20
|
-
module ElasticAPM
|
21
|
-
# @api private
|
22
|
-
module Sql
|
23
|
-
# This method is only here as a shortcut while the agent ships with
|
24
|
-
# both implementations ~mikker
|
25
|
-
def self.summarizer
|
26
|
-
@summarizer ||=
|
27
|
-
if ElasticAPM.agent&.config&.use_legacy_sql_parser
|
28
|
-
require 'elastic_apm/sql_summarizer'
|
29
|
-
SqlSummarizer.new
|
30
|
-
else
|
31
|
-
require 'elastic_apm/sql/signature'
|
32
|
-
Sql::Signature::Summarizer.new
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
@@ -1,53 +0,0 @@
|
|
1
|
-
# Licensed to Elasticsearch B.V. under one or more contributor
|
2
|
-
# license agreements. See the NOTICE file distributed with
|
3
|
-
# this work for additional information regarding copyright
|
4
|
-
# ownership. Elasticsearch B.V. licenses this file to you under
|
5
|
-
# the Apache License, Version 2.0 (the "License"); you may
|
6
|
-
# not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing,
|
12
|
-
# software distributed under the License is distributed on an
|
13
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
-
# KIND, either express or implied. See the License for the
|
15
|
-
# specific language governing permissions and limitations
|
16
|
-
# under the License.
|
17
|
-
|
18
|
-
# frozen_string_literal: true
|
19
|
-
|
20
|
-
require 'elastic_apm/util/lru_cache'
|
21
|
-
|
22
|
-
module ElasticAPM
|
23
|
-
# @api private
|
24
|
-
class SqlSummarizer
|
25
|
-
DEFAULT = 'SQL'
|
26
|
-
TABLE_REGEX = %{["'`]?([A-Za-z0-9_]+)["'`]?}
|
27
|
-
|
28
|
-
REGEXES = {
|
29
|
-
/^BEGIN/iu => 'BEGIN',
|
30
|
-
/^COMMIT/iu => 'COMMIT',
|
31
|
-
/^SELECT .* FROM #{TABLE_REGEX}/iu => 'SELECT FROM ',
|
32
|
-
/^INSERT INTO #{TABLE_REGEX}/iu => 'INSERT INTO ',
|
33
|
-
/^UPDATE #{TABLE_REGEX}/iu => 'UPDATE ',
|
34
|
-
/^DELETE FROM #{TABLE_REGEX}/iu => 'DELETE FROM '
|
35
|
-
}.freeze
|
36
|
-
|
37
|
-
FORMAT = '%s%s'
|
38
|
-
|
39
|
-
def self.cache
|
40
|
-
@cache ||= Util::LruCache.new
|
41
|
-
end
|
42
|
-
|
43
|
-
def summarize(sql)
|
44
|
-
sql = sql.encode('utf-8', invalid: :replace, undef: :replace)
|
45
|
-
self.class.cache[sql] ||=
|
46
|
-
REGEXES.find do |regex, sig|
|
47
|
-
if (match = sql[0...1000].match(regex))
|
48
|
-
break format(FORMAT, sig, match[1] && match[1].gsub(/["']/, ''))
|
49
|
-
end
|
50
|
-
end || DEFAULT
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|