Is it possible to use an expression to retrieve a value from an HTTP session? I'm trying to capture the username for each HTTP request. The username is stored in a UserProfile object stored as a session attribute with key of 'userProfile'.
I have added a method Data Collector to retrieve the username from the UserProfile on method 'getStaffName()'. I have also added an HTTP data collector that retrieves the sessionkey 'userProfile'. Unfortunately, the getStaffName method does not appear to be called for every request, and the UserProfile object does not have a 'toString' defined.
Is it possible to use an expression to extract a specific field from an object stored as a session attribute?
Hi,
Have you checked below custom expression referred in below screenshot and see if that helps here:
Regards,
Arun
Unfortunately, that only works when naming a Business Transaction. If you want to use a Data Collector to extract data from a session attribute, it gets a bit more difficult.
For example, here is the definition of the Data Collector:
you can see the output of the data collector in HTTP Params, but since there is not toString, it's pretty useless.
So the question is, can I use an expression when defining a session key for a data instead of a fixed value?
Since I am only attemptive to retrieve the user id, I was able to use an expression on User Principal to retrieve the user id I need.
Hi David,
i meant sample config, as i stated and you have noticed custom expression is applicable for both BT and http collector collection, good to hear custom expression helped here.