diff --git a/api-publishing/src/main/java/org/zalando/nakadi/EventPublishingController.java b/api-publishing/src/main/java/org/zalando/nakadi/EventPublishingController.java index 3add7bad62..371a97b622 100644 --- a/api-publishing/src/main/java/org/zalando/nakadi/EventPublishingController.java +++ b/api-publishing/src/main/java/org/zalando/nakadi/EventPublishingController.java @@ -180,7 +180,9 @@ private ResponseEntity postBinaryEvents(final String eventTypeName, "publishing record result can not be empty"); } final EventPublishResult result = publishingResultConverter.mapPublishingResultToView(recordResults); - final int eventCount = result.getResponses().size(); + + final int eventCount = nakadiRecords.size(); + TracingService.setTag("number_of_events", eventCount); final long totalSizeBytes = countingInputStream.getCount(); TracingService.setTag("slo_bucket", TracingService.getSLOBucketName(totalSizeBytes)); @@ -264,11 +266,14 @@ private ResponseEntity postEventInternal(final String eventTypeName, } else { result = publisher.publish(eventsAsString, eventTypeName, consumerTags); } + // FIXME: there should be a more direct way to get the input batch size final int eventCount = result.getResponses().size(); reportMetrics(eventTypeMetrics, result, totalSizeBytes, eventCount); reportSLOs(startingNanos, totalSizeBytes, eventCount, result, eventTypeName, client); + TracingService.setTag("number_of_events", eventCount); + if (result.getStatus() == EventPublishingStatus.FAILED) { TracingService.setErrorFlag(); } diff --git a/core-services/src/main/java/org/zalando/nakadi/service/publishing/BinaryEventPublisher.java b/core-services/src/main/java/org/zalando/nakadi/service/publishing/BinaryEventPublisher.java index 1212598e61..d6367912ff 100644 --- a/core-services/src/main/java/org/zalando/nakadi/service/publishing/BinaryEventPublisher.java +++ b/core-services/src/main/java/org/zalando/nakadi/service/publishing/BinaryEventPublisher.java @@ -82,9 +82,6 @@ private List processInternal(final EventType eventType, final List records, final List checks, final Map consumerTags) { - - TracingService.setTag("number_of_events", records.size()); - for (final Check check : checks) { final List res = check.execute(eventType, records); if (res != null && !res.isEmpty()) { diff --git a/core-services/src/main/java/org/zalando/nakadi/service/publishing/EventPublisher.java b/core-services/src/main/java/org/zalando/nakadi/service/publishing/EventPublisher.java index af9bc3c6ea..5be8b4464b 100644 --- a/core-services/src/main/java/org/zalando/nakadi/service/publishing/EventPublisher.java +++ b/core-services/src/main/java/org/zalando/nakadi/service/publishing/EventPublisher.java @@ -137,9 +137,6 @@ EventPublishResult processInternal(final String events, Closeable publishingCloser = null; final List batch = BatchFactory.from(events); - - TracingService.setTag("number_of_events", batch.size()); - try { publishingCloser = timelineSync.workWithEventType(eventTypeName, nakadiSettings.getTimelineWaitTimeoutMs());