28 Jun 2021
02:41 AM
- last edited on
28 Jun 2021
03:29 AM
by
MaciejNeumann
Hello
I have Calculated service metric.
This metric have filter by Service Display name
when I use a request GET /metrics/query via api I don't see data
why is the query GET /metrics/query not returning data ?
as a workaround I added filter by entity type and entity name
it works
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?
Hello,
As the documentation says, you must specify at least one of 'type' or 'entityId' when making a query.
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/
secondly, I tried to use only the type parameter - the result is similar that there is no data