class OpenTracing::Instrumentation::Thrift::TracedProtocolOperationNameBuilder

Build operation name for TracedProtocol

Constants

DEFAULT_OPERATION_NAME_PATTERN

Attributes

operation_name_pattern[R]

Public Class Methods

new( operation_name_pattern: DEFAULT_OPERATION_NAME_PATTERN ) click to toggle source

@param operation_name_pattern [String]

# File lib/opentracing/instrumentation/thrift/traced_protocol_operation_name_builder.rb, line 14
def initialize(
  operation_name_pattern: DEFAULT_OPERATION_NAME_PATTERN
)
  @operation_name_pattern = operation_name_pattern
end

Public Instance Methods

==(other) click to toggle source
# File lib/opentracing/instrumentation/thrift/traced_protocol_operation_name_builder.rb, line 29
def ==(other)
  operation_name_pattern == other.operation_name_pattern
end
build_operation_name(direction, name, type) click to toggle source

@param direction [String] should be 'write' or 'read' @param name [String] method name. Example: 'Service:method' @param type [Integer] message type, See ::Thrift::MessageTypes @return [String] formated operation name

# File lib/opentracing/instrumentation/thrift/traced_protocol_operation_name_builder.rb, line 24
def build_operation_name(direction, name, type)
  format_args = build_format_args(direction, name, type)
  format(operation_name_pattern, **format_args)
end

Private Instance Methods

build_format_args(direction, name, type) click to toggle source
# File lib/opentracing/instrumentation/thrift/traced_protocol_operation_name_builder.rb, line 39
def build_format_args(direction, name, type)
  {
    direction: direction,
    name: name,
    type: MESSAGE_TYPES[type],
  }
end