Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add scheduled delay for batch span processor #2222

Merged
merged 1 commit into from
Apr 8, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -166,17 +166,17 @@ private static BatchSpanProcessor createExporter(Configuration configuration) {
BatchSpanProcessorBuilder builder = BatchSpanProcessor.builder(currExporter);

String delayMillisStr = System.getenv("APPLICATIONINSIGHTS_PREVIEW_BSP_SCHEDULE_DELAY");
int delayMillis;
if (delayMillisStr != null) {
// experimenting with flushing at small interval instead of using batch size 1
// (suspect this may be better performance on small containers)
builder.setScheduleDelay(Duration.ofMillis(Integer.parseInt(delayMillisStr)));
delayMillis = Integer.parseInt(delayMillisStr);
} else {
// using batch size 1 because need to convert to SpanData as soon as possible to grab data for
// live metrics. the real batching is done at a lower level
builder.setMaxExportBatchSize(1);
// using small interval because need to convert to SpanData as soon as possible to grab data
// for live metrics. the real batching is done at a lower level
// (not using batch size 1 because that seems to cause poor performance on small containers)
delayMillis = 100;
}

return builder.build();
return builder.setScheduleDelay(Duration.ofMillis(delayMillis)).build();
}

private static class BackCompatHttpUrlProcessor implements SpanExporter {
Expand Down