13 Aug 2024 07:05 PM - last edited on 21 Aug 2024 01:45 PM by MaciejNeumann
I want to fetch all the xhr actions inside a web application. I am using following usql query(and sending it as a param in GET /api/v1/userSessionQueryLanguage/table
SELECT useraction.name, COUNT(*) AS action_count FROM usersession WHERE useraction.application = 'Temperstack-Local' AND useraction.type = 'Xhr' AND useraction.startTime >= $NOW - DURATION("1d") GROUP BY useraction.name ORDER BY action_count DESC
Where I am facing issue is getting result based on timeframe.
Even if I use: useraction.startTime >= 'yyyy-mm-dd', it won't work.
What works is selecting the desired timeframe in the dynatrace UI.
What exactly am I doing wrong?
Solved! Go to Solution.
13 Aug 2024 10:26 PM - edited 13 Aug 2024 10:26 PM
Hi @fumax,
I have tired many options without any success. Maybe our synthax is woring.
This option works only form me (becuase $NOW $TIME_FRAME_START are time variables) and but I think it will not a solution for you which is similar to $NOW:
SELECT useraction.name, COUNT(*) AS action_count FROM usersession WHERE ((useraction.application='Phoenix' OR userevent.application='Phoenix' OR usererror.application='Phoenix')) AND useraction.startTime >=$TIME_FRAME_START - DURATION("1d") GROUP BY useraction.name
Next oprion was the unix time, I have not received any error message (because it a numeric number) but did not work...
SELECT useraction.name, COUNT(*) AS action_count FROM usersession WHERE ((useraction.application='Phoenix' OR userevent.application='Phoenix' OR usererror.application='Phoenix')) AND useraction.startTime >=1723327200 - DURATION("1d") GROUP BY useraction.name
Third option was where the error message clear.
Maybe other community members have any other ideas.
Best regards,
Mizső
14 Aug 2024 05:16 AM
Hey @Mizső
Thank you for your valuable effort and response.
Do you know of any direct api to fetch actions from a web app instead of usql query?
15 Aug 2024 10:00 PM - edited 15 Aug 2024 10:00 PM
Hi @fumax,
I thnik there is not such API.
You can only use the API which uses USQL.
Best regards,
Mizső