Skip to content

Commit

Permalink
Avoid encoding list of spans twice in BaseHttpSender (#270)
Browse files Browse the repository at this point in the history
newBody was called twice which would result in encoding the list of
spans twice unnecessarily. This change will reduce allocations and
copying memory.
  • Loading branch information
shakuzen authored Sep 9, 2024
1 parent 5191332 commit 302b54c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/src/main/java/zipkin2/reporter/BaseHttpSender.java
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ final U nextEndpoint(HttpEndpointSupplier endpointSupplier) {
if (endpoint == null) endpoint = nextEndpoint(endpointSupplier);
B body = newBody(encodedSpans);
if (body == null) throw new NullPointerException("newBody(encodedSpans) returned null");
postSpans(endpoint, newBody(encodedSpans));
postSpans(endpoint, body);
}

@Override public final void close() {
Expand Down

0 comments on commit 302b54c

Please sign in to comment.