elastic-apm 3.10.1 → 3.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/labeler-config.yml +3 -0
- data/.github/workflows/labeler.yml +16 -0
- data/.rubocop.yml +33 -4
- data/CHANGELOG.asciidoc +67 -0
- data/Gemfile +5 -6
- data/Rakefile +10 -10
- data/docs/api.asciidoc +2 -1
- data/docs/configuration.asciidoc +4 -3
- data/lib/elastic_apm.rb +14 -2
- data/lib/elastic_apm/central_config.rb +7 -2
- data/lib/elastic_apm/config.rb +51 -19
- data/lib/elastic_apm/config/log_level_map.rb +47 -0
- data/lib/elastic_apm/config/options.rb +2 -1
- data/lib/elastic_apm/config/round_float.rb +31 -0
- data/lib/elastic_apm/config/wildcard_pattern_list.rb +2 -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 +11 -4
- data/lib/elastic_apm/metadata.rb +3 -1
- data/lib/elastic_apm/metadata/cloud_info.rb +130 -0
- 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/opentracing.rb +2 -1
- data/lib/elastic_apm/span.rb +14 -0
- data/lib/elastic_apm/span/context/db.rb +1 -1
- data/lib/elastic_apm/spies/delayed_job.rb +8 -2
- data/lib/elastic_apm/spies/dynamo_db.rb +8 -1
- data/lib/elastic_apm/spies/elasticsearch.rb +10 -2
- data/lib/elastic_apm/spies/faraday.rb +5 -2
- data/lib/elastic_apm/spies/http.rb +1 -0
- data/lib/elastic_apm/spies/mongo.rb +6 -2
- data/lib/elastic_apm/spies/net_http.rb +3 -0
- 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 +1 -3
- data/lib/elastic_apm/trace_context/traceparent.rb +2 -6
- data/lib/elastic_apm/trace_context/tracestate.rb +114 -9
- data/lib/elastic_apm/transaction.rb +41 -7
- data/lib/elastic_apm/transport/connection.rb +2 -1
- data/lib/elastic_apm/transport/filters/hash_sanitizer.rb +16 -16
- data/lib/elastic_apm/transport/filters/secrets_filter.rb +35 -12
- data/lib/elastic_apm/transport/serializers.rb +9 -6
- data/lib/elastic_apm/transport/serializers/metadata_serializer.rb +44 -4
- data/lib/elastic_apm/transport/serializers/span_serializer.rb +3 -3
- data/lib/elastic_apm/transport/serializers/transaction_serializer.rb +2 -0
- data/lib/elastic_apm/transport/user_agent.rb +3 -3
- data/lib/elastic_apm/transport/worker.rb +1 -0
- data/lib/elastic_apm/util.rb +2 -0
- data/lib/elastic_apm/util/deep_dup.rb +65 -0
- data/lib/elastic_apm/util/precision_validator.rb +46 -0
- data/lib/elastic_apm/version.rb +1 -1
- metadata +10 -3
@@ -42,14 +42,15 @@ module ElasticAPM
|
|
42
42
|
context: context_serializer.build(span.context),
|
43
43
|
stacktrace: span.stacktrace.to_a,
|
44
44
|
timestamp: span.timestamp,
|
45
|
-
trace_id: span.trace_id
|
45
|
+
trace_id: span.trace_id,
|
46
|
+
sample_rate: span.sample_rate,
|
47
|
+
outcome: keyword_field(span.outcome)
|
46
48
|
}
|
47
49
|
}
|
48
50
|
end
|
49
51
|
|
50
52
|
# @api private
|
51
53
|
class ContextSerializer < Serializer
|
52
|
-
# rubocop:disable Metrics/CyclomaticComplexity
|
53
54
|
def build(context)
|
54
55
|
return unless context
|
55
56
|
|
@@ -66,7 +67,6 @@ module ElasticAPM
|
|
66
67
|
|
67
68
|
base
|
68
69
|
end
|
69
|
-
# rubocop:enable Metrics/CyclomaticComplexity
|
70
70
|
|
71
71
|
private
|
72
72
|
|
@@ -35,9 +35,11 @@ module ElasticAPM
|
|
35
35
|
name: keyword_field(transaction.name),
|
36
36
|
type: keyword_field(transaction.type),
|
37
37
|
result: keyword_field(transaction.result.to_s),
|
38
|
+
outcome: keyword_field(transaction.outcome),
|
38
39
|
duration: ms(transaction.duration),
|
39
40
|
timestamp: transaction.timestamp,
|
40
41
|
sampled: transaction.sampled?,
|
42
|
+
sample_rate: transaction.sample_rate,
|
41
43
|
context: context_serializer.build(transaction.context),
|
42
44
|
span_count: {
|
43
45
|
started: transaction.started_spans,
|
@@ -32,14 +32,14 @@ module ElasticAPM
|
|
32
32
|
private
|
33
33
|
|
34
34
|
def build(config)
|
35
|
-
|
35
|
+
service = Metadata::ServiceInfo.new(config)
|
36
36
|
|
37
37
|
[
|
38
38
|
"elastic-apm-ruby/#{VERSION}",
|
39
39
|
HTTP::Request::USER_AGENT,
|
40
40
|
[
|
41
|
-
|
42
|
-
|
41
|
+
service.runtime.name,
|
42
|
+
service.runtime.version
|
43
43
|
].join('/')
|
44
44
|
].join(' ')
|
45
45
|
end
|
data/lib/elastic_apm/util.rb
CHANGED
@@ -0,0 +1,65 @@
|
|
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
|
+
module Util
|
22
|
+
# @api private
|
23
|
+
#
|
24
|
+
# Makes a deep copy of an Array or Hash
|
25
|
+
# NB: Not guaranteed to work well with complex objects, only simple Hash,
|
26
|
+
# Array, String, Number, etc.
|
27
|
+
class DeepDup
|
28
|
+
def initialize(obj)
|
29
|
+
@obj = obj
|
30
|
+
end
|
31
|
+
|
32
|
+
def dup
|
33
|
+
deep_dup(@obj)
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.dup(obj)
|
37
|
+
new(obj).dup
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def deep_dup(obj)
|
43
|
+
case obj
|
44
|
+
when Hash then hash(obj)
|
45
|
+
when Array then array(obj)
|
46
|
+
else obj.dup
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def array(arr)
|
51
|
+
arr.map(&method(:deep_dup))
|
52
|
+
end
|
53
|
+
|
54
|
+
def hash(hsh)
|
55
|
+
result = hsh.dup
|
56
|
+
|
57
|
+
hsh.each_pair do |key, value|
|
58
|
+
result[key] = deep_dup(value)
|
59
|
+
end
|
60
|
+
|
61
|
+
result
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,46 @@
|
|
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
|
+
module Util
|
22
|
+
# @api private
|
23
|
+
# Rounds half away from zero.
|
24
|
+
# If `minimum` is provided, and the value rounds to 0 (but was not zero to
|
25
|
+
# begin with), use the minimum instead.
|
26
|
+
module PrecisionValidator
|
27
|
+
module_function
|
28
|
+
|
29
|
+
def validate(value, precision: 0, minimum: nil)
|
30
|
+
float = Float(value)
|
31
|
+
return nil unless (0.0..1.0).cover?(float)
|
32
|
+
return float if float == 0
|
33
|
+
|
34
|
+
multiplier = Float(10**precision)
|
35
|
+
rounded = (float * multiplier + 0.5).floor / multiplier
|
36
|
+
if rounded == 0 && minimum
|
37
|
+
minimum
|
38
|
+
else
|
39
|
+
rounded
|
40
|
+
end
|
41
|
+
rescue ArgumentError
|
42
|
+
nil
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
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: 3.
|
4
|
+
version: 3.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mikkel Malmberg
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -69,6 +69,8 @@ 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/labeler-config.yml"
|
73
|
+
- ".github/workflows/labeler.yml"
|
72
74
|
- ".gitignore"
|
73
75
|
- ".pre-commit-config.yaml"
|
74
76
|
- ".rspec"
|
@@ -126,8 +128,10 @@ files:
|
|
126
128
|
- lib/elastic_apm/config.rb
|
127
129
|
- lib/elastic_apm/config/bytes.rb
|
128
130
|
- lib/elastic_apm/config/duration.rb
|
131
|
+
- lib/elastic_apm/config/log_level_map.rb
|
129
132
|
- lib/elastic_apm/config/options.rb
|
130
133
|
- lib/elastic_apm/config/regexp_list.rb
|
134
|
+
- lib/elastic_apm/config/round_float.rb
|
131
135
|
- lib/elastic_apm/config/wildcard_pattern_list.rb
|
132
136
|
- lib/elastic_apm/context.rb
|
133
137
|
- lib/elastic_apm/context/request.rb
|
@@ -148,6 +152,7 @@ files:
|
|
148
152
|
- lib/elastic_apm/internal_error.rb
|
149
153
|
- lib/elastic_apm/logging.rb
|
150
154
|
- lib/elastic_apm/metadata.rb
|
155
|
+
- lib/elastic_apm/metadata/cloud_info.rb
|
151
156
|
- lib/elastic_apm/metadata/process_info.rb
|
152
157
|
- lib/elastic_apm/metadata/service_info.rb
|
153
158
|
- lib/elastic_apm/metadata/system_info.rb
|
@@ -233,8 +238,10 @@ files:
|
|
233
238
|
- lib/elastic_apm/transport/user_agent.rb
|
234
239
|
- lib/elastic_apm/transport/worker.rb
|
235
240
|
- lib/elastic_apm/util.rb
|
241
|
+
- lib/elastic_apm/util/deep_dup.rb
|
236
242
|
- lib/elastic_apm/util/inflector.rb
|
237
243
|
- lib/elastic_apm/util/lru_cache.rb
|
244
|
+
- lib/elastic_apm/util/precision_validator.rb
|
238
245
|
- lib/elastic_apm/util/throttle.rb
|
239
246
|
- lib/elastic_apm/version.rb
|
240
247
|
homepage: https://github.com/elastic/apm-agent-ruby
|
@@ -257,7 +264,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
257
264
|
- !ruby/object:Gem::Version
|
258
265
|
version: '0'
|
259
266
|
requirements: []
|
260
|
-
rubygems_version: 3.1.
|
267
|
+
rubygems_version: 3.1.4
|
261
268
|
signing_key:
|
262
269
|
specification_version: 4
|
263
270
|
summary: The official Elastic APM agent for Ruby
|