I want to create a line chart that displays the response time metric for a selected service. I need it to be dynamic, so I’ve set up a variable. Here’s the variable definition:
fetch dt.entity.service
| fields entity.name
When the user selects an entity.name, the line chart should update and display the corresponding metric for that service.
I’ve tried the following query:
timeseries response_time = percentile(dt.service.request.response_time, 50),
by: { dt.entity.service },
filter: { in(id, classicEntitySelector("type(service),fromRelationship.IS_SERVICE_OF(type(CLOUD_APPLICATION),entityName.equals($Entity'))")) }
I see few problem with this query:
- $Entity is string variable, so it should be explicitly concatenated with the rest of entity select expressions
- If you want to filter by service name (variable values query suggests it), entity selector is incorrect
- the identification of the service id in metric is dt.entity.service, so it should be used in in() filtering expression
This query should work better:
timeseries response_time = percentile(dt.service.request.response_time, 50),
by: { dt.entity.service },
filter: { in(dt.entity.service, classicEntitySelector(concat("type(service),entityName.equals(",$Entity,")"))) }
Result looks like this:
yep, thanks a lot
I finally figured it out.