[SPARK-54314][PYTHON][CONNECT] Improve Server-Side debuggability in Spark Connect by capturing client application's file name and line numbers
What changes were proposed in this pull request?
Optionally transmitting client-side code location details (function name, file name and line number) along with actions.
Why are the changes needed?
Right now there is no information sent to Spark Connect server that will aid in pointing the location of the call (i.e. Spark data frame action) in the client application code. By making this change, client application call stack details are sent to the server as a list of (function name, file name, line number) tuples where they can be logged in the server logs, included in corresponding open telemetry spans as attributes etc. This will help users looking from server side UI or Console to quickly pinpoint call locations of erring or slow calls in their own (client application) code without server needing to have access to the actual code.
Does this PR introduce any user-facing change?
It includes a new ENV variable SPARK_CONNECT_DEBUG_CLIENT_CALL_STACK which user can set to true / 1 to opt into transmitting client application code locations to server. If opted into, the client app call stack trace details are included in the user_context.extensions field of the Spark Connect protobufs
How was this patch tested?
By adding new unit test test_client_call_stack_trace.py
Was this patch authored or co-authored using generative AI tooling?
Yes. Some of the unit tests were Generated-by: Cursor
cc @zhengruifeng and @ueshin FYI
This looks neat. If you can rebase it and run the linter that would be awesome. Thanks for working to improve the debugging experience for PySpark connect users :)
Done. Please LMK if anything else is amiss
@susheel-aroskar looks like still some long line issues in the tests.
Hey @susheel-aroskar can you merge master in and also look at the failing test?
Hey @susheel-aroskar can you merge master in and also look at the failing test?
Done. Can you PTAL?
gentle ping @zhengruifeng @ueshin @HyukjinKwon
cc @gaogaotiantian