21 Jul 2022
04:03 PM
- last edited on
27 Mar 2023
10:17 AM
by
MaciejNeumann
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