amachanic / sp_whoisactive

sp_whoisactive
GNU General Public License v3.0
1.14k stars 281 forks source link

Add context_info to output #40

Closed kottivakkam closed 2 years ago

kottivakkam commented 3 years ago

Please add context_info from sys.dm_exec_requests to the output.

amachanic commented 3 years ago

I'll accept a PR of adding it to the [additional_info] collection. (But maybe don't include it if it's equal to 0x.)

Just curious, though, what are you doing where you need this? Probably a good idea to discontinue using context_info on the app side now that session_context exists.

kottivakkam commented 3 years ago

We have a DW processing data using SPs. There is a central SP responsible for running custom-made SPs for each fact. The central SP takes care of logging, scheduling etc. And when it starts a new fact-SP, it stamps the SP name into context_info. Having the SP name directly accessible in sp_whoisactive makes it faster for the support to track down poor performing or blocking fact-SPs.

We have experimented with @get_full_inner_text, but as the custom-made SPs in some cases calls other generic SPs, it does not always give us what we are looking for.

erikdarlingdata commented 2 years ago

This would be easy to add to the y derived table, with something like NULLIF(COALESCE(r.context_info, s.context_info), 0x)

amachanic commented 2 years ago

All set.