cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Live user session: what metrics?

jduhamel
Newcomer

Hello everyone,

I would like to retrieve "User live" sessions in dashboard created with PowerBi with API method. I had custom APP and classic APP, i'm wonder what metrics i should use. After many tests no one gave me the same value with the dashboard Dynatrace.

(Api1 V1/V2, Custom metrics,)

I try to find a workaround with "Active session"?

 

Someone can help me?

Regards

J.

4 REPLIES 4

ChadTurner
DynaMight Legend
DynaMight Legend

You'll want to use the API V2 - /metrics/query. You'll build your query in USQL then paste it into the API and it will give you the CURL, URL and the json output for your Power BI. Just make sure you have created a token just for the Power BI. 

-Chad

_davidemascolo
Contributor

That's works fine!
Thank you @ChadTurner 

I'm your friendly neighbourhood Spider-Man!™
- Davide
from Milan, Italy

Peter_Ralston
Advisor

Hi, 

 

There is no clear answer hear as Dynatrace does not actually expose the live sessions, it is 'in memory' only and the values you see on the application and user sessions screen under 'live' are not retrievable via usql or metrics. 

 

There are 2 options, 

 

1. As mentioned above, use usql and extract via the API.

 

This is going to have to be delayed data (e.g what happened last hour) based on the completion of user sessions, so will never be entirely accurate for what you want and because the timestamp for usql extraction doesn't have relative time frames will  be required to calculate the to / from timestamps within your calling app  or leave the default as 'last 2 hours' and then add a timestamp to the usql to limit the time (needs to be = polling time)

 

example queries below.

 

SELECT count(distinct UserId) as 'Current Unique UserID' FROM usersession
Where useraction.application IN ("xxx") and userId IS NOT NULL

 

SELECT count(distinct UserId) as 'Sessions with Errors' FROM usersession
Where useraction.application IN ("xxx") and userId IS NOT NULL and useraction.requestErrorCount > 0

 

2. The better alternative is to use the inbuilt calculated metrics

 

builtin:apps.web.activeUsersEst

builtin:apps.web.activeSessions

builtin:apps.other.userCount.osAndVersion-std

 

Peter_Ralston_0-1650322755617.png

 

These will give you Dynatrace pre calculated 'estimated' number of active users and sessions.  it is split between mobile & web, so you might need to show this data seperately.


This is retrieved via the api v2 metrics (as above) and can do relative timestamps (last 5 min), so is much easier to handle and graph.

 

Anyway, good luck 

Unfortunately,

The three metrics are only available for WEB applications.

Sharing Knowledge

Featured Posts