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

Filtering data in metric selector by resource

manjunathcr22
Participant

https://xxx12345.live.dynatrace.com/api/v2/metrics/query?metricSelector=builtin:host.net.nic.packets

{
"totalCount": 5744,
"nextPageKey": null,
"resolution": "1h",
"result": [
{
"metricId": "builtin:host.net.nic.packets.errors",
"dataPointCountRatio": 0.0557168,
"dimensionCountRatio": 0.11488,
"data": [
{
"dimensions": [
"HOST-12D11112621D0E22",
"NETWORK_INTERFACE-43D233184321318B"
],
"dimensionMap": {
"dt.entity.network_interface": "NETWORK_INTERFACE-43D233184321318B",
"dt.entity.host": "HOST-12D11112621D0E22"
},
"timestamps": [
1658401200000,
1658404800000
],
"values": [
0,
0
]
},
{
"dimensions": [
"HOST-9B8A00E6513ADF11",
"NETWORK_INTERFACE-1A8AFAF06F88471F"
],
"dimensionMap": {
"dt.entity.network_interface": "NETWORK_INTERFACE-1A8AFAF06F88471F",
"dt.entity.host": "HOST-9B8A00E6513ADF11"
},
"timestamps": [
1658401200000,
1658404800000
],
"values": [
0,
0
]
},

....


For above data we intend to retrieve data in chunks of resources since it has 5744 resources.

Since metricSelector pagination is not supported we intend to use get entities api to get entities based on first dimension. i.e, host

https://xxx84234.live.dynatrace.com/api/v2/entities?entitySelector=type("host")

Here we intend to get all resources in paginated fashion.
The list of entityIds obtained we will use those in metricSelector filter based like builtin:host.net.nic.packets.errors:names:filter(or(eq("dt.entity.host","HOST-9B8A00E6513ADF75"))).


Here we wanted to know is there any another approach for filtering data in metric selector using different transformation since or(eq(),eq(),...) this transformation becomes lengthier?

Any other suggestions to get data in chunks will be helpful

1 REPLY 1

ChadTurner
DynaMight Legend
DynaMight Legend

@manjunathcr22 were you able to get a solution to this problem? 

-Chad