Support configuring queuedMaxSpans in AsyncReporter (#2157)

This commit is contained in:
Karthik Kumar
2022-05-17 06:01:13 -04:00
committed by GitHub
parent bc95c3ad8d
commit 488b871422
2 changed files with 15 additions and 2 deletions

View File

@@ -128,8 +128,8 @@ public class ZipkinAutoConfiguration {
CheckResult checkResult = checkResult(zipkinExecutor, sender, 1_000L);
logCheckResult(sender, checkResult);
// historical constraint. Note: AsyncReporter supports memory bounds
AsyncReporter<Span> asyncReporter = AsyncReporter.builder(sender).queuedMaxSpans(1000)
// Note: AsyncReporter supports memory bounds
AsyncReporter<Span> asyncReporter = AsyncReporter.builder(sender).queuedMaxSpans(zipkin.getQueuedMaxSpans())
.messageTimeout(zipkin.getMessageTimeout(), TimeUnit.SECONDS).metrics(reporterMetrics)
.build(zipkin.getEncoder());

View File

@@ -75,6 +75,11 @@ public class ZipkinProperties {
private Locator locator = new Locator();
/**
* Maximum backlog of spans reported vs sent.
*/
private int queuedMaxSpans = 1000;
public Locator getLocator() {
return this.locator;
}
@@ -147,6 +152,14 @@ public class ZipkinProperties {
this.encoder = encoder;
}
public int getQueuedMaxSpans() {
return queuedMaxSpans;
}
public void setQueuedMaxSpans(int queuedMaxSpans) {
this.queuedMaxSpans = queuedMaxSpans;
}
/** When enabled, spans are gzipped before sent to the zipkin server. */
public static class Compression {