elastic-apm 3.5.0 → 3.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ci/Jenkinsfile +286 -183
- data/.ci/docker/jruby/11-jdk/Dockerfile +40 -0
- data/.ci/docker/jruby/12-jdk/Dockerfile +40 -0
- data/.ci/docker/jruby/13-jdk/Dockerfile +40 -0
- data/.ci/docker/jruby/7-jdk/Dockerfile +40 -0
- data/.ci/docker/jruby/8-jdk/Dockerfile +40 -0
- data/.ci/docker/jruby/README.md +31 -0
- data/.ci/docker/jruby/run.sh +73 -0
- data/.ci/docker/jruby/test.sh +13 -0
- data/.ci/jobs/defaults.yml +1 -1
- data/.ci/packer_cache.sh +12 -10
- data/.gitignore +3 -1
- data/.rspec +0 -1
- data/.rubocop.yml +13 -1
- data/CHANGELOG.asciidoc +92 -0
- data/CONTRIBUTING.md +6 -4
- data/Gemfile +35 -9
- data/Rakefile +37 -5
- data/bin/run-tests +4 -1
- data/docker-compose.yml +7 -0
- data/docs/api.asciidoc +14 -2
- data/docs/configuration.asciidoc +122 -27
- data/docs/debugging.asciidoc +14 -0
- data/docs/getting-started-rails.asciidoc +2 -0
- data/docs/graphql.asciidoc +23 -0
- data/docs/images/dynamic-config.svg +1 -0
- data/docs/index.asciidoc +6 -1
- data/docs/introduction.asciidoc +2 -1
- data/docs/performance-tuning.asciidoc +106 -0
- data/docs/set-up.asciidoc +5 -2
- data/docs/supported-technologies.asciidoc +68 -1
- data/docs/upgrading.asciidoc +45 -0
- data/elastic-apm.gemspec +17 -0
- data/lib/elastic-apm.rb +17 -0
- data/lib/elastic_apm.rb +29 -0
- data/lib/elastic_apm/agent.rb +48 -2
- data/lib/elastic_apm/central_config.rb +27 -8
- data/lib/elastic_apm/central_config/cache_control.rb +17 -0
- data/lib/elastic_apm/child_durations.rb +17 -0
- data/lib/elastic_apm/config.rb +59 -3
- data/lib/elastic_apm/config/bytes.rb +17 -0
- data/lib/elastic_apm/config/duration.rb +17 -0
- data/lib/elastic_apm/config/options.rb +18 -1
- data/lib/elastic_apm/config/regexp_list.rb +17 -0
- data/lib/elastic_apm/config/wildcard_pattern_list.rb +28 -1
- data/lib/elastic_apm/context.rb +17 -0
- data/lib/elastic_apm/context/request.rb +17 -0
- data/lib/elastic_apm/context/request/socket.rb +17 -0
- data/lib/elastic_apm/context/request/url.rb +17 -0
- data/lib/elastic_apm/context/response.rb +17 -0
- data/lib/elastic_apm/context/user.rb +17 -0
- data/lib/elastic_apm/context_builder.rb +18 -1
- data/lib/elastic_apm/deprecations.rb +17 -0
- data/lib/elastic_apm/error.rb +17 -0
- data/lib/elastic_apm/error/exception.rb +17 -0
- data/lib/elastic_apm/error/log.rb +17 -0
- data/lib/elastic_apm/error_builder.rb +17 -0
- data/lib/elastic_apm/grape.rb +17 -0
- data/lib/elastic_apm/graphql.rb +91 -0
- data/lib/elastic_apm/grpc.rb +99 -0
- data/lib/elastic_apm/instrumenter.rb +29 -4
- data/lib/elastic_apm/internal_error.rb +17 -0
- data/lib/elastic_apm/logging.rb +17 -0
- data/lib/elastic_apm/metadata.rb +17 -0
- data/lib/elastic_apm/metadata/process_info.rb +17 -0
- data/lib/elastic_apm/metadata/service_info.rb +22 -2
- data/lib/elastic_apm/metadata/system_info.rb +22 -3
- data/lib/elastic_apm/metadata/system_info/container_info.rb +45 -4
- data/lib/elastic_apm/metrics.rb +33 -1
- data/lib/elastic_apm/metrics/breakdown_set.rb +17 -0
- data/lib/elastic_apm/metrics/cpu_mem_set.rb +17 -0
- data/lib/elastic_apm/metrics/metric.rb +17 -0
- data/lib/elastic_apm/metrics/set.rb +17 -0
- data/lib/elastic_apm/metrics/span_scoped_set.rb +17 -0
- data/lib/elastic_apm/metrics/transaction_set.rb +17 -0
- data/lib/elastic_apm/metrics/vm_set.rb +17 -0
- data/lib/elastic_apm/metricset.rb +17 -0
- data/lib/elastic_apm/middleware.rb +25 -2
- data/lib/elastic_apm/naively_hashable.rb +17 -0
- data/lib/elastic_apm/normalizers.rb +17 -0
- data/lib/elastic_apm/normalizers/grape.rb +17 -0
- data/lib/elastic_apm/normalizers/grape/endpoint_run.rb +18 -1
- data/lib/elastic_apm/normalizers/rails.rb +17 -0
- data/lib/elastic_apm/normalizers/rails/action_controller.rb +17 -0
- data/lib/elastic_apm/normalizers/rails/action_mailer.rb +17 -0
- data/lib/elastic_apm/normalizers/rails/action_view.rb +17 -0
- data/lib/elastic_apm/normalizers/rails/active_record.rb +17 -0
- data/lib/elastic_apm/opentracing.rb +64 -23
- data/lib/elastic_apm/rails.rb +17 -0
- data/lib/elastic_apm/railtie.rb +17 -0
- data/lib/elastic_apm/resque.rb +29 -0
- data/lib/elastic_apm/sinatra.rb +17 -0
- data/lib/elastic_apm/span.rb +20 -2
- data/lib/elastic_apm/span/context.rb +17 -0
- data/lib/elastic_apm/span/context/db.rb +17 -0
- data/lib/elastic_apm/span/context/destination.rb +37 -4
- data/lib/elastic_apm/span/context/http.rb +17 -0
- data/lib/elastic_apm/span_helpers.rb +17 -0
- data/lib/elastic_apm/spies.rb +33 -14
- data/lib/elastic_apm/spies/action_dispatch.rb +17 -0
- data/lib/elastic_apm/spies/delayed_job.rb +17 -0
- data/lib/elastic_apm/spies/dynamo_db.rb +58 -0
- data/lib/elastic_apm/spies/elasticsearch.rb +37 -2
- data/lib/elastic_apm/spies/faraday.rb +17 -0
- data/lib/elastic_apm/spies/http.rb +17 -0
- data/lib/elastic_apm/spies/json.rb +17 -0
- data/lib/elastic_apm/spies/mongo.rb +18 -1
- data/lib/elastic_apm/spies/net_http.rb +23 -2
- data/lib/elastic_apm/spies/rake.rb +17 -0
- data/lib/elastic_apm/spies/redis.rb +17 -0
- data/lib/elastic_apm/spies/resque.rb +53 -0
- data/lib/elastic_apm/spies/sequel.rb +18 -1
- data/lib/elastic_apm/spies/shoryuken.rb +17 -0
- data/lib/elastic_apm/spies/sidekiq.rb +17 -0
- data/lib/elastic_apm/spies/sinatra.rb +17 -0
- data/lib/elastic_apm/spies/sneakers.rb +17 -0
- data/lib/elastic_apm/spies/sucker_punch.rb +54 -0
- data/lib/elastic_apm/spies/tilt.rb +17 -0
- data/lib/elastic_apm/sql.rb +21 -4
- data/lib/elastic_apm/sql/signature.rb +17 -0
- data/lib/elastic_apm/sql/tokenizer.rb +17 -0
- data/lib/elastic_apm/sql/tokens.rb +17 -0
- data/lib/elastic_apm/sql_summarizer.rb +17 -0
- data/lib/elastic_apm/stacktrace.rb +17 -0
- data/lib/elastic_apm/stacktrace/frame.rb +17 -0
- data/lib/elastic_apm/stacktrace_builder.rb +23 -1
- data/lib/elastic_apm/subscriber.rb +17 -0
- data/lib/elastic_apm/trace_context.rb +51 -11
- data/lib/elastic_apm/trace_context/traceparent.rb +17 -0
- data/lib/elastic_apm/trace_context/tracestate.rb +17 -0
- data/lib/elastic_apm/transaction.rb +33 -5
- data/lib/elastic_apm/transport/base.rb +39 -23
- data/lib/elastic_apm/transport/connection.rb +17 -0
- data/lib/elastic_apm/transport/connection/http.rb +17 -0
- data/lib/elastic_apm/transport/connection/proxy_pipe.rb +22 -0
- data/lib/elastic_apm/transport/filters.rb +17 -0
- data/lib/elastic_apm/transport/filters/hash_sanitizer.rb +77 -0
- data/lib/elastic_apm/transport/filters/secrets_filter.rb +29 -56
- data/lib/elastic_apm/transport/headers.rb +17 -0
- data/lib/elastic_apm/transport/serializers.rb +17 -0
- data/lib/elastic_apm/transport/serializers/context_serializer.rb +17 -0
- data/lib/elastic_apm/transport/serializers/error_serializer.rb +17 -0
- data/lib/elastic_apm/transport/serializers/metadata_serializer.rb +44 -20
- data/lib/elastic_apm/transport/serializers/metricset_serializer.rb +17 -0
- data/lib/elastic_apm/transport/serializers/span_serializer.rb +20 -1
- data/lib/elastic_apm/transport/serializers/transaction_serializer.rb +17 -0
- data/lib/elastic_apm/transport/user_agent.rb +17 -0
- data/lib/elastic_apm/transport/worker.rb +21 -0
- data/lib/elastic_apm/util.rb +17 -0
- data/lib/elastic_apm/util/inflector.rb +17 -0
- data/lib/elastic_apm/util/lru_cache.rb +17 -0
- data/lib/elastic_apm/util/throttle.rb +17 -0
- data/lib/elastic_apm/version.rb +18 -1
- metadata +26 -12
- data/.ci/downstreamTests.groovy +0 -185
- data/.ci/prepare-git-context.sh +0 -27
- data/CHANGELOG.md +0 -1
- data/codecov.yml +0 -32
@@ -1,3 +1,20 @@
|
|
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
|
+
|
1
18
|
# frozen_string_literal: true
|
2
19
|
|
3
20
|
require 'elastic_apm/central_config/cache_control'
|
@@ -81,15 +98,16 @@ module ElasticAPM
|
|
81
98
|
update[key] = @modified_options.delete(key)
|
82
99
|
end
|
83
100
|
|
84
|
-
|
101
|
+
@config.replace_options(update)
|
85
102
|
end
|
86
103
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
@config = config.dup.tap { |new_config| new_config.assign(new_options) }
|
104
|
+
def handle_forking!
|
105
|
+
stop
|
106
|
+
start
|
91
107
|
end
|
92
108
|
|
109
|
+
private
|
110
|
+
|
93
111
|
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
94
112
|
def handle_success(resp)
|
95
113
|
if (etag = resp.headers['Etag'])
|
@@ -104,9 +122,10 @@ module ElasticAPM
|
|
104
122
|
assign(update)
|
105
123
|
end
|
106
124
|
|
107
|
-
if
|
125
|
+
if update && update.any?
|
108
126
|
info 'Updated config from Kibana'
|
109
|
-
debug 'Modified: %s',
|
127
|
+
debug 'Modified: %s', update.inspect
|
128
|
+
debug 'Modified original options: %s', @modified_options.inspect
|
110
129
|
end
|
111
130
|
end
|
112
131
|
|
@@ -151,7 +170,7 @@ module ElasticAPM
|
|
151
170
|
def schedule_next_fetch(resp = nil)
|
152
171
|
headers = resp&.headers
|
153
172
|
seconds =
|
154
|
-
if headers['Cache-Control']
|
173
|
+
if headers && headers['Cache-Control']
|
155
174
|
CacheControl.new(headers['Cache-Control']).max_age
|
156
175
|
else
|
157
176
|
DEFAULT_MAX_AGE
|
@@ -1,3 +1,20 @@
|
|
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
|
+
|
1
18
|
# frozen_string_literal: true
|
2
19
|
|
3
20
|
module ElasticAPM
|
@@ -1,3 +1,20 @@
|
|
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
|
+
|
1
18
|
# frozen_string_literal: true
|
2
19
|
|
3
20
|
module ElasticAPM
|
data/lib/elastic_apm/config.rb
CHANGED
@@ -1,3 +1,20 @@
|
|
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
|
+
|
1
18
|
# frozen_string_literal: true
|
2
19
|
|
3
20
|
require 'elastic_apm/config/options'
|
@@ -19,13 +36,13 @@ module ElasticAPM
|
|
19
36
|
option :secret_token, type: :string
|
20
37
|
option :api_key, type: :string
|
21
38
|
|
22
|
-
option :active, type: :bool, default: true
|
23
39
|
option :api_buffer_size, type: :int, default: 256
|
24
40
|
option :api_request_size, type: :bytes, default: '750kb', converter: Bytes.new
|
25
41
|
option :api_request_time, type: :float, default: '10s', converter: Duration.new
|
26
42
|
option :breakdown_metrics, type: :bool, default: true
|
27
43
|
option :capture_body, type: :string, default: 'off'
|
28
44
|
option :capture_headers, type: :bool, default: true
|
45
|
+
option :capture_elasticsearch_queries, type: :bool, default: false
|
29
46
|
option :capture_env, type: :bool, default: true
|
30
47
|
option :central_config, type: :bool, default: true
|
31
48
|
option :current_user_email_method, type: :string, default: 'email'
|
@@ -38,6 +55,7 @@ module ElasticAPM
|
|
38
55
|
option :disable_start_message, type: :bool, default: false
|
39
56
|
option :disable_instrumentations, type: :list, default: %w[json]
|
40
57
|
option :disabled_spies, type: :list, default: []
|
58
|
+
option :enabled, type: :bool, default: true
|
41
59
|
option :environment, type: :string, default: ENV['RAILS_ENV'] || ENV['RACK_ENV']
|
42
60
|
option :framework_name, type: :string
|
43
61
|
option :framework_version, type: :string
|
@@ -57,9 +75,11 @@ module ElasticAPM
|
|
57
75
|
option :proxy_password, type: :string
|
58
76
|
option :proxy_port, type: :int
|
59
77
|
option :proxy_username, type: :string
|
78
|
+
option :recording, type: :bool, default: true
|
60
79
|
option :sanitize_field_names, type: :list, default: [], converter: WildcardPatternList.new
|
61
80
|
option :server_ca_cert, type: :string
|
62
81
|
option :service_name, type: :string
|
82
|
+
option :service_node_name, type: :string
|
63
83
|
option :service_version, type: :string
|
64
84
|
option :source_lines_error_app_frames, type: :int, default: 5
|
65
85
|
option :source_lines_error_library_frames, type: :int, default: 0
|
@@ -67,10 +87,11 @@ module ElasticAPM
|
|
67
87
|
option :source_lines_span_library_frames, type: :int, default: 0
|
68
88
|
option :span_frames_min_duration, type: :float, default: '5ms', converter: Duration.new(default_unit: 'ms')
|
69
89
|
option :stack_trace_limit, type: :int, default: 999_999
|
90
|
+
option :transaction_ignore_urls, type: :list, default: [], converter: WildcardPatternList.new
|
70
91
|
option :transaction_max_spans, type: :int, default: 500
|
71
92
|
option :transaction_sample_rate, type: :float, default: 1.0
|
72
93
|
option :use_elastic_traceparent_header, type: :bool, default: true
|
73
|
-
option :
|
94
|
+
option :use_legacy_sql_parser, type: :bool, default: false
|
74
95
|
option :verify_server_cert, type: :bool, default: true
|
75
96
|
|
76
97
|
# rubocop:enable Metrics/LineLength, Layout/ExtraSpacing
|
@@ -111,6 +132,7 @@ module ElasticAPM
|
|
111
132
|
%w[
|
112
133
|
action_dispatch
|
113
134
|
delayed_job
|
135
|
+
dynamo_db
|
114
136
|
elasticsearch
|
115
137
|
faraday
|
116
138
|
http
|
@@ -119,11 +141,13 @@ module ElasticAPM
|
|
119
141
|
net_http
|
120
142
|
rake
|
121
143
|
redis
|
144
|
+
resque
|
122
145
|
sequel
|
123
146
|
shoryuken
|
124
147
|
sidekiq
|
125
148
|
sinatra
|
126
149
|
sneakers
|
150
|
+
sucker_punch
|
127
151
|
tilt
|
128
152
|
]
|
129
153
|
end
|
@@ -137,6 +161,15 @@ module ElasticAPM
|
|
137
161
|
warn "The option `#{name}' has been removed."
|
138
162
|
end
|
139
163
|
|
164
|
+
def replace_options(new_options)
|
165
|
+
return if new_options.nil? || new_options.empty?
|
166
|
+
options_copy = @options.dup
|
167
|
+
new_options.each do |key, value|
|
168
|
+
options_copy.fetch(key.to_sym).set(value)
|
169
|
+
end
|
170
|
+
@options = options_copy
|
171
|
+
end
|
172
|
+
|
140
173
|
def app=(app)
|
141
174
|
case app_type?(app)
|
142
175
|
when :sinatra
|
@@ -202,6 +235,13 @@ module ElasticAPM
|
|
202
235
|
self.default_labels = value
|
203
236
|
end
|
204
237
|
|
238
|
+
def ignore_url_patterns=(value)
|
239
|
+
warn '[DEPRECATED] The option ignore_url_patterns is being removed. ' \
|
240
|
+
'Consider using transaction_ignore_urls instead.'
|
241
|
+
|
242
|
+
set(:ignore_url_patterns, value)
|
243
|
+
end
|
244
|
+
|
205
245
|
def custom_key_filters=(value)
|
206
246
|
unless value == self.class.schema[:custom_key_filters][:default]
|
207
247
|
warn '[DEPRECATED] The option custom_key_filters is being removed. ' \
|
@@ -215,12 +255,28 @@ module ElasticAPM
|
|
215
255
|
disable_instrumentations
|
216
256
|
end
|
217
257
|
|
258
|
+
def active
|
259
|
+
enabled
|
260
|
+
end
|
261
|
+
alias active? active
|
262
|
+
|
218
263
|
def disabled_instrumentations=(value)
|
219
264
|
warn '[DEPRECATED] The option disabled_instrumentations has been ' \
|
220
265
|
'renamed to disable_instrumentations to align with other agents.'
|
221
266
|
self.disable_instrumentations = value
|
222
267
|
end
|
223
268
|
|
269
|
+
def use_experimental_sql_parser=(value)
|
270
|
+
warn '[DEPRECATED] The new SQL parser is now the default. To use the old one, '
|
271
|
+
'use use_legacy_sql_parser and please report why you wish to do so.'
|
272
|
+
end
|
273
|
+
|
274
|
+
def active=(value)
|
275
|
+
warn '[DEPRECATED] The option active has been renamed to enabled ' \
|
276
|
+
'to align with other agents and with the remote config.'
|
277
|
+
self.enabled = value
|
278
|
+
end
|
279
|
+
|
224
280
|
private
|
225
281
|
|
226
282
|
def load_config_file
|
@@ -270,7 +326,7 @@ module ElasticAPM
|
|
270
326
|
self.logger ||= ::Rails.logger
|
271
327
|
|
272
328
|
self.__root_path = ::Rails.root.to_s
|
273
|
-
self.__view_paths = app.config.paths['app/views'].existent
|
329
|
+
self.__view_paths = app.config.paths['app/views'].existent + [::Rails.root.to_s]
|
274
330
|
end
|
275
331
|
|
276
332
|
def rails_app_name(app)
|
@@ -1,3 +1,20 @@
|
|
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
|
+
|
1
18
|
# frozen_string_literal: true
|
2
19
|
|
3
20
|
module ElasticAPM
|
@@ -1,3 +1,20 @@
|
|
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
|
+
|
1
18
|
# frozen_string_literal: true
|
2
19
|
|
3
20
|
module ElasticAPM
|
@@ -1,3 +1,20 @@
|
|
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
|
+
|
1
18
|
# frozen_string_literal: true
|
2
19
|
|
3
20
|
module ElasticAPM
|
@@ -35,7 +52,7 @@ module ElasticAPM
|
|
35
52
|
|
36
53
|
# rubocop:disable Metrics/CyclomaticComplexity
|
37
54
|
def normalize(val)
|
38
|
-
return
|
55
|
+
return if val.nil?
|
39
56
|
|
40
57
|
if @converter
|
41
58
|
return @converter.call(val)
|
@@ -1,3 +1,20 @@
|
|
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
|
+
|
1
18
|
# frozen_string_literal: true
|
2
19
|
|
3
20
|
module ElasticAPM
|
@@ -1,3 +1,20 @@
|
|
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
|
+
|
1
18
|
# frozen_string_literal: true
|
2
19
|
|
3
20
|
module ElasticAPM
|
@@ -19,12 +36,22 @@ module ElasticAPM
|
|
19
36
|
private
|
20
37
|
|
21
38
|
def convert(str)
|
39
|
+
case_sensitive = false
|
40
|
+
|
41
|
+
if str.start_with?('(?-i)')
|
42
|
+
str = str.gsub(/^\(\?-\i\)/, '')
|
43
|
+
case_sensitive = true
|
44
|
+
end
|
45
|
+
|
22
46
|
parts =
|
23
47
|
str.chars.each_with_object([]) do |char, arr|
|
24
48
|
arr << (char == '*' ? '.*' : Regexp.escape(char))
|
25
49
|
end
|
26
50
|
|
27
|
-
Regexp.new(
|
51
|
+
Regexp.new(
|
52
|
+
'\A' + parts.join + '\Z',
|
53
|
+
case_sensitive ? nil : Regexp::IGNORECASE
|
54
|
+
)
|
28
55
|
end
|
29
56
|
end
|
30
57
|
|
data/lib/elastic_apm/context.rb
CHANGED
@@ -1,3 +1,20 @@
|
|
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
|
+
|
1
18
|
# frozen_string_literal: true
|
2
19
|
|
3
20
|
require 'elastic_apm/context/request'
|
@@ -1,3 +1,20 @@
|
|
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
|
+
|
1
18
|
# frozen_string_literal: true
|
2
19
|
|
3
20
|
module ElasticAPM
|
@@ -1,3 +1,20 @@
|
|
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
|
+
|
1
18
|
# frozen_string_literal: true
|
2
19
|
|
3
20
|
module ElasticAPM
|