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

Retrieving apdex score for specific app/entity?

CPC
Newcomer

I need to be able to GET the apdex score of a specific application/entity, but can't figure out how to do it via api.  In Postman I'm using the following, which I found online:

https://[HOST]/e/[ID]/api/v1/timeseries?relativeTime=hour&aggregationType=count&timeseriesId=com.dyn...

and it's returning a lot (everything?) including what I believe is the apdex score I'm looking for (please correct me if I'm wrong?).

Ex (0.57 and 0.95😞

{
    "result": {
        "dataPoints": {
            "APPLICATION-70271671F7DA1232": [
                [
                    1652268060000,
                    0.57
                ]
            ],
            "APPLICATION-2104433A851141A1": [
                [
                    1652268060000,
                    0.95
                ]
            ],
            [clipped]
as well as:
        "entities": {
              "APPLICATION-70271671F7DA1232""[app1].[domain].com"
              "APPLICATION-2104433A851141A1""[app2].[domain].com",
               [clipped]
and much much more.
 
Is there a way to request just the apdex score for a single application - i.e. the 0.57 from APPLICATION-70271671F7DA1232?  What about the entity name along with that specific 0.57 value?
 
An additional ask would be how to retrieve them all, but in a format similar to:
[entity]  [apdex score]
[app1].[domain].com  0.57
[app2].[domain].com 0.95
 
The goal is to simply "dashboard" the value(s) in an external application.
I'm new to APIs and Dynatrace, so if you can please explain it like I'm 5?
 
Thank you
5 REPLIES 5

Julius_Loman
DynaMight Guru
DynaMight Guru

I recommend using the Metrics v2 API instead as it is much more powerful.

To retrieve Apdex all applications application you can query the metric:

 

builtin:apps.web.apdex.userType

 

For example - fetching it for last 1 week timeframe, including the entity names:

 

curl -X GET "<your_environment>/api/v2/metrics/query?metricSelector=builtin%3Aapps.web.apdex.userType%3AsplitBy%28%22dt.entity.application%22%29%3Anames%3Aavg%3Aauto&from=now-1w" -H "accept: application/json; charset=utf-8" -H "Authorization: Api-Token <your_api_token>"

 

The Metrics API uses metric selectors to describe the metric queries, in the example we used:

 

builtin:apps.web.apdex.userType:splitBy("dt.entity.application"):names:avg:auto

 

This will retrieve the metric, split it by the application (so you have numbers for each app) and it uses the :name transformation to add the entity (application) name in the result. The data points in a bucket are average.
There are plenty of metric selector transformations you can use. 

To filter it for a specific entity, you can use the either the entitySelector query parameter for the API or the :filter parameter in the metric selector. For example the entitySelector in your case will be :

entityId("APPLICATION-2104433A851141A1")
Certified Dynatrace Master | TEMPEST a.s., Slovakia, Dynatrace Master Partner

Thank you for the reply.  The curl statement returns much, but I'm not sure how I'd format the uri for use with Postman, and subsequently the api call in the external app's interface.  Can you please provide a full example?  of both the curl and Postman GET including the entityId entitySelector you mention - I've tried using entityId before, but it always errors out, so where/how to use it isn't clear to me.

 

Thank you.

The entitySelector is just another parameter for the API call. In the example above the cURL command will be changed to:

curl -X GET "<your_environment>/api/v2/metrics/query?metricSelector=builtin%3Aapps.web.apdex.userType%3AsplitBy%28%22dt.entity.application%22%29%3Anames%3Aavg%3Aauto&from=now-1w&entityId%28%22APPLICATION-2104433A851141A1%22%29" -H "accept: application/json; charset=utf-8" -H "Authorization: Api-Token <your_api_token>"

I don't use Postman at all, so I won't navigate you how to do that in postman. Maybe will find the preconfigured collections by @Patrick_Hofman1 useful.

Certified Dynatrace Master | TEMPEST a.s., Slovakia, Dynatrace Master Partner

Thanks, again.  that latest curl statement still seems to be pulling everything, for every APPLICATION-*.

I have been able to get a little closer using Postman using your suggestions, it's still retrieving every APPLICATION, but the format's a little easier to read, and the apdex I'm looking for appears to be the 1st value in a list of dozens/hundreds.  Just need to pare that down a bit.
The Patrick Hofman collections look promising, but there seems to be lorem ipsum throughout, and I don't know what to replace with what.
I'll keep digging - thank you again for your help.

 

No, it will definitely filter out only the application you need. But it will receive datapoints for the interval specified.

 

If you need a single value, then you need to apply the :fold(avg) transformation to the metric selector:

builtin:apps.web.apdex.userType:splitBy("dt.entity.application"):names:avg:auto:fold(avg)

Then you will see only a single value (appdex average for the interval).

Certified Dynatrace Master | TEMPEST a.s., Slovakia, Dynatrace Master Partner