honeycomb-beeline 2.4.1 → 2.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.circleci/bundler_version.sh +4 -0
- data/.circleci/config.yml +50 -33
- data/.gitignore +1 -0
- data/.rspec +4 -0
- data/CHANGELOG.md +9 -0
- data/Gemfile.lock +6 -3
- data/honeycomb-beeline.gemspec +1 -0
- data/lib/honeycomb/beeline/version.rb +1 -1
- data/lib/honeycomb/integrations/rack.rb +12 -5
- data/lib/honeycomb/integrations/rails.rb +10 -0
- data/lib/honeycomb/integrations/redis.rb +92 -93
- metadata +16 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d99297b1c5e39a9a250cc298aac8282da89dc29247d2ea03567111f47001d14e
|
|
4
|
+
data.tar.gz: 78233609ea887df63e5890476e8bae8b62e904db968f429d22c8562eaa62204e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4745aa8377bcd8fc7665431754d5e8e7f6ec067c8cb157d6ea463b8270b46b1fd87206432e2b8b0a68cbd3465914479c31dd185d2888087173da26f0cfa276fc
|
|
7
|
+
data.tar.gz: 397aa8cd262415e7e1a83fb135b01e18d40a73f924a6526a7d4b5974cc9aef8e82a96906b0d6b8246cfcb45bcf474f5854f81c98766080cb29040736f3453f60
|
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
set -ux
|
|
4
4
|
|
|
5
5
|
if [[ "$BUNDLE_GEMFILE" =~ (rails_41.gemfile|rails_42.gemfile)$ ]]; then
|
|
6
|
+
echo "Rails 4.1 and 4.2 require an old Bundler"
|
|
6
7
|
gem uninstall -v '>= 2' -ax bundler
|
|
7
8
|
gem install bundler -v '< 2'
|
|
9
|
+
else
|
|
10
|
+
echo "Get the latest Bundler"
|
|
11
|
+
gem update bundler
|
|
8
12
|
fi
|
data/.circleci/config.yml
CHANGED
|
@@ -6,7 +6,6 @@ commands:
|
|
|
6
6
|
type: string
|
|
7
7
|
gemfile:
|
|
8
8
|
type: string
|
|
9
|
-
default: Gemfile
|
|
10
9
|
command:
|
|
11
10
|
type: string
|
|
12
11
|
default: bundle exec rake test
|
|
@@ -14,16 +13,19 @@ commands:
|
|
|
14
13
|
- checkout
|
|
15
14
|
- restore_cache:
|
|
16
15
|
keys:
|
|
17
|
-
- gems-v1-<< parameters.ruby-version >>-{{ checksum "Gemfile.lock" }}
|
|
16
|
+
- gems-v1-<< parameters.ruby-version >>-<< parameters.gemfile >>-{{ checksum "Gemfile.lock" }}
|
|
17
|
+
- gems-v1-<< parameters.ruby-version >>-<< parameters.gemfile >>
|
|
18
18
|
- gems-v1-<< parameters.ruby-version >>
|
|
19
|
-
- run:
|
|
20
|
-
- run:
|
|
21
|
-
- run:
|
|
19
|
+
- run: .circleci/bundler_version.sh
|
|
20
|
+
- run: bundle config set --local path $HOME/project/vendor/bundle
|
|
21
|
+
- run: bundle install --jobs=4 --retry=3
|
|
22
|
+
- run: bundle clean --force
|
|
23
|
+
- run: bundle env
|
|
22
24
|
- save_cache:
|
|
23
25
|
paths:
|
|
24
26
|
- ./vendor/bundle
|
|
25
|
-
key: gems-v1-<< parameters.ruby-version >>-{{ checksum "Gemfile.lock" }}
|
|
26
|
-
- run:
|
|
27
|
+
key: gems-v1-<< parameters.ruby-version >>-<< parameters.gemfile >>-{{ checksum "Gemfile.lock" }}
|
|
28
|
+
- run: << parameters.command >>
|
|
27
29
|
|
|
28
30
|
jobs:
|
|
29
31
|
build_artifacts:
|
|
@@ -80,9 +82,12 @@ jobs:
|
|
|
80
82
|
default: "2.6"
|
|
81
83
|
docker:
|
|
82
84
|
- image: circleci/ruby:<< parameters.ruby-version >>
|
|
85
|
+
environment:
|
|
86
|
+
BUNDLE_GEMFILE: ./Gemfile
|
|
83
87
|
steps:
|
|
84
88
|
- ruby:
|
|
85
89
|
ruby-version: << parameters.ruby-version >>
|
|
90
|
+
gemfile: root
|
|
86
91
|
command: bundle exec rake rubocop
|
|
87
92
|
test:
|
|
88
93
|
parameters:
|
|
@@ -92,11 +97,15 @@ jobs:
|
|
|
92
97
|
type: string
|
|
93
98
|
docker:
|
|
94
99
|
- image: circleci/ruby:<< parameters.ruby-version >>
|
|
100
|
+
environment:
|
|
101
|
+
BUNDLE_GEMFILE: gemfiles/<< parameters.gemfile >>.gemfile
|
|
95
102
|
steps:
|
|
96
103
|
- ruby:
|
|
97
104
|
ruby-version: << parameters.ruby-version >>
|
|
98
105
|
gemfile: << parameters.gemfile >>
|
|
99
106
|
command: bundle exec rake test
|
|
107
|
+
- store_test_results:
|
|
108
|
+
path: test/reports
|
|
100
109
|
|
|
101
110
|
workflows:
|
|
102
111
|
nightly:
|
|
@@ -110,49 +119,57 @@ workflows:
|
|
|
110
119
|
jobs:
|
|
111
120
|
- lint
|
|
112
121
|
- test: &test
|
|
122
|
+
name: test-<< matrix.gemfile >>-ruby_<< matrix.ruby-version >>
|
|
113
123
|
requires:
|
|
114
124
|
- lint
|
|
115
125
|
matrix:
|
|
116
126
|
parameters:
|
|
117
127
|
ruby-version: ["2.2", "2.3", "2.4", "2.5", "2.6", "2.7"]
|
|
118
128
|
gemfile:
|
|
119
|
-
-
|
|
120
|
-
-
|
|
121
|
-
-
|
|
122
|
-
-
|
|
123
|
-
-
|
|
124
|
-
-
|
|
125
|
-
-
|
|
126
|
-
-
|
|
127
|
-
-
|
|
128
|
-
-
|
|
129
|
-
-
|
|
130
|
-
-
|
|
131
|
-
-
|
|
132
|
-
-
|
|
133
|
-
-
|
|
134
|
-
-
|
|
129
|
+
- aws_2
|
|
130
|
+
- aws_3
|
|
131
|
+
- faraday_0
|
|
132
|
+
- faraday_1
|
|
133
|
+
- sequel4
|
|
134
|
+
- sequel5
|
|
135
|
+
- sinatra
|
|
136
|
+
- rack
|
|
137
|
+
- rails_41
|
|
138
|
+
- rails_42
|
|
139
|
+
- rails_5
|
|
140
|
+
- rails_51
|
|
141
|
+
- rails_52
|
|
142
|
+
- rails_6
|
|
143
|
+
- rails_61
|
|
144
|
+
- redis_3
|
|
145
|
+
- redis_4
|
|
135
146
|
exclude:
|
|
136
147
|
- ruby-version: "2.2"
|
|
137
|
-
gemfile:
|
|
148
|
+
gemfile: faraday_1
|
|
138
149
|
- ruby-version: "2.2"
|
|
139
|
-
gemfile:
|
|
150
|
+
gemfile: rails_52
|
|
140
151
|
- ruby-version: "2.2"
|
|
141
|
-
gemfile:
|
|
152
|
+
gemfile: rails_6
|
|
142
153
|
- ruby-version: "2.3"
|
|
143
|
-
gemfile:
|
|
154
|
+
gemfile: rails_6
|
|
144
155
|
- ruby-version: "2.4"
|
|
145
|
-
gemfile:
|
|
156
|
+
gemfile: rails_6
|
|
157
|
+
- ruby-version: "2.2"
|
|
158
|
+
gemfile: rails_61
|
|
159
|
+
- ruby-version: "2.3"
|
|
160
|
+
gemfile: rails_61
|
|
161
|
+
- ruby-version: "2.4"
|
|
162
|
+
gemfile: rails_61
|
|
146
163
|
- ruby-version: "2.4"
|
|
147
|
-
gemfile:
|
|
164
|
+
gemfile: rails_41
|
|
148
165
|
- ruby-version: "2.5"
|
|
149
|
-
gemfile:
|
|
166
|
+
gemfile: rails_41
|
|
150
167
|
- ruby-version: "2.6"
|
|
151
|
-
gemfile:
|
|
168
|
+
gemfile: rails_41
|
|
152
169
|
- ruby-version: "2.7"
|
|
153
|
-
gemfile:
|
|
170
|
+
gemfile: rails_41
|
|
154
171
|
- ruby-version: "2.7"
|
|
155
|
-
gemfile:
|
|
172
|
+
gemfile: rails_42
|
|
156
173
|
beeline:
|
|
157
174
|
jobs:
|
|
158
175
|
- lint:
|
data/.gitignore
CHANGED
data/.rspec
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# beeline-ruby changelog
|
|
2
2
|
|
|
3
|
+
## 2.4.2 2021-06-25
|
|
4
|
+
|
|
5
|
+
### Fixes
|
|
6
|
+
|
|
7
|
+
- Update Rails middleware to get status code even on raised error. (#153) [@lirossarvet](https://github.com/lirossarvet)
|
|
8
|
+
- Make Rails spec consistent with Honeycomb Railtie Initialization. (#154) [@robbkidd](https://github.com/robbkidd)
|
|
9
|
+
- CI Improvements (#155) [@robbkidd](https://github.com/robbkidd)
|
|
10
|
+
- Improve performance of Redis command serialization. (#146) [@ajvondrak](https://github.com/ajvondrak)
|
|
11
|
+
|
|
3
12
|
## 2.4.1 2021-06-01
|
|
4
13
|
|
|
5
14
|
### Fixes
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
honeycomb-beeline (2.4.
|
|
4
|
+
honeycomb-beeline (2.4.2)
|
|
5
5
|
libhoney (~> 1.14, >= 1.14.2)
|
|
6
6
|
|
|
7
7
|
GEM
|
|
@@ -40,7 +40,7 @@ GEM
|
|
|
40
40
|
http-cookie (~> 1.0)
|
|
41
41
|
http-form_data (~> 2.2)
|
|
42
42
|
http-parser (~> 1.2.0)
|
|
43
|
-
http-cookie (1.0.
|
|
43
|
+
http-cookie (1.0.4)
|
|
44
44
|
domain_name (~> 0.5)
|
|
45
45
|
http-form_data (2.3.0)
|
|
46
46
|
http-parser (1.2.3)
|
|
@@ -81,6 +81,8 @@ GEM
|
|
|
81
81
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
82
82
|
rspec-support (~> 3.9.0)
|
|
83
83
|
rspec-support (3.9.3)
|
|
84
|
+
rspec_junit_formatter (0.4.1)
|
|
85
|
+
rspec-core (>= 2, < 4, != 2.12.0)
|
|
84
86
|
rubocop (0.68.1)
|
|
85
87
|
jaro_winkler (~> 1.5.1)
|
|
86
88
|
parallel (~> 1.10)
|
|
@@ -126,6 +128,7 @@ DEPENDENCIES
|
|
|
126
128
|
pry-byebug (~> 3.6.0)
|
|
127
129
|
rake
|
|
128
130
|
rspec (~> 3.0)
|
|
131
|
+
rspec_junit_formatter
|
|
129
132
|
rubocop (< 0.69)
|
|
130
133
|
rubocop-performance (< 1.3.0)
|
|
131
134
|
simplecov
|
|
@@ -133,4 +136,4 @@ DEPENDENCIES
|
|
|
133
136
|
webmock
|
|
134
137
|
|
|
135
138
|
BUNDLED WITH
|
|
136
|
-
2.
|
|
139
|
+
2.2.21
|
data/honeycomb-beeline.gemspec
CHANGED
|
@@ -48,6 +48,7 @@ Gem::Specification.new do |spec|
|
|
|
48
48
|
spec.add_development_dependency "pry-byebug", "~> 3.6.0"
|
|
49
49
|
spec.add_development_dependency "rake"
|
|
50
50
|
spec.add_development_dependency "rspec", "~> 3.0"
|
|
51
|
+
spec.add_development_dependency "rspec_junit_formatter"
|
|
51
52
|
spec.add_development_dependency "rubocop", "< 0.69"
|
|
52
53
|
spec.add_development_dependency "rubocop-performance", "< 1.3.0"
|
|
53
54
|
spec.add_development_dependency "simplecov"
|
|
@@ -48,11 +48,12 @@ module Honeycomb
|
|
|
48
48
|
span.add_field("request.secure", req.ssl?)
|
|
49
49
|
span.add_field("request.xhr", req.xhr?)
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
51
|
+
begin
|
|
52
|
+
status, headers, body = call_with_hook(env, span, &add_field)
|
|
53
|
+
ensure
|
|
54
|
+
add_package_information(env, &add_field)
|
|
55
|
+
extract_user_information(env, &add_field)
|
|
56
|
+
end
|
|
56
57
|
|
|
57
58
|
span.add_field("response.status_code", status)
|
|
58
59
|
span.add_field("response.content_type", headers["Content-Type"])
|
|
@@ -72,6 +73,12 @@ module Honeycomb
|
|
|
72
73
|
end
|
|
73
74
|
end
|
|
74
75
|
|
|
76
|
+
private
|
|
77
|
+
|
|
78
|
+
def call_with_hook(env, _span, &_add_field)
|
|
79
|
+
app.call(env)
|
|
80
|
+
end
|
|
81
|
+
|
|
75
82
|
# Rack middleware
|
|
76
83
|
class Middleware
|
|
77
84
|
include Rack
|
|
@@ -89,6 +89,16 @@ module Honeycomb
|
|
|
89
89
|
include Rack
|
|
90
90
|
include Warden
|
|
91
91
|
include Rails
|
|
92
|
+
|
|
93
|
+
def call_with_hook(env, span, &_add_field)
|
|
94
|
+
super
|
|
95
|
+
rescue StandardError => e
|
|
96
|
+
wrapped = ActionDispatch::ExceptionWrapper.new(nil, e)
|
|
97
|
+
|
|
98
|
+
span.add_field "response.status_code", wrapped.status_code
|
|
99
|
+
|
|
100
|
+
raise e
|
|
101
|
+
end
|
|
92
102
|
end
|
|
93
103
|
end
|
|
94
104
|
end
|
|
@@ -187,16 +187,6 @@ module Honeycomb
|
|
|
187
187
|
args.map! { "[sanitized]" }
|
|
188
188
|
end
|
|
189
189
|
|
|
190
|
-
def prettify(arg)
|
|
191
|
-
quotes = false
|
|
192
|
-
pretty = "".dup
|
|
193
|
-
arg.to_s.each_char do |c|
|
|
194
|
-
quotes ||= needs_quotes?(c)
|
|
195
|
-
pretty << escape(c)
|
|
196
|
-
end
|
|
197
|
-
quotes ? "\"#{pretty}\"" : pretty
|
|
198
|
-
end
|
|
199
|
-
|
|
200
190
|
# This aims to replicate the algorithms used by redis-cli.
|
|
201
191
|
#
|
|
202
192
|
# @see https://github.com/antirez/redis/blob/0f026af185e918a9773148f6ceaa1b084662be88/src/sds.c#L940-L1067
|
|
@@ -204,54 +194,15 @@ module Honeycomb
|
|
|
204
194
|
#
|
|
205
195
|
# @see https://github.com/antirez/redis/blob/0f026af185e918a9773148f6ceaa1b084662be88/src/sds.c#L878-L907
|
|
206
196
|
# The redis-cli printing algorithm
|
|
207
|
-
def
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
# A lookup table for backslash-escaped characters.
|
|
215
|
-
#
|
|
216
|
-
# This is used by {#escape_with_backslash?} and {#escape_with_backslash}
|
|
217
|
-
# to replicate the hard-coded `case` statements in redis-cli. As of this
|
|
218
|
-
# writing, Redis recognizes a handful of standard C escape sequences,
|
|
219
|
-
# like "\n" for newlines.
|
|
220
|
-
#
|
|
221
|
-
# Because {#prettify} will output double quoted strings if any escaping
|
|
222
|
-
# is needed, this table must additionally consider the double-quote to be
|
|
223
|
-
# a backslash-escaped character. For example, instead of generating
|
|
224
|
-
#
|
|
225
|
-
# '"hello"'
|
|
226
|
-
#
|
|
227
|
-
# we'll generate
|
|
228
|
-
#
|
|
229
|
-
# "\"hello\""
|
|
230
|
-
#
|
|
231
|
-
# even though redis-cli would technically recognize the single-quoted
|
|
232
|
-
# version.
|
|
233
|
-
#
|
|
234
|
-
# @see https://github.com/antirez/redis/blob/0f026af185e918a9773148f6ceaa1b084662be88/src/sds.c#L888-L896
|
|
235
|
-
# The redis-cli algorithm for outputting standard escape sequences
|
|
236
|
-
BACKSLASHES = {
|
|
237
|
-
"\\" => "\\\\",
|
|
238
|
-
'"' => '\\"',
|
|
239
|
-
"\n" => "\\n",
|
|
240
|
-
"\r" => "\\r",
|
|
241
|
-
"\t" => "\\t",
|
|
242
|
-
"\a" => "\\a",
|
|
243
|
-
"\b" => "\\b",
|
|
244
|
-
}.freeze
|
|
245
|
-
|
|
246
|
-
def escape_with_backslash?(char)
|
|
247
|
-
BACKSLASHES.key?(char)
|
|
248
|
-
end
|
|
249
|
-
|
|
250
|
-
def escape_with_backslash(char)
|
|
251
|
-
BACKSLASHES.fetch(char, char)
|
|
197
|
+
def prettify(arg)
|
|
198
|
+
pretty = arg.to_s.dup
|
|
199
|
+
pretty.encode!("UTF-8", "binary", fallback: ->(c) { hex(c) })
|
|
200
|
+
pretty.gsub!(NEEDS_BACKSLASH, BACKSLASH)
|
|
201
|
+
pretty.gsub!(NEEDS_HEX) { |c| hex(c) }
|
|
202
|
+
pretty =~ NEEDS_QUOTES ? "\"#{pretty}\"" : pretty
|
|
252
203
|
end
|
|
253
204
|
|
|
254
|
-
#
|
|
205
|
+
# A regular expression matching characters that need to be hex-encoded.
|
|
255
206
|
#
|
|
256
207
|
# This replicates the C isprint() function that redis-cli uses to decide
|
|
257
208
|
# whether to escape a character in hexadecimal notation, "\xhh". Any
|
|
@@ -287,18 +238,95 @@ module Honeycomb
|
|
|
287
238
|
# escape it.
|
|
288
239
|
#
|
|
289
240
|
# What's more, Ruby's Regexp#=~ method will blow up if the string does
|
|
290
|
-
# not have a valid encoding (e.g., in UTF-8).
|
|
291
|
-
#
|
|
292
|
-
# invalid
|
|
293
|
-
# invalidly-encoded characters before testing the above match.
|
|
241
|
+
# not have a valid encoding (e.g., in UTF-8). We handle this case
|
|
242
|
+
# separately, though, using String#encode! with a :fallback option to
|
|
243
|
+
# hex-encode invalid UTF-8 byte sequences with {#hex}.
|
|
294
244
|
#
|
|
295
245
|
# @see https://ruby-doc.org/core-2.6.5/Regexp.html
|
|
296
246
|
# @see https://github.com/antirez/redis/blob/0f026af185e918a9773148f6ceaa1b084662be88/src/sds.c#L878-L880
|
|
297
247
|
# @see https://github.com/antirez/redis/blob/0f026af185e918a9773148f6ceaa1b084662be88/src/sds.c#L898-L901
|
|
298
248
|
# @see https://www.justinweiss.com/articles/3-steps-to-fix-encoding-problems-in-ruby/
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
249
|
+
NEEDS_HEX = /[^[:print:]&&[:ascii:]]/.freeze
|
|
250
|
+
|
|
251
|
+
# A regular expression for characters that need to be backslash-escaped.
|
|
252
|
+
#
|
|
253
|
+
# Any match of this regexp will be substituted according to the
|
|
254
|
+
# {BACKSLASH} table. This includes standard C escape sequences (newlines,
|
|
255
|
+
# tabs, etc) as well as a couple special considerations:
|
|
256
|
+
#
|
|
257
|
+
# 1. Because {#prettify} will output double quoted strings if any
|
|
258
|
+
# escaping is needed, we must match double quotes (") so they'll be
|
|
259
|
+
# replaced by escaped quotes (\").
|
|
260
|
+
#
|
|
261
|
+
# 2. Backslashes themselves get backslash-escaped, so \ becomes \\.
|
|
262
|
+
# However, strings with invalid UTF-8 encoding will blow up when we
|
|
263
|
+
# try to use String#gsub!, so {#prettify} must first use
|
|
264
|
+
# String#encode! to scrub out invalid characters. It does this by
|
|
265
|
+
# replacing invalid bytes with hex-encoded escape sequences using
|
|
266
|
+
# {#hex}. This will insert sequences like \xhh, which contains a
|
|
267
|
+
# backslash that we *don't* want to escape.
|
|
268
|
+
#
|
|
269
|
+
# Unfortunately, this regexp can't really distinguish between
|
|
270
|
+
# backslashes in the original input vs backslashes resulting from the
|
|
271
|
+
# UTF-8 fallback. We make an effort by using a negative lookahead.
|
|
272
|
+
# That way, only backslashes that *aren't* followed by x + hex digit +
|
|
273
|
+
# hex digit will be escaped.
|
|
274
|
+
NEEDS_BACKSLASH = /["\n\r\t\a\b]|\\(?!x\h\h)/.freeze
|
|
275
|
+
|
|
276
|
+
# A lookup table for backslash-escaped characters.
|
|
277
|
+
#
|
|
278
|
+
# This is used by {#prettify} to replicate the hard-coded `case`
|
|
279
|
+
# statements in redis-cli. As of this writing, Redis recognizes a handful
|
|
280
|
+
# of standard C escape sequences, like "\n" for newlines.
|
|
281
|
+
#
|
|
282
|
+
# Because {#prettify} will output double quoted strings if any escaping
|
|
283
|
+
# is needed, this table must additionally consider the double-quote to be
|
|
284
|
+
# a backslash-escaped character. For example, instead of generating
|
|
285
|
+
#
|
|
286
|
+
# '"hello"'
|
|
287
|
+
#
|
|
288
|
+
# we'll generate
|
|
289
|
+
#
|
|
290
|
+
# "\"hello\""
|
|
291
|
+
#
|
|
292
|
+
# even though redis-cli would technically recognize the single-quoted
|
|
293
|
+
# version.
|
|
294
|
+
#
|
|
295
|
+
# @see https://github.com/antirez/redis/blob/0f026af185e918a9773148f6ceaa1b084662be88/src/sds.c#L888-L896
|
|
296
|
+
# The redis-cli algorithm for outputting standard escape sequences
|
|
297
|
+
BACKSLASH = {
|
|
298
|
+
"\\" => "\\\\",
|
|
299
|
+
'"' => '\\"',
|
|
300
|
+
"\n" => "\\n",
|
|
301
|
+
"\r" => "\\r",
|
|
302
|
+
"\t" => "\\t",
|
|
303
|
+
"\a" => "\\a",
|
|
304
|
+
"\b" => "\\b",
|
|
305
|
+
}.freeze
|
|
306
|
+
|
|
307
|
+
# If the final escaped string needs quotes, it will match this regexp.
|
|
308
|
+
#
|
|
309
|
+
# The overall string returned by {#prettify} should only be quoted if at
|
|
310
|
+
# least one of the following holds:
|
|
311
|
+
#
|
|
312
|
+
# 1. The string contains an escape sequence, broadly demarcated by a
|
|
313
|
+
# backslash. This includes standard escape sequences like "\n" and
|
|
314
|
+
# "\t" as well as hex-encoded bytes using the "\x" escape sequence.
|
|
315
|
+
# Since {#prettify} uses double quotes on its output string, we must
|
|
316
|
+
# also force quotes if the string itself contains a literal
|
|
317
|
+
# double quote. This double quote behavior is handled tacitly by the
|
|
318
|
+
# {NEEDS_BACKSLASH} + {BACKSLASH} replacement.
|
|
319
|
+
#
|
|
320
|
+
# 2. The string contains a single quote. Since redis-cli recognizes
|
|
321
|
+
# single-quoted strings, we want to wrap the {#prettify} output in
|
|
322
|
+
# double quotes so that the literal single quote character isn't
|
|
323
|
+
# mistaken as the delimiter of a new string.
|
|
324
|
+
#
|
|
325
|
+
# 3. The string contains any whitespace characters. If the {#prettify}
|
|
326
|
+
# output weren't wrapped in quotes, whitespace would act as a
|
|
327
|
+
# separator between arguments to the Redis command. To group things
|
|
328
|
+
# together, we need to quote the string.
|
|
329
|
+
NEEDS_QUOTES = /[\\'\s]/.freeze
|
|
302
330
|
|
|
303
331
|
# Hex-encodes a (presumably non-printable or non-ASCII) character.
|
|
304
332
|
#
|
|
@@ -326,38 +354,9 @@ module Honeycomb
|
|
|
326
354
|
# @see https://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap07.html
|
|
327
355
|
# @see https://github.com/antirez/redis/blob/0f026af185e918a9773148f6ceaa1b084662be88/src/sds.c#L878-L880
|
|
328
356
|
# @see https://github.com/antirez/redis/blob/0f026af185e918a9773148f6ceaa1b084662be88/src/sds.c#L898-L901
|
|
329
|
-
def
|
|
357
|
+
def hex(char)
|
|
330
358
|
char.bytes.map { |b| Kernel.format("\\x%02x", b) }.join
|
|
331
359
|
end
|
|
332
|
-
|
|
333
|
-
def escape?(char)
|
|
334
|
-
escape_with_backslash?(char) || escape_with_hex_codes?(char)
|
|
335
|
-
end
|
|
336
|
-
|
|
337
|
-
# Should this character cause {#prettify} to wrap its output in quotes?
|
|
338
|
-
#
|
|
339
|
-
# The overall string returned by {#prettify} should only be quoted if at
|
|
340
|
-
# least one of the following holds:
|
|
341
|
-
#
|
|
342
|
-
# 1. The string contains a character that needs to be escaped. This
|
|
343
|
-
# includes standard backslash escape sequences (like "\n" and "\t") as
|
|
344
|
-
# well as hex-encoded bytes using the "\x" escape sequence. Since
|
|
345
|
-
# {#prettify} uses double quotes on its output string, we must also
|
|
346
|
-
# force quotes if the string itself contains a literal double quote.
|
|
347
|
-
# This double quote behavior is handled tacitly by {BACKSLASHES}.
|
|
348
|
-
#
|
|
349
|
-
# 2. The string contains a single quote. Since redis-cli recognizes
|
|
350
|
-
# single-quoted strings, we want to wrap the {#prettify} output in
|
|
351
|
-
# double quotes so that the literal single quote character isn't
|
|
352
|
-
# mistaken as the delimiter of a new string.
|
|
353
|
-
#
|
|
354
|
-
# 3. The string contains any whitespace characters. If the {#prettify}
|
|
355
|
-
# output weren't wrapped in quotes, whitespace would act as a
|
|
356
|
-
# separator between arguments to the Redis command. To group things
|
|
357
|
-
# together, we need to quote the string.
|
|
358
|
-
def needs_quotes?(char)
|
|
359
|
-
escape?(char) || char == "'" || char =~ /\s/
|
|
360
|
-
end
|
|
361
360
|
end
|
|
362
361
|
end
|
|
363
362
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: honeycomb-beeline
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.4.
|
|
4
|
+
version: 2.4.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Martin Holman
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-06-
|
|
11
|
+
date: 2021-06-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: libhoney
|
|
@@ -156,6 +156,20 @@ dependencies:
|
|
|
156
156
|
- - "~>"
|
|
157
157
|
- !ruby/object:Gem::Version
|
|
158
158
|
version: '3.0'
|
|
159
|
+
- !ruby/object:Gem::Dependency
|
|
160
|
+
name: rspec_junit_formatter
|
|
161
|
+
requirement: !ruby/object:Gem::Requirement
|
|
162
|
+
requirements:
|
|
163
|
+
- - ">="
|
|
164
|
+
- !ruby/object:Gem::Version
|
|
165
|
+
version: '0'
|
|
166
|
+
type: :development
|
|
167
|
+
prerelease: false
|
|
168
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
169
|
+
requirements:
|
|
170
|
+
- - ">="
|
|
171
|
+
- !ruby/object:Gem::Version
|
|
172
|
+
version: '0'
|
|
159
173
|
- !ruby/object:Gem::Dependency
|
|
160
174
|
name: rubocop
|
|
161
175
|
requirement: !ruby/object:Gem::Requirement
|