Dashboarding
Dynatrace dashboards, notebooks, and data explorer explained.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

classic entity to smartscape functions conversion

R928492
Visitor
timeseries {
    count = sum(
        dt.service.request.count,
        scalar: true,
        filter: {
            (
                in(
                    dt.entity.service,
                    classicEntitySelector(
                        "type(service),entityName.equals(\"serviceA - Site 1\")"
                    )
                )
            )
            OR
            (
                in(
                    dt.entity.service,
                    classicEntitySelector(
                        "type(service),entityName.equals(\"serviceA - Site 2\")"
                    )
                )
            )
        }
    )}

 

Until now i was using the above DQL to get the count of requests for a particular services and show it on the dashboard. But now i am getting a warning 

Classic entity functions are deprecated. Please use Smartscape functions instead.

The dt.entity.* fields are deprecated. Please use dt.smartscape.*.

 

Can someone help me get the count as per new standards so that i don't get this warning on my dashboard

3 REPLIES 3

t_pawlak
Leader

Hi, you can at least simplify the query and remove the need for classicEntitySelector(...) by filtering directly on the service name:

timeseries {
  count = sum(
    dt.service.request.count,
    scalar: true,
    filter: {
      entityName(dt.entity.service) == "serviceA - Site 1"
      OR
      entityName(dt.entity.service) == "serviceA - Site 2"
    }
  )
}

This keeps the same logic and is much easier to read.

scalar.jpg
That said, it still uses dt.entity.service, so it may not fully remove the deprecation warning. From what I can see, Smartscape is the target model, but for this specific metric/filter combination there doesn’t seem to be a clean 1:1 replacement yet. Smartscape entities expose both id and id_classic, which suggests some service metrics still rely on the classic entity dimension today. So the simplified version above is probably the most practical option for now, even if the warning remains.



R928492
Visitor

Thanks for the suggestion on simplifying the query . Will rely on this for now while exploring a better option with no warnings.

yeah,
I tried a Smartscape-based approach as well, for example:

smartscapeNodes "SERVICE"
| filter name == "astroshop-frontend" or name == "CustomerFrontendREST"
| fields name, id_classic
| join [
    timeseries count = sum(dt.service.request.count), by:{dt.entity.service}
  ],
  on: { left[id_classic] == right[dt.entity.service] },
  fields: { count = count }
| fields name, count


And I recived this:
smart_metrics.jpg
It works, but it still relies on dt.entity.service on the metric side, so the warning remains.
That makes me think the metric dimension for dt.service.request.count is still tied to the classic entity model, even if Smartscape can already be used to resolve the services. Dynatrace documents Smartscape nodes with both id and id_classic, which suggests this kind of bridge is still needed in some cases.
Smartscape on Grail 
So at least for now, a pure Smartscape-only rewrite does not seem to be available for this specific metric/filter combination.
Because of that, the simplified version with:

entityName(dt.entity.service) == ...

is probably still the most practical option, even if the warning stays

Featured Posts