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

Is it possible to sort API results by timestamp?

xtraspecialj
Visitor

I have this API query here:

builtin:apps.web.visuallyComplete.xhr.browser:filter(and(in("dt.entity.application",entitySelector("type(application),entityName.equals(~"APP_NAME_REMOVED~")")))):splitBy():sort(value(auto,descending)):limit(1)

 

And I want the results sorted by the TimeStamp descending (the default method seems to be to sort it by the TimeStamp ascending).  However, I tried adding the sort() method in it and it doesn't work. Looking through the documentation and performing several different Google search terms has come up empty for me. Is this possible?

4 REPLIES 4

mark_bley
Dynatrace Advisor
Dynatrace Advisor

Hi @xtraspecialj,

you are already filtering for 1 specific application, the result will be that 1 application visually completeness for XHR actions per browser.

However if you split by browser e.g. and play around with the sorting ascending vs descending :

builtin:apps.web.visuallyComplete.xhr.browser:filter(and(in("dt.entity.application",entitySelector("type(application),entityName.equals(~"APP_NAME_REMOVED~")")))):splitBy("dt.entity.browser"):sort(value(auto,ascending)):limit(100)

You will notice how the values change, also make sure to have the visualization of the char as a Table:

mark_bley_0-1662736176944.png

Hope this helps.

Best,

Mark

 

Thanks Mark.  This isn't being used in the Dynatrace app.  This API call is collecting the data in another tool that has limited ability to manipulate the data it receives, that's why I'm looking for a way to sort by Timestamp descending instead of ascending like it does by default.  Splitting it by browser won't help as I need the results as they are, just with the timestamp sorted descending instead of ascending.  Sounds like maybe that isn't possible with the API call alone?

Using the API would require you to just read the datapoints/timestamps in a reverse order, which usually when pulling this data into other tools is somehow possible.

Not in this particular tool, no.  That's why I was hoping there was a way to do it with the built-in API parameters.  I was hoping with all the various sorting and grouping features in the API, I was missing something and that there was a way to do it built in.  Oh well, thanks anyways.