Skip to content

Commit deb33c2

Browse files
committed
fix
1 parent 08202d1 commit deb33c2

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

lib/fluent/plugin/out_otlp.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,12 @@ def format(tag, time, record)
6969
end
7070

7171
def write(chunk)
72+
record = JSON.parse(chunk.read)
73+
7274
if @grpc_handler
73-
@grpc_handler.export(chunk)
75+
@grpc_handler.export(record)
7476
else
75-
@http_handler.export(chunk)
77+
@http_handler.export(record)
7678
end
7779
end
7880

@@ -94,8 +96,8 @@ def initialize(http_config, transport_config, logger)
9496
end
9597
end
9698

97-
def export(chunk)
98-
uri, connection = create_http_connection(chunk)
99+
def export(record)
100+
uri, connection = create_http_connection(record)
99101
response = connection.post
100102

101103
if response.status != 200
@@ -124,8 +126,7 @@ def http_traces_endpoint
124126
"#{@http_config.endpoint}/v1/traces"
125127
end
126128

127-
def create_http_connection(chunk)
128-
record = JSON.parse(chunk.read)
129+
def create_http_connection(record)
129130
msg = record["message"]
130131

131132
begin
@@ -166,8 +167,7 @@ def initialize(grpc_config, transport_config, logger)
166167
@logger = logger
167168
end
168169

169-
def export(chunk)
170-
record = JSON.parse(chunk.read)
170+
def export(record)
171171
msg = record["message"]
172172

173173
credential = :this_channel_is_insecure

0 commit comments

Comments
 (0)