Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: log attempts and batch size for failed produce requests #63

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
* 1.10.4
- Log produce failure warning message with number of attempts and batch size.

* 1.10.3
- Fixed typespec for `wolff_client:get_leader_connections/3`.

Expand Down
2 changes: 1 addition & 1 deletion src/wolff.app.src
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{application, wolff,
[{description, "Kafka's publisher"},
{vsn, "1.10.3"},
{vsn, "1.10.4"},
{registered, []},
{applications,
[kernel,
Expand Down
2 changes: 1 addition & 1 deletion src/wolff.appup.src
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
%% -*- mode: erlang; -*-
{"1.10.3",
{"1.10.4",
[
],
[
Expand Down
13 changes: 10 additions & 3 deletions src/wolff_producer.erl
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,9 @@ send_to_kafka(#{sent_reqs := Sent,
NewSent = #{request => Req,
q_ack_ref => QAckRef,
calls => Calls,
attempts => 1},
attempts => 1,
batch_size => length(FlatBatch)
},
St2 = St1#{sent_reqs := queue:in(NewSent, Sent),
sent_reqs_count := NewSentReqsCount,
inflight_calls := NewInflightCalls
Expand Down Expand Up @@ -518,7 +520,9 @@ handle_kafka_ack(#kpro_rsp{api = produce,
case queue:peek(SentReqs) of
{value, #{request := #kpro_req{ref = Ref},
calls := Calls,
attempts := Attempts}} ->
attempts := Attempts,
batch_size := BatchSize
}} ->
case ErrorCode =:= ?no_error of
true ->
do_handle_kafka_ack(BaseOffset, St);
Expand All @@ -530,7 +534,10 @@ handle_kafka_ack(#kpro_rsp{api = produce,
inc_sent_failed(Config, length(Calls), AttemptedBefore),
log_warn(Topic, Partition,
"error_in_produce_response",
#{error_code => ErrorCode}),
#{error_code => ErrorCode,
batch_size => BatchSize,
attempts => Attempts
}),
erlang:throw(ErrorCode)
end;
_ ->
Expand Down
Loading