FACET CASES ... AS broken my dashboard when apply filter

I have a dashboard for my project with multi teams. So, I’m trying to use FACET CASES to create conditions to apply filters on entire dashboard.

My query is:

 SELECT count(groupedRequestUrl) FROM AjaxRequest
   WHERE appName = 'my-app' AND requestUrl LIKE '%mydomain.com%'
   SINCE 3 hour ago
   FACET CASES(
      WHERE groupedRequestUrl RLIKE r'.*conditionA*' AS 'Team A',
      WHERE groupedRequestUrl RLIKE r'.*conditionB*' AS 'Team B')
   OR groupedRequestUrl

And I’ve marked Filter current dashboard. This query show me a table like that:

Cases Total
Team A 1
Team B 2
  1. When I click on table row to apply filter, it broken my dashboard and shows Ops! Something wrong!. It’s a bug?
  2. If I put an AS 'groupedRequestUrl' at the end of FACET CASES, the applied filter is groupedRequestUrl = 'Team A', but no results.
  3. If I remove AS 'Team A' on CASE, the applied filter is groupedRequestUrl = 'groupedRequestUrl RLIKE ...', but no results.
  4. If I remove AS 'groupedRequestUrl' in the end of FACET, it broken my dashboard again.

How can I group urls and filter like I want?

– EDIT

The problem is on OR requestGroupUrl after FACET CASES.

Hi @renato.holanda1 ,

would it be possible for you to share a permalink to this dashboard / chart. So that one of our Dashboard experts can dig a little deeper into this for you.

Only an NR Admin will be able to access it, so it is perfectly safe to share this in the community.

Sorry for the delay. I was on vacation!

Here the dashboard link: https://onenr.io/0qwL26PWOj5

Hi @renato.holanda1

Welcome back from vacation, I hope you had a great time.

I will go ahead and loop in the engineer to let them know you have followed up with the link to the dashboard in question.

Please note they will reply here via this post.

Should you have any new updates or questions please let us know! We are here to help.

Hi @renato.holanda1

It doesn’t look like there is a way to accomplish this in a scalable way, when you click a filter it applies it as a simple where condition to all the widgets. Your facet case is taking a substring of groupRequestUrl and turning it into a new field for the team label, but that label doesn’t actually exist in the underlying data so you can’t really filter against is inside the query. You could wrap the whole thing like

select * from (SELECT count(groupedRequestUrl) FROM AjaxRequest WHERE appName = 'my-app' AND requestUrl LIKE '%mydomain.com%' SINCE 3 hour ago FACET CASES( WHERE groupedRequestUrl RLIKE r'.*conditionA*' AS 'Team A', WHERE groupedRequestUrl RLIKE r'.*conditionB*' AS 'Team B') OR groupedRequestUrl)

and that would fix the immediate problem but only for just the one widget and that adds some extra timestamp columns and nonsense that are going to make any other widget that much harder to build.

You could potentially, add extra tabs to the dashboard and pre filter them to achieve the groupings you are looking for.

I have the same issue. What I find odd is that removing AS makes my dashboard and FACET work as expected. However, adding AS breaks it. Isn’t the AS clause only used for giving the group a human-readable value? I wouldn’t expect a different behavior when adding the AS clause.
Here is my query:

SELECT count(*) FROM Log FACET cases(WHERE pod_name LIKE '%-2', WHERE pod_name LIKE '%-1', WHERE pod_name LIKE '%-0')

And with the AS clauses:

SELECT count(*) FROM Log FACET cases(WHERE pod_name LIKE '%-2' AS 'Pod-2', WHERE pod_name LIKE '%-1'  AS 'Pod-1', WHERE pod_name LIKE '%-0' AS 'Pod-0')

Hi @cloudnative

Thanks for reaching out, I hope you are well.

I believe whats happening here is where you are placing AS. It should be places where “count (*)” is.

This would likely be the cause of the change in behaviour. I hope this was helpful, please let me know if you have additional questions.

Hello @dcody,

Thank you for your reply. However, what I want to achieve is having human-readable FACET cases thus, I’m using FACET…AS clause. The documentation describes it as exactly what I’m trying to achieve, however the behaviour is different

Hi @cloudnative

I have gone ahead and looped in the support engineering team here. Note they will reach out via this post with their findings.

Should you have any questions or updates, please do reach out.

1 Like

@cloudnative - I believe this is expected behavior. cases is the default name of the facet attribute created by the cases function, while Pod-2 and Pod-1 are the values of that attribute. Can you provide a link to the actual queries?

Hi @dkoyano @dcody
I hope you’re doing great. I also ran into this behavior and I think it’s a bug that maybe can be fixed in the UI.

Use case
My use-case is to create an HTTP Status errors dashboard with a user agent bar chart to filter the dashboard on. You can find the dashboard here. My goal is to group user agents so that all iOS and all Android user agents are grouped together for readability and usefulness (they contain different versions). This is the query where Facet Linking is working perfectly :ok_hand:

FROM Log
SELECT count(*) 
WHERE pod_name like 'loadbalancer%' 
FACET CASES (
  WHERE user.agent LIKE '%CFNetwork%' as 'iOS app', 
  WHERE user.agent LIKE '%okhttp/%' as 'Android app'
)
LIMIT 30 

When I click a facet, the dashboard is correctly filtered. This filter gets applied:

Problem
However, I do need to see all other user agents as well. A solution seems to be to use the "Facet non-matching data with OR" from the documentation. When I change the query to include OR user.agent like this…

FROM Log
SELECT count(*) 
WHERE pod_name like 'loadbalancer%' 
FACET CASES (
  WHERE user.agent LIKE '%CFNetwork%' as 'iOS app', 
  WHERE user.agent LIKE '%okhttp/%' as 'Android app'
+ ) OR user.agent
LIMIT 30 

… I do see other user agents in the bar chart, however when I now click on any of the facets to filter on them, I get this error message.

What I tried

  • Changed the query to include OR user.agent AS 'user.agent'. This makes facet linking work for the facet non-matching data, but the facet cases are not working because of the different attribute “key”/“name”. I think this is because then an “=” (equals) condition is assumed.

  • I’m using the latest Safari browser, but I also tried Chrome where I noticed the same error

Does my description make sense? From my perspective I think the solution would be to distinguish between the OR case and the CASES in the UI code that handles facet linking. The CASES should be applied as attribute filters just like they would without the OR case. Thanks already for looking into this!

@adrian59 - Whenever I see a generic and unuseful message like the one you are getting it’s either a bug or there needs to be a better error message being displayed. I will reach out to you in the ticket to get some additional information and have the Engineering team take a look.

@dkoyano Great thank you!

Hi @adrian59

I can see that @dkoyano is currently working on the case and will reach out via the case.

Should you have any additional updates, please do reach out.