Class: Fluent::Plugin::OpentelemetryOutput

Inherits:
Output
  • Object
show all
Defined in:
lib/fluent/plugin/out_opentelemetry.rb

Defined Under Namespace

Classes: RetryableResponse

Instance Method Summary collapse

Instance Method Details

#configure(conf) ⇒ Object



71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/fluent/plugin/out_opentelemetry.rb', line 71

def configure(conf)
  super

  if @grpc_config && !defined?(GRPC)
    raise Fluent::ConfigError, "To use gRPC feature, please install grpc gem such as 'fluent-gem install grpc'."
  end

  unless [@http_config, @grpc_config].one?
    raise Fluent::ConfigError, "Please configure either <http> or <grpc> section."
  end

  @http_handler = Opentelemetry::HttpOutputHandler.new(@http_config, @transport_config, log) if @http_config
  @grpc_handler = Opentelemetry::GrpcOutputHandler.new(@grpc_config, @transport_config, log) if @grpc_config
end

#multi_workers_ready?Boolean

Returns:

  • (Boolean)


86
87
88
# File 'lib/fluent/plugin/out_opentelemetry.rb', line 86

def multi_workers_ready?
  true
end

#write(chunk) ⇒ Object



90
91
92
93
94
95
96
97
98
# File 'lib/fluent/plugin/out_opentelemetry.rb', line 90

def write(chunk)
  chunk.each do |_, record| # rubocop:disable Style/HashEachMethods
    if @grpc_handler
      @grpc_handler.export(record)
    else
      @http_handler.export(record)
    end
  end
end