[Python] Dropping custom event on long tasks


We noticed an unexpected (at least for us) behavior of newrelic’s python agent: trying to record custom events on a long task fails (in our example a flask request that is running ~4min before response). We record the custom event in the end.

Debugging it, the only difference I was able to spot with the short request (where recording works) is that retrieving the current transaction fails in the long-running case but works for short-running case. Therefore, the custom event is dropped (no application provided).

Is there some sort of TTL/timeout parameter for the transaction cache?
I’m not sure of what’s the best way to move on from that, but those long requests are especially interesting to monitor, and it was hard to even spot that some were dropped.

Any idea welcome !

Hi @pierre-etienne.bougu,

Welcome to the Community :slightly_smiling_face:

Custom events being dropped by NR indicates a limit that was exceeded. I suggest taking a look at Data requirements and limits for custom event data

I believe your suggestion of passing a timeout param may solve the issue here. See Timeouts for more on this. The following links include examples you can use as a guide:

Let me know if this helps!

Hello @tpaul1 ,

Thanks for your answer.
In my case I have the possibility to provide an application parameter, which ends-up doing the job expected.

So it’s not as important as it was for me now, but I still don’t get why this custom_event is dropped in NR without application param. The task finishes correctly anyway, standard logs are displayed (at the moment NR custom-event is invoked), but no NR custom-event is sent for long task, while the exact same task speeded-up gets both.
And I don’t see where in newrelic’s configuration I can parametrize a timeout/TTL on this NR-transaction (did not dig much into python-agent’s code, but didn’t see anything like it).

Hi @pierre-etienne.bougu,

Thank you for the update and your patience. Glad to hear it is working as expected. I will check with the team to see if they can provide further on this, with regards to the dropped custom event.

This topic was automatically closed after 365 days. New replies are no longer allowed.