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

Is it possible to fetch all UserSession/UserAction data in the specific duration via UserSessions API?

kohei-saito
Organizer

Hi,

I'm trying to get UserSession data and UserAction data with UserSessions API.

However not all UserSession/UserAction data in the specific duration can be fetched.

For example, when I want to fetch last one hour UserSession data via UserSessions API, the following URI can be used:

https://<tenant_id>.live.dynatrace.com/api/v1/userSessionQueryLanguage/table.../api/v1/userSessionQueryLanguage/table?query=SELECT%20*%20FROM%20usersession&relativeTime=hour&Api-Token=<token>

This leads to the response that contains only 50 datapoints because of the limitation of them, which is defined as "LIMIT", that is optional query parameter, and its default value is "50".

c.f.) https://www.dynatrace.com/support/help/shortlink/u...

After trying several times, I eventually noticed that the limitation of "LIMIT" value is 5000.

https://<tenant_id>.live.dynatrace.com/api/v1/userSessionQueryLanguage...>/api/v1/userSessionQueryLanguage/table?query=SELECT%20%2a%20FROM%20useraction%20ORDER%20BY%20starttime%20ASC%20LIMIT%20100000%0d%0a&reletaiveTime=hour&Api-Token=<token>

 

{
"error": {
"code": 404,
"message": "The maximum limit of retrieved documents is 5000, but you requested 100000"
}
}

If the number of UserSession is more than 5000 for an hour, is it impossible to fetch all UserSession data for an hour with 'relativeTime' hour?

(I'm not sure if I can tell you what I want to say..)

Regards,

Kohei Saito

 

2 REPLIES 2

AlexanderSommer
Dynatrace Pro
Dynatrace Pro

Hi, you are right - you can't fetch more than 5000 rows at this point in time. So in order to get all user sessions, you can either use smaller time frame chunks or use our user session export stream. The user session API was not build for doing data export's the main goal is to include get data segments for specific criteria.
If you want to have all data - the user session export stream is the way to go. But nevertheless we will perhaps extend the limit of 5000 in future.

Alex


kohei-saito
Organizer

Hi Alex,

thank you for your polite answer.

As I thought, it is impossible to fetch all user sessions via current API.

This time, I'd like to have all of them via not streaming to ElasticSearch but API.

However, as you said, it seem to be better to export stream now...

If possible, I want you to extend this limit in future, because we are planning to utilize your Dynatrace API and integrate with other software services.

Thank you very much,

Kohei