Class: Trace::FileTracer

Inherits:
Tracer
  • Object
show all
Defined in:
lib/finagle-thrift/tracer.rb

Instance Method Summary collapse

Constructor Details

#initializeFileTracer

Returns a new instance of FileTracer.



35
36
37
38
# File 'lib/finagle-thrift/tracer.rb', line 35

def initialize
  @last_trace_id = nil
  @file = nil
end

Instance Method Details

#record(id, annotation) ⇒ Object



40
41
42
43
44
45
# File 'lib/finagle-thrift/tracer.rb', line 40

def record(id, annotation)
  return unless id.sampled?
  file = get_file_for_id(id)
  file.puts("#{id.to_s}: #{annotation.to_s}")
  file.flush if (annotation.is_a?(Annotation) && annotation.value == Annotation::SERVER_SEND)
end

#set_rpc_name(id, name) ⇒ Object



47
48
49
50
# File 'lib/finagle-thrift/tracer.rb', line 47

def set_rpc_name(id, name)
  return unless id.sampled?
  get_file_for_id(id).puts("#{id.to_s}: name = #{name}")
end