Class: Fluent::Plugin::OpentelemetryOutput

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

Defined Under Namespace

Classes: GrpcHandler, HttpHandler, RetryableResponse

Instance Method Summary collapse

Instance Method Details

#configure(conf) ⇒ Object



57
58
59
60
61
62
63
64
65
66
# File 'lib/fluent/plugin/out_opentelemetry.rb', line 57

def configure(conf)
  super

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

  @http_handler = HttpHandler.new(@http_config, @transport_config, log) if @http_config
  @grpc_handler = GrpcHandler.new(@grpc_config, @transport_config, log) if @grpc_config
end

#format(tag, time, record) ⇒ Object



72
73
74
# File 'lib/fluent/plugin/out_opentelemetry.rb', line 72

def format(tag, time, record)
  JSON.generate(record)
end

#multi_workers_ready?Boolean

Returns:

  • (Boolean)


68
69
70
# File 'lib/fluent/plugin/out_opentelemetry.rb', line 68

def multi_workers_ready?
  true
end

#write(chunk) ⇒ Object



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

def write(chunk)
  record = JSON.parse(chunk.read)

  if @grpc_handler
    @grpc_handler.export(record)
  else
    @http_handler.export(record)
  end
end