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

Session duration in Mobile apps

deni
Advisor

Hi,

Recently we have a case raised by our client - Why a mobile session remains live  for 35 minutes and after that its duration becomes 18 secs. We open a support ticket and an idea based on communication there. Here are the details (about the support ticket and the suggested idea):  https://community.dynatrace.com/t5/Product-ideas/Automatically-End-Mobile-Sessions-Upon-App-Closure/...

Now I'm reading the documentation again: https://docs.dynatrace.com/docs/observe/digital-experience/rum-concepts/user-session#user-session-en...

From what I see there is 2 cases when a sessions will stay alive for 35 minutes and after that the real calculations will be done:

After 10 minutes of inactivity on a mobile device.1
When the user or the mobile operating system closes or force stops the app.1, 2

in both cases we have (1) where it is written: user session remains live in the Dynatrace web UI for up to 35 minutes after that.

But what about: When the session is ended via the Dynatrace API. ? - There is no such remark on this. My question is what is this API that our customer can use to end the session on time (e.g. as in their case - to show the session as ended after 18 secs in Dynatrace UI and not after 35 minutes) ?

Regards, Deni

 

 

Dynatrace Integration Engineer at CodeAttest
4 REPLIES 4

DanielS
DynaMight Guru
DynaMight Guru

Hi @deni, the API is the RUM JavaScript API https://www.dynatrace.com/support/doc/javascriptapi/doc/index.html 

Search for DtrumApi and the method endSession

Dynatrace Certified Professional @ www.dosbyte.com

Hi @DanielS ,
Thanks for your reply!

It was confirmed in the support ticket that this is not supported in the Mobile apps. In the web apps it is written:

"When the session is ended via the RUM JavaScript API by calling the dtrum.endSession() function.", but in the mobile it is just: "When the session is ended via the Dynatrace API."  - when I read something like API I imagine that it is some kind of POST http(s):// ..., but these are just guesses.  Anyway confirmed by the support "endSession" will not work in mobile, but the documentation still says that there is such API ...

 

Dynatrace Integration Engineer at CodeAttest

Patrick_H
Dynatrace Leader
Dynatrace Leader

The endVisit API on the mobile agents (and also RUM SDK) just ends the current session and starts a new one. All new data will be sent with the new session. BUT: the end session event does not trigger an immediate closure of the live session, as closed session will be written to a different immutable storage - so the still are kept open for the default timeout in case there is delayed data being received (e.g. actions in old sessions still active during session switch) which  could no longe be adde to the ended session if instantly marked as no longe live on cluster side.

iOS help: https://www.dynatrace.com/support/help/shortlink/ios-hub

deni
Advisor

It was strange to me why mobile sessions in Dynatrace always stay alive for 35 minutes — but now I understand why.

As @Patrick_H  explainedendVisit() will start a new session, but that doesn’t mean the old one is immediately closed.

Why?

In mobile apps, users often work offline. Unlike web apps, mobile apps store a lot of data locally and send it to the server later. If a session were marked as inactive in Dynatrace and, afterwards, the phone flushed its cached data, that data would be lost — because Dynatrace can’t modify sessions that are no longer live.

This is intentional. It would be misleading if a session originally appeared to last 10 seconds, but then suddenly jumped to 12 minutes when late data arrived.

Since Dynatrace can’t predict exactly when a mobile device will send its cached data, it keeps the session alive for the full 35-minute timeout period.

Dynatrace Integration Engineer at CodeAttest

Featured Posts