File: redis_interceptor.rb

package info (click to toggle)
ruby-gitlab-labkit 0.36.1-2
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 444 kB
  • sloc: ruby: 1,705; makefile: 6
file content (27 lines) | stat: -rw-r--r-- 825 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# frozen_string_literal: true

require "redis"

module Labkit
  module Tracing
    module Redis
      # RedisInterceptor is an interceptor for Redis to add distributed tracing.
      # It should be installed using the `Labkit::Tracing.instrument` method
      module RedisInterceptor
        def call(command)
          RedisInterceptorHelper.call_with_tracing(command, self) do
            # Note: when used without any arguments super uses the arguments given to the subclass method.
            super
          end
        end

        def call_pipeline(pipeline)
          RedisInterceptorHelper.call_pipeline_with_tracing(pipeline, self) do
            # Note: when used without any arguments super uses the arguments given to the subclass method.
            super
          end
        end
      end
    end
  end
end