dd-trace-java
dd-trace-java copied to clipboard
Allow the user to flush the pending traces in case the application is aborting
I've noticed that traces finished in an exception handler don't land in DataDog as they are (supposedly) not flushed before the whole app terminates. It's unfortunate as that makes some of the top-level traces unavailable in my test scenario that involves batch (thus easily interruptible) jobs.
Is there any way to synchronously force-flush the pending traces? I've seen such feature exists for the C# handler so opening a similar issue for Java too.
Hi there, I think we might have a similar situation, as we have a traced Kubernetes CronJob Kotlin/JVM handler which reports most of the time after completion an java.io.InterruptedIOException:
[dd.trace 2022-06-26 08:05:58:836 +0000] [dd-trace-processor] WARN datadog.trace.agent.common.writer.ddagent.DDAgentApi - Error while sending 1 (size=632KB) traces to the DD agent. Total: 58, Received: 58, Sent: 57, Failed: 1. java.io.InterruptedIOException: interrupted (Will not log errors for 5 minutes)