Class: Fluent::Plugin::Opentelemetry::GrpcOutputHandler
- Inherits:
-
Object
- Object
- Fluent::Plugin::Opentelemetry::GrpcOutputHandler
- Defined in:
- lib/fluent/plugin/opentelemetry/grpc_output_handler.rb
Defined Under Namespace
Classes: ServiceStub
Instance Method Summary collapse
- #export(record) ⇒ Object
-
#initialize(grpc_config, transport_config, logger) ⇒ GrpcOutputHandler
constructor
A new instance of GrpcOutputHandler.
Constructor Details
#initialize(grpc_config, transport_config, logger) ⇒ GrpcOutputHandler
Returns a new instance of GrpcOutputHandler.
49 50 51 52 53 |
# File 'lib/fluent/plugin/opentelemetry/grpc_output_handler.rb', line 49 def initialize(grpc_config, transport_config, logger) @grpc_config = grpc_config @transport_config = transport_config @logger = logger end |
Instance Method Details
#export(record) ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/fluent/plugin/opentelemetry/grpc_output_handler.rb', line 55 def export(record) msg = record["message"] credential = :this_channel_is_insecure case record["type"] when Fluent::Plugin::Opentelemetry::RECORD_TYPE_LOGS service = ServiceStub::Logs.new(@grpc_config.endpoint, credential) when Fluent::Plugin::Opentelemetry::RECORD_TYPE_METRICS service = ServiceStub::Metrics.new(@grpc_config.endpoint, credential) when Fluent::Plugin::Opentelemetry::RECORD_TYPE_TRACES service = ServiceStub::Traces.new(@grpc_config.endpoint, credential) end begin service.export(msg) rescue Google::Protobuf::ParseError => e # The message format does not comply with the OpenTelemetry protocol. raise ::Fluent::UnrecoverableError, e. end end |