12 Sep 2025 10:19 AM
In an application (dynatrace app), I added segments in my filterbar, and set the SegmentsProvider at the right level. Still when I query for entities with the `monitoredEntitiesClient.getEntities()` function, I get all entities and it doesn't take my chosen segment into account.
So my main question is: is, or will `monitoredEntitiesClient.getEntities()` be segment aware?
In my app this getEntities is used for many different Types, so this is programatically the best option for me as far as I can oversee.
12 Sep 2025 12:29 PM
Hi @SjoerdB
monitoredEntitiesClient.getEntities() is not segments aware and it is not planned to make it segments aware.
Instead, I would recommend that you query via DQL entities with queryExecutionClient and pass the segment filter in the params. With DQL you should be able to get all entities as you would be able to do this with monitoredEntitiesClient.getEntities()
Best,
Sini
14 Sep 2025 02:20 PM
Hi Sini,
Thank you for your answer!
For my first use-case (simple HOST based query), this would work perfectly (and I will implement it in the coming days), however this is harder for my other use-cases, where I don't know upfront which entity types will be requested by the customer. Customer is able to set the type manually (e.g. "HOST", "SERVICE", but also custom (device sub-)types e.g. vmware datastores. Hence a generic DQL to obtain the information would be harder to make (or am I overlooking something?)...
So would it be possible to reconsider the segment awareness of the getEntities() ?
Thanks,
Sjoerd
15 Sep 2025 08:30 AM
Hi Sjoerd,
With the new smartscapeNodes command you can query all entities (nodes) at once, independent of the entity type. It utilizes the Grail-native Smartscape storage. More entities will be added over time, currently it stores AWS & kubernetes entities if you participate in the previews.
For early next we have planned to add entities like host and process to the new storage.
Now, having in mind your custom app, with one DQL command, you can query the available types:
smartscapeNodes "*"
| fields type
| dedup type
Then, with another one, you can query the selected entities:
smartscapeNodes "*"
| filter in (type, array("K8S_NAMESPACE", "K8S_POD"))
Best,
Sini