Add get{Signal}Exporter methods to Simple{Signal}Processor, Batch{Signal}Processor (#6078)
This commit is contained in:
parent
434609a7bc
commit
b897510bb9
|
@ -1,2 +1,7 @@
|
|||
Comparing source compatibility of against
|
||||
No changes.
|
||||
*** MODIFIED CLASS: PUBLIC FINAL io.opentelemetry.sdk.logs.export.BatchLogRecordProcessor (not serializable)
|
||||
=== CLASS FILE FORMAT VERSION: 52.0 <- 52.0
|
||||
+++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.logs.export.LogRecordExporter getLogRecordExporter()
|
||||
*** MODIFIED CLASS: PUBLIC FINAL io.opentelemetry.sdk.logs.export.SimpleLogRecordProcessor (not serializable)
|
||||
=== CLASS FILE FORMAT VERSION: 52.0 <- 52.0
|
||||
+++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.logs.export.LogRecordExporter getLogRecordExporter()
|
||||
|
|
|
@ -1,2 +1,7 @@
|
|||
Comparing source compatibility of against
|
||||
No changes.
|
||||
*** MODIFIED CLASS: PUBLIC FINAL io.opentelemetry.sdk.trace.export.BatchSpanProcessor (not serializable)
|
||||
=== CLASS FILE FORMAT VERSION: 52.0 <- 52.0
|
||||
+++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.trace.export.SpanExporter getSpanExporter()
|
||||
*** MODIFIED CLASS: PUBLIC FINAL io.opentelemetry.sdk.trace.export.SimpleSpanProcessor (not serializable)
|
||||
=== CLASS FILE FORMAT VERSION: 52.0 <- 52.0
|
||||
+++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.trace.export.SpanExporter getSpanExporter()
|
||||
|
|
|
@ -105,6 +105,11 @@ public final class BatchLogRecordProcessor implements LogRecordProcessor {
|
|||
return worker.forceFlush();
|
||||
}
|
||||
|
||||
/** Return the processor's configured {@link LogRecordExporter}. */
|
||||
public LogRecordExporter getLogRecordExporter() {
|
||||
return worker.logRecordExporter;
|
||||
}
|
||||
|
||||
// Visible for testing
|
||||
List<LogRecordData> getBatch() {
|
||||
return worker.batch;
|
||||
|
|
|
@ -107,6 +107,11 @@ public final class SimpleLogRecordProcessor implements LogRecordProcessor {
|
|||
return CompletableResultCode.ofAll(pendingExports);
|
||||
}
|
||||
|
||||
/** Return the processor's configured {@link LogRecordExporter}. */
|
||||
public LogRecordExporter getLogRecordExporter() {
|
||||
return logRecordExporter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SimpleLogRecordProcessor{" + "logRecordExporter=" + logRecordExporter + '}';
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
package io.opentelemetry.sdk.logs.export;
|
||||
|
||||
import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
||||
import static org.assertj.core.api.AssertionsForClassTypes.assertThatCode;
|
||||
import static org.awaitility.Awaitility.await;
|
||||
|
@ -417,6 +418,13 @@ class BatchLogRecordProcessorTest {
|
|||
assertThat(result.isSuccess()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
void getLogRecordExporter() {
|
||||
assertThat(
|
||||
BatchLogRecordProcessor.builder(mockLogRecordExporter).build().getLogRecordExporter())
|
||||
.isSameAs(mockLogRecordExporter);
|
||||
}
|
||||
|
||||
@Test
|
||||
void toString_Valid() {
|
||||
when(mockLogRecordExporter.toString()).thenReturn("MockLogRecordExporter");
|
||||
|
|
|
@ -120,6 +120,14 @@ class SimpleLogRecordProcessorTest {
|
|||
verify(logRecordExporter).shutdown();
|
||||
}
|
||||
|
||||
@Test
|
||||
void getLogRecordExporter() {
|
||||
assertThat(
|
||||
((SimpleLogRecordProcessor) SimpleLogRecordProcessor.create(logRecordExporter))
|
||||
.getLogRecordExporter())
|
||||
.isSameAs(logRecordExporter);
|
||||
}
|
||||
|
||||
@Test
|
||||
void toString_Valid() {
|
||||
when(logRecordExporter.toString()).thenReturn("MockLogRecordExporter");
|
||||
|
|
|
@ -122,6 +122,11 @@ public final class BatchSpanProcessor implements SpanProcessor {
|
|||
return worker.forceFlush();
|
||||
}
|
||||
|
||||
/** Return the processor's configured {@link SpanExporter}. */
|
||||
public SpanExporter getSpanExporter() {
|
||||
return worker.spanExporter;
|
||||
}
|
||||
|
||||
// Visible for testing
|
||||
List<SpanData> getBatch() {
|
||||
return worker.batch;
|
||||
|
|
|
@ -135,6 +135,11 @@ public final class SimpleSpanProcessor implements SpanProcessor {
|
|||
return CompletableResultCode.ofAll(pendingExports);
|
||||
}
|
||||
|
||||
/** Return the processor's configured {@link SpanExporter}. */
|
||||
public SpanExporter getSpanExporter() {
|
||||
return spanExporter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SimpleSpanProcessor{"
|
||||
|
|
|
@ -592,6 +592,12 @@ class BatchSpanProcessorTest {
|
|||
assertThat(result.isSuccess()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
void getSpanExporter() {
|
||||
assertThat(BatchSpanProcessor.builder(mockSpanExporter).build().getSpanExporter())
|
||||
.isSameAs(mockSpanExporter);
|
||||
}
|
||||
|
||||
@Test
|
||||
void stringRepresentation() {
|
||||
BatchSpanProcessor processor = BatchSpanProcessor.builder(mockSpanExporter).build();
|
||||
|
|
|
@ -275,4 +275,10 @@ class SimpleSpanProcessorTest {
|
|||
simpleSampledSpansProcessor.close();
|
||||
verify(spanExporter).shutdown();
|
||||
}
|
||||
|
||||
@Test
|
||||
void getSpanExporter() {
|
||||
assertThat(((SimpleSpanProcessor) SimpleSpanProcessor.create(spanExporter)).getSpanExporter())
|
||||
.isSameAs(spanExporter);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue