Sha256: 98e86a859356d1ee7d9810da813fce1d767f54e698702097fdbe363f3ab6a002
Contents?: true
Size: 1.24 KB
Versions: 7
Compression:
Stored size: 1.24 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)' attr_reader :operation_name_pattern # @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 private def build_format_args(direction, name, type) { direction: direction, name: name, type: MESSAGE_TYPES[type], } end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems