diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-16 00:08:35 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-16 00:08:35 +0300 |
commit | ecfcccb684722316df4cd6c999a2716b44413733 (patch) | |
tree | 31d5fe9dd2b7b74a0b7e666752a8fae27d2fb593 /lib/gitlab/instrumentation | |
parent | 3caf5a8a007d8d9e9a86b7c847b5d9cfa6d41843 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/instrumentation')
-rw-r--r-- | lib/gitlab/instrumentation/redis_interceptor.rb | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/lib/gitlab/instrumentation/redis_interceptor.rb b/lib/gitlab/instrumentation/redis_interceptor.rb index a485fcaaea1..a36aade59c3 100644 --- a/lib/gitlab/instrumentation/redis_interceptor.rb +++ b/lib/gitlab/instrumentation/redis_interceptor.rb @@ -61,15 +61,14 @@ module Gitlab # 4. "Binary" string (i.e. may contain zero byte) # 5. Array of binary string - size = if result.is_a? Array - # This count is an approximation that omits the Redis protocol overhead - # of type prefixes, length prefixes and line endings. - result.inject(0) { |sum, y| sum + y.to_s.bytesize } - else - result.to_s.bytesize - end - - instrumentation_class.increment_read_bytes(size) + if result.is_a? Array + # Redis can return nested arrays, e.g. from XRANGE or GEOPOS, so we use recursion here. + result.each { |x| measure_read_size(x) } + else + # This count is an approximation that omits the Redis protocol overhead + # of type prefixes, length prefixes and line endings. + instrumentation_class.increment_read_bytes(result.to_s.bytesize) + end end # That's required so it knows which GitLab Redis instance |