scout_apm 1.4.0 → 1.4.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
  SHA1:
3
- metadata.gz: 7f5e033e72a264b660c2a76d6f188ddd641fa653
4
- data.tar.gz: 359ed424119b0624dc0b87768c1e413924850dee
3
+ metadata.gz: ecdf92000eedbccd7433a68129281cd82847556c
4
+ data.tar.gz: e703b9dfa3aaf7f2a048ff31b9e6c66777dd3a35
5
5
  SHA512:
6
- metadata.gz: 41ebbedfe2b1fad421c6db1e34f00710420fa774b152415a32941360011e458b8a07c3e0ad89f39257121960c21a49775a42fe2101f4af17b2fe27cb52e3092f
7
- data.tar.gz: b155a159cf08da79680f228a53572bdc9b7359e460ceccb317cfb69b4635f715de6a540134b55f5529b0834749a71040cff3ebe999ca9b05421eec09c3bca3ba
6
+ metadata.gz: ceadce82ba6554b9217f5fc7d99b6f949db06d59c53f5728a48b23c6cba78a0ee068ad56cb04272879d35bd935fa1bf739fa93ed5618be96f57f3b3ebbf8aa3b
7
+ data.tar.gz: d75d311f1304aeecfa3b3be98ca3dc7874ba7d932c5a389f3b879f8d9dfca5b5ef782cc3bae5959d7d5ff0be7b461252046d19c33ce7943828d80e087f203ee1
data/CHANGELOG.markdown CHANGED
@@ -1,3 +1,7 @@
1
+ # 1.4.1
2
+
3
+ * Fix JSON encoding of special characters
4
+
1
5
  # 1.4.0
2
6
 
3
7
  * Release JSON reporting
@@ -31,20 +31,18 @@ module ScoutApm
31
31
  "{#{str_parts.join(",")}}"
32
32
  end
33
33
 
34
+ ESCAPE_MAPPINGS = {
35
+ "\b" => '\\b',
36
+ "\t" => '\\t',
37
+ "\n" => '\\n',
38
+ "\f" => '\\f',
39
+ "\r" => '\\r',
40
+ '"' => '\\"',
41
+ '\\' => '\\\\',
42
+ }
43
+
34
44
  def escape(string)
35
- string = string.to_s
36
- escapers = {
37
- '\b' => '\\b',
38
- '\t' => '\\t',
39
- '\n' => '\\n',
40
- '\f' => '\\f',
41
- '\r' => '\\r',
42
- '"' => '\\"',
43
- '\\' => '\\\\'
44
- }
45
- # TODO escape control chars
46
- escapers.each {|bad, good| string = string.gsub(bad, good)}
47
- string
45
+ ESCAPE_MAPPINGS.inject(string.to_s) {|s, (bad, good)| s.gsub(bad, good) }
48
46
  end
49
47
 
50
48
  def format_by_type(formatee)
@@ -1,4 +1,4 @@
1
1
  module ScoutApm
2
- VERSION = "1.4.0"
2
+ VERSION = "1.4.1"
3
3
  end
4
4
 
@@ -116,7 +116,7 @@ class PayloadSerializerTest < Minitest::Test
116
116
  def test_serializes_slow_transactions_as_json
117
117
  slow_transaction_metrics = {
118
118
  ScoutApm::MetricMeta.new('ActiveRecord/all').tap { |meta|
119
- meta.desc = "SELECT * from users where filter=?"
119
+ meta.desc = "SELECT *\nfrom users where filter=?"
120
120
  meta.extra = {:user => 'cooluser'}
121
121
  meta.metric_id = nil
122
122
  meta.scope = "Controller/apps/checkin"
@@ -163,7 +163,7 @@ class PayloadSerializerTest < Minitest::Test
163
163
  "key" => {
164
164
  "bucket" => "ActiveRecord",
165
165
  "name" => "all",
166
- "desc" => "SELECT * from users where filter=?",
166
+ "desc" => "SELECT *\nfrom users where filter=?",
167
167
  "extra" => {
168
168
  "user" => "cooluser",
169
169
  },
@@ -195,6 +195,7 @@ class PayloadSerializerTest < Minitest::Test
195
195
  ]
196
196
  }
197
197
  ]
198
+
198
199
  assert_equal formatted_slow_transactions, JSON.parse(payload)["slow_transactions"]
199
200
  end
200
201
 
@@ -212,4 +213,9 @@ class PayloadSerializerTest < Minitest::Test
212
213
  }
213
214
  assert_equal formatted_metadata, JSON.parse(payload)["metadata"]
214
215
  end
216
+
217
+ def test_escapes_newlines
218
+ json = { "foo" => "\bbar\nbaz\r" }
219
+ assert_equal json, JSON.parse(ScoutApm::Serializers::PayloadSerializerToJson.jsonify_hash(json))
220
+ end
215
221
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scout_apm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Derek Haynes
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-02-16 00:00:00.000000000 Z
12
+ date: 2016-02-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: minitest