File: in_memory_reporter.rb

package info (click to toggle)
ruby-jaeger-client 1.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 624 kB
  • sloc: ruby: 3,381; makefile: 6; sh: 4
file content (30 lines) | stat: -rw-r--r-- 466 bytes parent folder | download | duplicates (2)
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
28
29
30
# frozen_string_literal: true

module Jaeger
  module Reporters
    class InMemoryReporter
      def initialize
        @spans = []
        @mutex = Mutex.new
      end

      def report(span)
        @mutex.synchronize do
          @spans << span
        end
      end

      def spans
        @mutex.synchronize do
          @spans
        end
      end

      def clear
        @mutex.synchronize do
          @spans.clear
        end
      end
    end
  end
end