Class: Fluent::Plugin::Opentelemetry::Response::Traces

Inherits:
Object
  • Object
show all
Defined in:
lib/fluent/plugin/opentelemetry/response.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(rejected: 0, error: "") ⇒ Traces

Returns a new instance of Traces.



78
79
80
# File 'lib/fluent/plugin/opentelemetry/response.rb', line 78

def initialize(rejected: 0, error: "")
  @response = Traces.build(rejected: rejected, error: error)
end

Class Method Details

.build(rejected: 0, error: "") ⇒ Object



69
70
71
72
73
74
75
76
# File 'lib/fluent/plugin/opentelemetry/response.rb', line 69

def self.build(rejected: 0, error: "")
  Opentelemetry::Proto::Collector::Trace::V1::ExportTraceServiceResponse.new(
    partial_success: Opentelemetry::Proto::Collector::Trace::V1::ExportTracePartialSuccess.new(
      rejected_spans: rejected,
      error_message: error
    )
  )
end

Instance Method Details

#body(type:) ⇒ Object



82
83
84
85
86
87
88
# File 'lib/fluent/plugin/opentelemetry/response.rb', line 82

def body(type:)
  if type == :protobuf
    @response.to_proto
  else
    @response.to_json
  end
end