Skip to content

Commit

Permalink
[SDCISA-16147, swisspost#583] Adjust measurement.
Browse files Browse the repository at this point in the history
  • Loading branch information
hiddenalpha committed Jun 7, 2024
1 parent b3606c0 commit e2f576b
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class KafkaProducerRecordBuilder {
*/
Future<List<KafkaProducerRecord<String, String>>> buildRecordsAsync(String topic, Buffer payload) {
return Future.<Void>succeededFuture().compose((Void v) -> vertx.executeBlocking(() -> {
long beginEpchMs = currentTimeMillis();
JsonObject payloadObj;
try {
payloadObj = new JsonObject(payload);
Expand All @@ -68,13 +69,12 @@ Future<List<KafkaProducerRecord<String, String>>> buildRecordsAsync(String topic
if (recordsArray == null) {
throw new ValidationException("Missing 'records' array");
}
long beginEpchMs = currentTimeMillis();
List<KafkaProducerRecord<String, String>> kafkaProducerRecords = new ArrayList<>(recordsArray.size());
for (int i = 0; i < recordsArray.size(); i++) {
kafkaProducerRecords.add(fromRecordJsonObject(topic, recordsArray.getJsonObject(i)));
}
long durationMs = currentTimeMillis() - beginEpchMs;
log.debug("Serializing JSON did block thread for {}ms", durationMs);
log.debug("Parsing and Serializing JSON did block thread for {}ms", durationMs);
return kafkaProducerRecords;
}));
}
Expand Down

0 comments on commit e2f576b

Please sign in to comment.