20 Jun 2024 05:50 PM - last edited on 08 Aug 2024 02:52 PM by Michal_Gebacki
I am retrieving process group instances using this kind of query: "/v2/entities?entitySelector=type(process_group_instance)&fields=toRelationships,fromRelationships,properties.metadata,properties.softwareTechnologies";
I am concerned that number of instances it returns is relatively large.
Would be removal of Relationships help with response size? Are the Relationships mandatory to retrieve process group instances? If Relationships can not be removed then what would be query optimization suggestions?
Solved! Go to Solution.
20 Jun 2024 06:32 PM
What is the goal ?
You can just pull pgis with entitySelector=type(process_group_instance) as parameter fields is optional.
If you want specific pgis extend the entitySelector with e.g. relationship to a Host, Host group, service, application...
type(PROCESS_GROUP_INSTANCE),fromRelationships.isProcessOf(type("HOST"),entityName("foo"))
Many possibilities...
20 Jun 2024 09:39 PM
The goal is to make the query faster. So that result of the query becomes shorter yet it should be sufficient to retrieve entities like business applications. And idea is to remove toRelationships and fromRelationships for that from the query.
21 Jun 2024 01:37 PM
I understand you want to make the query faster, was wondering what is the reason you need to export all the PGIs 🙂
As you noticed the number PGIs is quite huge so I would suggest reducing the fields to the necessary ones, and maybe extract more for specific entities afterwards.
21 Jun 2024 09:10 PM - edited 21 Jun 2024 09:10 PM
Agreed, first of all, use entitySelector to query only process group instances you are interested in. (using management zone, process group properties, etc). Secondly select just fields you need.
21 Jun 2024 05:39 AM
Hi,
You can use the fields value to reduce what you pull down and or select
Monitored entities API - GET entity type - Dynatrace Docs
Example below :
params = {
"entitySelector": 'type("Process_Group")',
"fields": "properties.softwareTechnologies,fromRelationships,toRelationships,properties,tags",
"Api-Token": "dt0c01."
}
Hope this helps