Sha256: 3af7e7455110a46fcefee8ca3ecfe9e1c03c347a88807650c7f2924b9b8aaa6f
Contents?: true
Size: 1.35 KB
Versions: 6
Compression:
Stored size: 1.35 KB
Contents
# frozen_string_literal: true require 'thrift' module OpenTracing module Instrumentation module Thrift # Build operation name for TracedProtocol class TracedProtocolOperationNameBuilder DEFAULT_OPERATION_NAME_PATTERN = \ 'thrift(direction=%<direction>s, name=%<name>s, type=%<type>s)' # @param operation_name_pattern [String] def initialize( operation_name_pattern: DEFAULT_OPERATION_NAME_PATTERN ) @operation_name_pattern = operation_name_pattern end # @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 def build_operation_name(direction, name, type) format_args = build_format_args(direction, name, type) format(operation_name_pattern, **format_args) end def ==(other) operation_name_pattern == other.operation_name_pattern end protected attr_reader :operation_name_pattern private def build_format_args(direction, name, type) { direction: direction, name: name, type: MESSAGE_TYPES[type], } end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems