Class: Datadog::Tracing::Contrib::GRPC::Formatting::FullMethodStringFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/datadog/tracing/contrib/grpc/formatting.rb

Overview

A class to extract GRPC span attributes from the full method string.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(grpc_full_method) ⇒ FullMethodStringFormatter

Returns a new instance of FullMethodStringFormatter.



98
99
100
101
102
# File 'lib/datadog/tracing/contrib/grpc/formatting.rb', line 98

def initialize(grpc_full_method)
  @grpc_full_method = grpc_full_method
  @resource_name = format_resource_name(grpc_full_method)
  @rpc_service = extract_grpc_service(grpc_full_method)
end

Instance Attribute Details

#grpc_full_methodObject (readonly)

grpc_full_method is a string containing all the rpc method information (from the Protobuf definition) in a single string with the following format: /$package.$service/$method



90
91
92
# File 'lib/datadog/tracing/contrib/grpc/formatting.rb', line 90

def grpc_full_method
  @grpc_full_method
end

#resource_nameObject (readonly)

resource_name is used for the span resource name.



93
94
95
# File 'lib/datadog/tracing/contrib/grpc/formatting.rb', line 93

def resource_name
  @resource_name
end

#rpc_serviceObject (readonly)

rpc_service represents the $package.$service part of the grpc_full_method string.



96
97
98
# File 'lib/datadog/tracing/contrib/grpc/formatting.rb', line 96

def rpc_service
  @rpc_service
end