dd-trace-java icon indicating copy to clipboard operation
dd-trace-java copied to clipboard

datadog reporting no trace for netty 4.1 when request is cancelled

Open furstenheim-goodnotes opened this issue 11 months ago • 0 comments

Using kotlin and netty engine if a client request is aborted in flight, then datadog is reporting no trace.

On the client I can reproduce it with:

it("cancellation", async () => {
    const content = '123456789'
    const body = new stream.Readable()

    const abortableController = new AbortController()
    body._read = () => {}
    setImmediate(async () => {
        body.push(content.slice(0, 5)) // send part of the request
        await wait(1000)
        abortableController.abort() // abort
       // not aborted request would do body.push(content.slice(5)); body.push(null)
    })
    await axios({
        url: 'http://localhost:3044/test',
        method: 'POST',
        data: body,
        signal: abortableController.signal,
        headers: {
            'Content-Length': content.length,
            'Content-Type': 'text/plain'
        }
    })
})

If finishing the request without aborting the server will show datadog trace.

My guess is that there is an issue here https://github.com/DataDog/dd-trace-java/blob/1a337326e954d0d771d7ec6c7a0d8d0093295c96/dd-java-agent/instrumentation/netty-4.1/src/main/java/datadog/trace/instrumentation/netty41/server/HttpServerRequestTracingHandler.java#L83

furstenheim-goodnotes avatar Dec 19 '24 14:12 furstenheim-goodnotes