Skip to content

Commit de6eb89

Browse files
committed
fix
1 parent 30ebf9a commit de6eb89

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

lib/fluent/plugin/otlp/request.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ def initialize(body)
1818
end
1919
end
2020

21-
def encode
22-
Opentelemetry::Proto::Collector::Logs::V1::ExportLogsServiceRequest.encode(@request)
21+
def body
22+
@request.class.encode(@request)
2323
end
2424

2525
def record
@@ -37,8 +37,8 @@ def initialize(body)
3737
end
3838
end
3939

40-
def encode
41-
Opentelemetry::Proto::Collector::Metrics::V1::ExportMetricsServiceRequest.encode(@request)
40+
def body
41+
@request.class.encode(@request)
4242
end
4343

4444
def record
@@ -56,8 +56,8 @@ def initialize(body)
5656
end
5757
end
5858

59-
def encode
60-
Opentelemetry::Proto::Collector::Trace::V1::ExportTraceServiceRequest.encode(@request)
59+
def body
60+
@request.class.encode(@request)
6161
end
6262

6363
def record

lib/fluent/plugin/out_otlp.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,13 @@ def create_http_connection(chunk)
132132
case record["type"]
133133
when Otlp::RECORD_TYPE_LOGS
134134
uri = http_logs_endpoint
135-
body = Otlp::Request::Logs.new(msg).encode
135+
body = Otlp::Request::Logs.new(msg).body
136136
when Otlp::RECORD_TYPE_METRICS
137137
uri = http_metrics_endpoint
138-
body = Otlp::Request::Metrics.new(msg).encode
138+
body = Otlp::Request::Metrics.new(msg).body
139139
when Otlp::RECORD_TYPE_TRACES
140140
uri = http_traces_endpoint
141-
body = Otlp::Request::Traces.new(msg).encode
141+
body = Otlp::Request::Traces.new(msg).body
142142
end
143143
rescue Google::Protobuf::ParseError => e
144144
# The message format does not comply with the OpenTelemetry protocol.

test/helper.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ module JSON
2626
end
2727

2828
module ProtocolBuffers
29-
METRICS = Fluent::Plugin::Otlp::Request::Metrics.new(TestData::JSON::METRICS).encode
30-
TRACES = Fluent::Plugin::Otlp::Request::Traces.new(TestData::JSON::TRACES).encode
31-
LOGS = Fluent::Plugin::Otlp::Request::Logs.new(TestData::JSON::LOGS).encode
29+
METRICS = Fluent::Plugin::Otlp::Request::Metrics.new(TestData::JSON::METRICS).body
30+
TRACES = Fluent::Plugin::Otlp::Request::Traces.new(TestData::JSON::TRACES).body
31+
LOGS = Fluent::Plugin::Otlp::Request::Logs.new(TestData::JSON::LOGS).body
3232

3333
INVALID = "invalid"
3434
end

0 commit comments

Comments
 (0)