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

Help with filter please - API

CrazyHarry
Participant

I am really stuck - Trying to create a  filter for :

dt.entity.cloud_application

This is the query that I'm trying to apply the filter for cloud application to. This query returns all apps within a management zone. Trying to filter by a single app or a list of apps.

url = 'https://xxxxxx/e/xxxxx/api/v2/metrics/query?metricSelector=' \
'(builtin:kubernetes.pods:last:splitBy("dt.entity.cloud_application"):sum:sort(value(avg,descending))):' \
'names:fold(auto)&from=1739297079132&to=1739304279132&mzName=mzId(MBF)'
Can someone please provide me with the proper syntax for this API request?

 

4 REPLIES 4

PacoPorro
Dynatrace Leader
Dynatrace Leader

try  without quotes


https://xxxxxx/e/xxxxx/api/v2/metrics/query?metricSelector=(builtin:kubernetes.pods:last:splitBy("dt.entity.cloud_application"):sum:sort(value(avg,descending))):names:fold(auto)&from=1739297079132&to=1739304279132&mzName=mzId(MBF)

Sorry about that, my question wasn't clear.  I fixed that.   What I'm looking for is a query where I can specify one or more apps.

IzabelaRokita
Community Team
Community Team

Hey @CrazyHarry , did you manage to find the solution to your problem? If so, it would be amazing if you've shared it with the rest of the Community! If not, let me know, and I'll look for some further assistance 😊

Here is the solution:  

 

              "(builtin:kubernetes.workload.cpu_usage:filter(and(or(in(\"dt.entity.cloud_application_namespace\"," \
              "entitySelector(\"type(cloud_application_namespace),entityName.equals(~\"" + Namespace_user + "~\")\"))))): " \
                "splitBy(\"dt.entity.cloud_application\"):percentile(90.0):sort(value(percentile(90.0),descending))):" \
                "names:fold(percentile(90))," \
                "(builtin:kubernetes.workload.pods_desired:filter(and(or(in(\"dt.entity.cloud_application_namespace\"," \
                "entitySelector(\"type(cloud_application_namespace),entityName.equals(~\"" + Namespace_user + "~\")\"))))): " \
              "splitBy(\"dt.entity.cloud_application\"):max:sort(value(max,descending))):names:fold(percentile(90)), " \
              "(builtin:kubernetes.workload.memory_working_set:filter(and(or(in(\"dt.entity.cloud_application_namespace\", " \
              "entitySelector(\"type(cloud_application_namespace),entityName.equals(~\"" + Namespace_user + "~\")\"))))):" \
                "splitBy(\"dt.entity.cloud_application\"):percentile(90.0):sort(value(percentile(90.0),descending))):" \
                "names:fold(percentile(90))&" \
                "from=" + str(start_epoch_time)  + "&to=" + str(end_epoch_time)  + "&resolution=1m&mzSelector=mzName(" + MNE + ")"

Featured Posts