Replace jctools dep in tracing-incubator with shaded jctools (#3730)
This commit is contained in:
parent
5bc953ec68
commit
b6b1853511
|
@ -15,9 +15,10 @@ dependencies {
|
||||||
api(project(":api:all"))
|
api(project(":api:all"))
|
||||||
api(project(":sdk:all"))
|
api(project(":sdk:all"))
|
||||||
|
|
||||||
|
compileOnly(project(":sdk:trace-shaded-deps"))
|
||||||
|
|
||||||
implementation(project(":api:metrics"))
|
implementation(project(":api:metrics"))
|
||||||
implementation(project(":semconv"))
|
implementation(project(":semconv"))
|
||||||
implementation("org.jctools:jctools-core:3.3.0")
|
|
||||||
|
|
||||||
annotationProcessor("com.google.auto.value:auto-value")
|
annotationProcessor("com.google.auto.value:auto-value")
|
||||||
testImplementation(project(":sdk:testing"))
|
testImplementation(project(":sdk:testing"))
|
||||||
|
|
|
@ -18,8 +18,10 @@ import io.opentelemetry.sdk.trace.ReadableSpan;
|
||||||
import io.opentelemetry.sdk.trace.SpanProcessor;
|
import io.opentelemetry.sdk.trace.SpanProcessor;
|
||||||
import io.opentelemetry.sdk.trace.data.SpanData;
|
import io.opentelemetry.sdk.trace.data.SpanData;
|
||||||
import io.opentelemetry.sdk.trace.export.SpanExporter;
|
import io.opentelemetry.sdk.trace.export.SpanExporter;
|
||||||
|
import io.opentelemetry.sdk.trace.internal.JcTools;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Queue;
|
||||||
import java.util.concurrent.ArrayBlockingQueue;
|
import java.util.concurrent.ArrayBlockingQueue;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
@ -27,7 +29,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import java.util.concurrent.atomic.AtomicLong;
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import org.jctools.queues.MpscArrayQueue;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Batch {@link SpanProcessor} that uses a user-provided {@link
|
* A Batch {@link SpanProcessor} that uses a user-provided {@link
|
||||||
|
@ -85,7 +86,7 @@ public final class ExecutorServiceSpanProcessor implements SpanProcessor {
|
||||||
scheduleDelayNanos,
|
scheduleDelayNanos,
|
||||||
maxExportBatchSize,
|
maxExportBatchSize,
|
||||||
exporterTimeoutNanos,
|
exporterTimeoutNanos,
|
||||||
new MpscArrayQueue<>(maxQueueSize),
|
JcTools.newFixedSizeQueue(maxQueueSize),
|
||||||
executorService,
|
executorService,
|
||||||
isShutdown,
|
isShutdown,
|
||||||
workerScheduleIntervalNanos);
|
workerScheduleIntervalNanos);
|
||||||
|
@ -152,7 +153,7 @@ public final class ExecutorServiceSpanProcessor implements SpanProcessor {
|
||||||
private final BoundLongCounter droppedSpans;
|
private final BoundLongCounter droppedSpans;
|
||||||
private final AtomicReference<CompletableResultCode> flushRequested = new AtomicReference<>();
|
private final AtomicReference<CompletableResultCode> flushRequested = new AtomicReference<>();
|
||||||
private final long scheduleDelayNanos;
|
private final long scheduleDelayNanos;
|
||||||
private final MpscArrayQueue<ReadableSpan> queue;
|
private final Queue<ReadableSpan> queue;
|
||||||
private final int maxExportBatchSize;
|
private final int maxExportBatchSize;
|
||||||
private final SpanExporter spanExporter;
|
private final SpanExporter spanExporter;
|
||||||
private final ScheduledExecutorService executorService;
|
private final ScheduledExecutorService executorService;
|
||||||
|
@ -162,7 +163,7 @@ public final class ExecutorServiceSpanProcessor implements SpanProcessor {
|
||||||
long scheduleDelayNanos,
|
long scheduleDelayNanos,
|
||||||
int maxExportBatchSize,
|
int maxExportBatchSize,
|
||||||
long exporterTimeoutNanos,
|
long exporterTimeoutNanos,
|
||||||
MpscArrayQueue<ReadableSpan> queue,
|
Queue<ReadableSpan> queue,
|
||||||
ScheduledExecutorService executorService,
|
ScheduledExecutorService executorService,
|
||||||
AtomicBoolean isShutdown,
|
AtomicBoolean isShutdown,
|
||||||
long workerScheduleIntervalNanos) {
|
long workerScheduleIntervalNanos) {
|
||||||
|
|
|
@ -10,9 +10,9 @@ import io.opentelemetry.sdk.common.CompletableResultCode;
|
||||||
import io.opentelemetry.sdk.trace.ReadableSpan;
|
import io.opentelemetry.sdk.trace.ReadableSpan;
|
||||||
import io.opentelemetry.sdk.trace.data.SpanData;
|
import io.opentelemetry.sdk.trace.data.SpanData;
|
||||||
import io.opentelemetry.sdk.trace.export.SpanExporter;
|
import io.opentelemetry.sdk.trace.export.SpanExporter;
|
||||||
import java.util.AbstractQueue;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Queue;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
@ -99,7 +99,7 @@ class WorkerExporter {
|
||||||
* @param batch a collection of {@link SpanData} to export
|
* @param batch a collection of {@link SpanData} to export
|
||||||
* @param queue {@link ReadableSpan} queue to be drained and then exported
|
* @param queue {@link ReadableSpan} queue to be drained and then exported
|
||||||
*/
|
*/
|
||||||
public void flush(Collection<SpanData> batch, AbstractQueue<ReadableSpan> queue) {
|
public void flush(Collection<SpanData> batch, Queue<ReadableSpan> queue) {
|
||||||
int spansToFlush = queue.size();
|
int spansToFlush = queue.size();
|
||||||
while (spansToFlush > 0) {
|
while (spansToFlush > 0) {
|
||||||
ReadableSpan span = queue.poll();
|
ReadableSpan span = queue.poll();
|
||||||
|
|
Loading…
Reference in New Issue