Class: Datadog::Tracing::Contrib::GRPC::Formatting::MethodObjectFormatter

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

Overview

A class to extract GRPC span attributes from the GRPC implementing class method object.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(grpc_method_object) ⇒ MethodObjectFormatter

Returns a new instance of MethodObjectFormatter.



27
28
29
30
31
32
# File 'lib/datadog/tracing/contrib/grpc/formatting.rb', line 27

def initialize(grpc_method_object)
  @grpc_full_method = format_full_method(grpc_method_object)
  @resource_name = format_resource_name(grpc_method_object)
  @legacy_grpc_method = extract_legacy_grpc_method(grpc_method_object)
  @legacy_grpc_service = extract_legacy_grpc_service(grpc_method_object)
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



14
15
16
# File 'lib/datadog/tracing/contrib/grpc/formatting.rb', line 14

def grpc_full_method
  @grpc_full_method
end

#legacy_grpc_methodObject (readonly)

legacy_grpc_method is built using the Ruby GRPC service implementation method name instead of the rpc interface representation from Protobuf. It’s kept for compatibility.



22
23
24
# File 'lib/datadog/tracing/contrib/grpc/formatting.rb', line 22

def legacy_grpc_method
  @legacy_grpc_method
end

#legacy_grpc_serviceObject (readonly)

legacy_grpc_service is built using the Ruby GRPC service implementation package and class name instead of the rpc interface representation from Protobuf. It’s kept for compatibility.



18
19
20
# File 'lib/datadog/tracing/contrib/grpc/formatting.rb', line 18

def legacy_grpc_service
  @legacy_grpc_service
end

#resource_nameObject (readonly)

resource_name is used for the span resource name.



25
26
27
# File 'lib/datadog/tracing/contrib/grpc/formatting.rb', line 25

def resource_name
  @resource_name
end