Skip to content
This repository has been archived by the owner on Mar 15, 2021. It is now read-only.

Commit

Permalink
Use metrics size, not in bytes for pubsub limit fix (#247)
Browse files Browse the repository at this point in the history
* Use metrics size, not in bytes for pubsub limit fix

* Change log to warn level
  • Loading branch information
lmuhlha authored Feb 25, 2021
1 parent f7c592e commit 625df74
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ public AsyncFuture<Void> sendMetrics(Collection<Metric> metrics) {
final ByteString m = ByteString.copyFrom(serializer.serialize(metrics, writeCache));

if (m.size() > MAX_BATCH_SIZE_BYTES) {
logger.debug("Above byte limit, resizing batch");
logger.warn("Above byte limit, resizing batch");
int times = (int)Math.ceil(m.size()/MAX_BATCH_SIZE_BYTES);
List<List<Metric>> collections = Lists.partition(new ArrayList<>(metrics), m.size()/times);
List<List<Metric>> collections = Lists.partition(new ArrayList<>(metrics), metrics.size()/times);
for (List<Metric> l: collections) {
final ByteString mResize = ByteString.copyFrom(serializer.serialize(l, writeCache));
publishPubSub(mResize);
Expand Down

0 comments on commit 625df74

Please sign in to comment.