Skip to content
This repository has been archived by the owner on Jun 7, 2024. It is now read-only.

Commit

Permalink
Add number_of_events tag to publish_events spans (#1553)
Browse files Browse the repository at this point in the history
To allow the publishers to learn about their batch size distribution.
  • Loading branch information
a1exsh authored Oct 5, 2023
1 parent 08b53c4 commit 7e878e8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ public static Span setTag(final String key, final String value) {
return getActiveSpan().setTag(key, value);
}

public static Span setTag(final String key, final Number value) {
return getActiveSpan().setTag(key, value);
}

public static Span setErrorFlag() {
return setErrorFlag(getActiveSpan());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ private List<NakadiRecordResult> processInternal(final EventType eventType,
final List<NakadiRecord> records,
final List<Check> checks,
final Map<HeaderTag, String> consumerTags) {

TracingService.setTag("number_of_events", records.size());

for (final Check check : checks) {
final List<NakadiRecordResult> res = check.execute(eventType, records);
if (res != null && !res.isEmpty()) {
Expand Down Expand Up @@ -147,4 +150,4 @@ public List<NakadiRecordResult> delete(final List<NakadiRecord> events, final Ev
public List<NakadiRecordResult> publishInternal(final EventType eventType, final List<NakadiRecord> events) {
return processInternal(eventType, events, internalPublishingChecks, null);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ EventPublishResult processInternal(final String events,

Closeable publishingCloser = null;
final List<BatchItem> batch = BatchFactory.from(events);

TracingService.setTag("number_of_events", batch.size());

try {
publishingCloser = timelineSync.workWithEventType(eventTypeName, nakadiSettings.getTimelineWaitTimeoutMs());

Expand Down

0 comments on commit 7e878e8

Please sign in to comment.