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

How GET /metrics/query work for calc:service metric ?

MAkimov
Mentor

Hello 

 

I have Calculated service metric.

This metric have filter by Service Display name 

Screenshot_3.png

 

when I use a request GET /metrics/query via api I don't see data 

Screenshot_1.png

 

why is the query GET /metrics/query not returning data ?

 

as a workaround I added filter by entity type and entity name

it works

Screenshot_2.png

 

we send a metric to an external system and we cannot always know which entities they are limited to.
The restrictions have already been set by the user who created the metric.

 

I don't quite understand how this api works.
In my understanding, we refer to the unique name of a metric that has limitations.

Why api tries to search all over the environment?

2 REPLIES 2

Radu
Dynatrace Pro
Dynatrace Pro

Hello,

 

As the documentation says, you must specify at least one of 'type' or 'entityId' when making a query.

Radu_0-1624879945907.png

 

It is not required to know in advance the entities. Simply leave it as 'entitySelector=type(SERVICE)' in your query parameters and that should be general enough. Your calculated service metric will only be collected for Service entities anyway.

 

I hope this helps.

 

Best regards,

Radu

Unfortunately, this is not so

 

firstly, As the documentation says entitySelector is an optional parameter 

https://www.dynatrace.com/support/help/dynatrace-api/environment-api/metric-v2/get-data-points/ 

MAkimov_1-1624881259825.png

 

secondly, I tried to use only the type parameter - the result is similar that there is no data