Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
145f884
Introduce isTraceOtlpExporterEnabled branching logic for Sampler.java…
mtoffl01 Apr 28, 2026
d183f39
Include regression test for UNSET spans in otlp mode
mtoffl01 Apr 28, 2026
d69e491
Create new OTLP writer type, enabled by default when OTEL_TRACES_EXPO…
mtoffl01 Apr 24, 2026
e7e3a95
Implement OtlpPayloadDispatcher.java
mtoffl01 Apr 24, 2026
af97659
Introduce OtlpPayloadDispatcherTest.java
mtoffl01 Apr 24, 2026
015e272
Implement OtlpWriter
mtoffl01 Apr 24, 2026
8194971
Introduce OtlpWriterTest.java
mtoffl01 Apr 24, 2026
a5cd8fe
Introduce OtlpWriterCombinedTest.java with a TODO
mtoffl01 Apr 24, 2026
1615566
WriterFactory: Add OTLP branch for OtlpWriter; include a TODO for a test
mtoffl01 Apr 24, 2026
46887fe
nits
mtoffl01 Apr 27, 2026
eb2b116
Implement OtlpWriter tests in WriterFactoryTest
mtoffl01 Apr 27, 2026
b02aab1
Document problems with OtlpWriterCombinedTest
mtoffl01 Apr 27, 2026
594b4b8
fill NPE on writeSpanTag
mtoffl01 Apr 27, 2026
491533b
Regression test for UNSET spans in otlp writer mode
mtoffl01 Apr 28, 2026
53d53d7
fix grpc path for OtlpWriter and OtlpSender - plus a regression test
mtoffl01 Apr 29, 2026
edc1081
Remove OtlpTraceProtoCollector INSTANCE singleton
mtoffl01 Apr 29, 2026
5acc0d9
Implement happy path test in OtlpWriterCombinedTest
mtoffl01 Apr 29, 2026
2456c8b
Test the OTLP http request body in OtlpHttpRequestBodyTest
mtoffl01 Apr 29, 2026
96954d7
Fix NPE on null span type tag, and add regression test
mtoffl01 Apr 29, 2026
a09c99e
migrate OtlpWriterCombinedTest to junit
mtoffl01 Apr 30, 2026
84687be
Merge branch 'master' into mtoff/junit-otlp-test
mtoffl01 Apr 30, 2026
ab734cb
Merge branch 'master' into mtoff/junit-otlp-test
mtoffl01 Apr 30, 2026
971d907
remove old groovy file
mtoffl01 Apr 30, 2026
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

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package datadog.trace.common.writer;

import static datadog.trace.api.config.OtlpConfig.TRACE_OTEL_EXPORTER;
import static datadog.trace.junit.utils.config.WithConfigExtension.injectSysConfig;
import static org.junit.jupiter.api.Assertions.assertTrue;

import com.sun.net.httpserver.HttpServer;
import datadog.trace.core.CoreTracer;
import datadog.trace.core.DDCoreJavaSpecification;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;

@Timeout(value = 10, unit = TimeUnit.SECONDS)
class OtlpWriterCombinedTest extends DDCoreJavaSpecification {

@Test
void happyPathOverHttp() throws IOException, InterruptedException {
injectSysConfig(TRACE_OTEL_EXPORTER, "otlp");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can alternatively annotate the test method like that: @WithConfig(key = "service", value = "my_service")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh! this is great to know.


CountDownLatch received = new CountDownLatch(1);
HttpServer server = HttpServer.create(new InetSocketAddress("localhost", 0), 0);
server.createContext(
"/v1/traces",
exchange -> {
received.countDown();
exchange.sendResponseHeaders(200, -1);
exchange.close();
});
server.start();

OtlpWriter writer =
OtlpWriter.builder()
.endpoint(
"http://"
+ server.getAddress().getHostString()
+ ":"
+ server.getAddress().getPort()
+ "/v1/traces")
.flushIntervalMilliseconds(-1)
.build();
CoreTracer tracer = tracerBuilder().writer(writer).build();
try {
tracer.buildSpan("test", "fakeOperation").start().finish();
writer.flush();

assertTrue(received.await(5, TimeUnit.SECONDS), "OTLP server should receive a request");
} finally {
tracer.close();
server.stop(0);
}
}
}
Loading