Skip to content

Commit 982282f

Browse files
committed
Fixing issue - forwarder wasn't flushing the JSON
1 parent 08ffeb7 commit 982282f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

dd-java-agent/src/main/java/datadog/trace/bootstrap/BootstrapInitializationTelemetry.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package datadog.trace.bootstrap;
22

33
import java.io.IOException;
4+
import java.io.OutputStream;
45
import java.util.concurrent.TimeUnit;
56

67
/** Thread safe telemetry class used to relay information about tracer activation. */
@@ -204,8 +205,10 @@ public void send(JsonBuffer buffer) throws IOException {
204205
ProcessBuilder builder = new ProcessBuilder(forwarderPath);
205206

206207
Process process = builder.start();
207-
process.getOutputStream().write(buffer.toByteArray());
208-
208+
try ( OutputStream out = process.getOutputStream() ) {
209+
out.write(buffer.toByteArray());
210+
}
211+
209212
try {
210213
process.waitFor(1, TimeUnit.SECONDS);
211214
} catch (InterruptedException e) {

0 commit comments

Comments
 (0)