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

V2 API Metrics Questions

louis_gallo
Helper

In the Dynatrace V2 Metrics API, I have a few questions:

 

1) Can I set a time limit up for a DT V2 API query, or do I need to do that programmatically in my scripting? I ask because I would like it to timeout if a query is trying too hard or trying to return too much data.

 

2) Can I limit the amount of data that my API query will pull back? Once in a while, a query will return a huge amount of data.

 

3) Can I exclude certain data? For instance, when I pull disk data for a server, once in a while, I pull back an entity with thousands of disks from containers. I'd like to try and limit that in the query.

 

Any advice would be greatly appreciated.

 

Lou

1 REPLY 1

mark_bley
Dynatrace Champion
Dynatrace Champion

Hi @louis_gallo 

 

  1. IMO yes you should be handling timeouts, however the Dynatrace API will response with a 429 code in case it cannot process your request just yet. In that case I usually retry a couple of seconds later until my requests gets processed.
  2. Some API Endpoints give you the option to set a pageSize in order to limit the amount of data you get back. Other than that you could also set from/to parameters for a shorter timeframe.
  3. Again here you will find some endpoints let you specify an entitySelector to reduce the scope of your query. For your example I would use the entitySelector either directly in the metric query or through the entitySelector parameters e.g: 

 

builtin:host.disk.free:filter(and(or(in("dt.entity.disk",entitySelector("type(disk),entityName.equals(~"/var/vcap/store~")"))))):splitBy("dt.entity.disk")

 

Hope this helps.

Best,
Mark

Featured Posts