elastic-apm 3.12.0 → 3.12.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0c810b4e9b4f1149873235af4d1ddd6b4a85acf7734c491a42d21777443d57a0
4
- data.tar.gz: f63af16c444a3a5499cd9246b1d11bba2cd9a7a31efed58bfd23d5b1c8b3e0d3
3
+ metadata.gz: de9bb2ac6873a987cb7c7d0cdf51f8c11908d0d3ada729bd21bb4bc24d3aa3dc
4
+ data.tar.gz: 571507faa100bb620c116dbe11bdcad1b958c718c89a7f8572732ef3939ad70f
5
5
  SHA512:
6
- metadata.gz: ed48f7f3870b346a17ec5e263c90c67f68b1f355a4900c3a79ae998bf689b1b549e6658d7c4165b934091669734bea561acf9991b82446a6ca4164558a488301
7
- data.tar.gz: f87f347bf3a72e8d331e95d95ceca640d12754cb049ce4c39097b03b75d022c347f95062d3e311e0fb0cbc90f61050449ed1bd6f39f8682c95e935fccf7509f9
6
+ metadata.gz: 916cfb05143133cf1c0680d2495f2877997d607cac710063d3862acf62105d256434f0e3f9170599fa5d6c2a59c80ff39dace42584a0cce493b5f476ad6e8e5e
7
+ data.tar.gz: af7f87595e02ec5996c7a1ecf5aac7e7deb376ae4a32d30c250ad6293be3ce086a8a64074e88b79f6dcb2ce52b1c9861e7d7031119da58026bfff9e2ca841eb4
@@ -35,6 +35,14 @@ endif::[]
35
35
  [[release-notes-3.x]]
36
36
  === Ruby Agent version 3.x
37
37
 
38
+ [[release-notes-3.12.1]]
39
+ ==== 3.12.1 (2020-11-16)
40
+
41
+ [float]
42
+ ===== Fixed
43
+
44
+ - `capture_elasticsearch_queries` no longer modifies the original query {pull}894[#894]
45
+
38
46
  [[release-notes-3.12.0]]
39
47
  ==== 3.12.0 (2020-11-10)
40
48
 
@@ -73,7 +73,7 @@ module ElasticAPM
73
73
  def fetch_aws
74
74
  resp = @client.get(AWS_URI)
75
75
 
76
- return unless resp.status === 200
76
+ return unless resp.status == 200
77
77
  return unless (metadata = JSON.parse(resp.body))
78
78
 
79
79
  self.provider = "aws"
@@ -89,7 +89,7 @@ module ElasticAPM
89
89
  def fetch_gcp
90
90
  resp = @client.headers("Metadata-Flavor" => "Google").get(GCP_URI)
91
91
 
92
- return unless resp.status === 200
92
+ return unless resp.status == 200
93
93
  return unless (metadata = JSON.parse(resp.body))
94
94
 
95
95
  zone = metadata["instance"]["zone"]&.split("/")&.at(-1)
@@ -109,7 +109,7 @@ module ElasticAPM
109
109
  def fetch_azure
110
110
  resp = @client.headers("Metadata" => "true").get(AZURE_URI)
111
111
 
112
- return unless resp.status === 200
112
+ return unless resp.status == 200
113
113
  return unless (metadata = JSON.parse(resp.body))
114
114
 
115
115
  self.provider = 'azure'
@@ -53,7 +53,7 @@ module ElasticAPM
53
53
  if ElasticAPM.agent.config.capture_elasticsearch_queries
54
54
  unless args[1].nil? || args[1].empty?
55
55
  statement << {
56
- body: ElasticAPM::Spies::ElasticsearchSpy.sanitizer.strip_from!(args[1])
56
+ body: ElasticAPM::Spies::ElasticsearchSpy.sanitizer.strip_from(args[1])
57
57
  }
58
58
  end
59
59
  end
@@ -17,6 +17,8 @@
17
17
 
18
18
  # frozen_string_literal: true
19
19
 
20
+ require 'elastic_apm/util/deep_dup'
21
+
20
22
  module ElasticAPM
21
23
  module Transport
22
24
  module Filters
@@ -38,6 +40,10 @@ module ElasticAPM
38
40
 
39
41
  attr_accessor :key_patterns
40
42
 
43
+ def strip_from(obj)
44
+ strip_from!(Util::DeepDup.dup(obj))
45
+ end
46
+
41
47
  def strip_from!(obj)
42
48
  return unless obj&.is_a?(Hash)
43
49
 
@@ -38,7 +38,9 @@ module ElasticAPM
38
38
  @sanitizer.strip_from! payload.dig(:transaction, :context, :request, :env)
39
39
  @sanitizer.strip_from! payload.dig(:transaction, :context, :request, :headers)
40
40
  @sanitizer.strip_from! payload.dig(:transaction, :context, :response, :headers)
41
+ @sanitizer.strip_from! payload.dig(:error, :context, :request, :body)
41
42
  @sanitizer.strip_from! payload.dig(:error, :context, :request, :cookies)
43
+ @sanitizer.strip_from! payload.dig(:error, :context, :request, :env)
42
44
  @sanitizer.strip_from! payload.dig(:error, :context, :request, :headers)
43
45
  @sanitizer.strip_from! payload.dig(:error, :context, :response, :headers)
44
46
 
@@ -0,0 +1,66 @@
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
66
+
@@ -18,5 +18,5 @@
18
18
  # frozen_string_literal: true
19
19
 
20
20
  module ElasticAPM
21
- VERSION = '3.12.0'
21
+ VERSION = '3.12.1'
22
22
  end
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.12.0
4
+ version: 3.12.1
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-10 00:00:00.000000000 Z
11
+ date: 2020-11-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -235,6 +235,7 @@ files:
235
235
  - lib/elastic_apm/transport/user_agent.rb
236
236
  - lib/elastic_apm/transport/worker.rb
237
237
  - lib/elastic_apm/util.rb
238
+ - lib/elastic_apm/util/deep_dup.rb
238
239
  - lib/elastic_apm/util/inflector.rb
239
240
  - lib/elastic_apm/util/lru_cache.rb
240
241
  - lib/elastic_apm/util/precision_validator.rb
@@ -260,7 +261,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
260
261
  - !ruby/object:Gem::Version
261
262
  version: '0'
262
263
  requirements: []
263
- rubygems_version: 3.0.6
264
+ rubygems_version: 3.1.4
264
265
  signing_key:
265
266
  specification_version: 4
266
267
  summary: The official Elastic APM agent for Ruby