Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filtering by multiple custom properties #3719

Merged
merged 26 commits into from
Feb 12, 2024
Merged

Filtering by multiple custom properties #3719

merged 26 commits into from
Feb 12, 2024

Conversation

macobo
Copy link
Contributor

@macobo macobo commented Jan 24, 2024

Changes

This PR adds support to allow:

  • filtering by multiple custom properties (both frontend and backend)
  • (Under behavioral properties view) filtering by other properties when custom property filter applied

Follow-up to #3708

Constraints:

  • The same property cannot be filtered on multiple times (as that would require changing the request/query data schema)

Other notes:

  • I'm not super happy with the UI/UX. Let me know if you have suggestions!
  • I have yet to update the docs - looking to pair with someone for that?
Click here to see some screenshots!

image

image

Tests

  • Automated tests have been added
  • This PR does not require tests

Changelog

  • Entry has been added to changelog
  • This PR does not make a user-facing change

Documentation

  • Docs have been updated
  • This change does not need a documentation update

@macobo macobo marked this pull request as ready for review January 24, 2024 08:38
Copy link
Contributor

@RobertJoonas RobertJoonas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks good to me, but before approving I'd like to verify the UI on staging 👍

assets/js/dashboard/stats/modals/prop-filter-modal.js Outdated Show resolved Hide resolved
assets/js/dashboard/components/combobox.js Outdated Show resolved Hide resolved
macobo and others added 2 commits January 24, 2024 12:20
Co-authored-by: RobertJoonas <56999674+RobertJoonas@users.noreply.github.com>
@macobo macobo added the deploy-to-staging Special label that triggers a deploy to a staging environment label Jan 24, 2024
Copy link
Contributor

@RobertJoonas RobertJoonas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some more comments after having tested the UI out on staging.

  • Looks like contains filter breaks when multiple clauses are selected.

E.g.:
contains

will return 500 in all the reports.

  • In the custom prop breakdown report we’re allowing the user to pick any property from the dropdown.

I think only the prop_keys that have hits should be returned. What I mean is, it should not be possible to break down by a prop and then only see the (none) value in the returned list.



I suspect line 137 in filter_suggestions.ex is to blame, since it’s calling Query.remove_event_filters(query, [:props]). I don’t think we should do that anymore.

assets/js/dashboard/filters.js Outdated Show resolved Hide resolved
@macobo macobo removed the deploy-to-staging Special label that triggers a deploy to a staging environment label Jan 24, 2024
@ukutaht
Copy link
Contributor

ukutaht commented Jan 25, 2024

One comment about UX. Take this case:

  1. Add a filter for propA prop
  2. Change prop breakdown key to propB
  3. Click on one entry from the list

The result is that the filter for the propA filter gets overwritten. Was that intentional? I was expecting the UI to keep the propA filter and add the propB filter as well.

@macobo macobo marked this pull request as draft January 30, 2024 08:52
@macobo
Copy link
Contributor Author

macobo commented Jan 30, 2024

PR has been updated @RobertJoonas @ukutaht - please give it another look.

To make reviewing the changes easier here's an overview of new changes:

  • I've added support for matches_multiple in c517520. Not part of the original scope of this PR, but as result of my changes it started throwing 500s instead of silently failing.
  • We now show multiple filter boxes for property filters instead of chucking them into a single one. 5bdc9b8
  • I've fixed some issues around adding/removing filters and related behavior: 6195a38
  • Navigation from behavioral filters rows no longer removes other property filters: 4ecc344
  • We no longer show properties which only have (none) values in properties behavior tab: d38928b

@macobo macobo marked this pull request as ready for review January 30, 2024 13:40
Copy link
Contributor

@RobertJoonas RobertJoonas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, we're getting there! Not quite done with feedback yet, sorry... 😄

In addition to the inline comments I had about the code, I've tested things out locally, and noticed a couple of new things:

  1. In the prop filter modal, the blue "Add filter" button/link boundaries are huge and it feels a little weird when you click on a blank space and it will append new input fields into the view.
image
  1. It looks like prop_key suggestions are returned without the constraint of having them set up in site.allowed_event_props. We implemented this to "filter out garbage props" that we don't want displayed there. And another reason is to enforce customers to configure the props they want to see in the dashboard. I made sure it's working on prod, so I suppose it's introduced with this PR?

  2. Question: Is it the intended behaviour that the selected property in the behaviours (property breakdown) section will change when you add/remove filters? When I interact with the filters, I don't really expect the breakdown property to change 🤔

Screen.Recording.2024-01-31.at.17.36.01.mov

assets/js/dashboard/filters.js Outdated Show resolved Hide resolved
assets/js/dashboard/query.js Outdated Show resolved Hide resolved
assets/js/dashboard/filters.js Show resolved Hide resolved
@macobo
Copy link
Contributor Author

macobo commented Feb 1, 2024

Nice, we're getting there! Not quite done with feedback yet, sorry... 😄

Thank you for the review, no need to apologize, you are great! 🙇

  1. In the prop filter modal, the blue "Add filter" button/link boundaries are huge and it feels a little weird when you click on a blank space and it will append new input fields into the view.

Fixed.

  1. It looks like prop_key suggestions are returned without the constraint of having them set up in site.allowed_event_props. We implemented this to "filter out garbage props" that we don't want displayed there. And another reason is to enforce customers to configure the props they want to see in the dashboard. I made sure it's working on prod, so I suppose it's introduced with this PR?

That's odd - I didn't change anything here. I tried to reproduce by going to site settings > delete a prop > back to dashboard and the deleted property no longer showed.

  1. Question: Is it the intended behaviour that the selected property in the behaviours (property breakdown) section will change when you add/remove filters? When I interact with the filters, I don't really expect the breakdown property to change 🤔

Good question. This behavior existed pre-this-pr to avoid showing a blank screen when user would like to break down by a property that's not available. I think this is an easy fix but requires a bit of back-and-forth - would you be okay if I fixed this in a separate PR (for easier reviewability)?

@RobertJoonas
Copy link
Contributor

That's odd - I didn't change anything here. I tried to reproduce by going to site settings > delete a prop > back to dashboard and the deleted property no longer showed.

Hmm weird, I can't reproduce either anymore. You can ignore it for now then

Good question. This behavior existed pre-this-pr to avoid showing a blank screen when user would like to break down by a property that's not available. I think this is an easy fix but requires a bit of back-and-forth - would you be okay if I fixed this in a separate PR (for easier reviewability)?

Sure, makes sense!

Copy link
Contributor

@RobertJoonas RobertJoonas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Only docs left 👍

Copy link
Contributor

@ukutaht ukutaht left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@macobo macobo merged commit 1cb7982 into master Feb 12, 2024
5 checks passed
@macobo macobo deleted the prop-filter-modal branch February 12, 2024 07:04
macobo added a commit that referenced this pull request Feb 12, 2024
…changes

Follow-up to #3719

The previous behavior was predicated on:
- Allowing a single custom property filter
- Allowing breaking down only by the chosen custom property filter

Now these restrictions are removed the previous auto-switching just becomes annoying
macobo added a commit that referenced this pull request Feb 13, 2024
Feedback from original PR: #3719 (comment)

The FE approach would run into problems if you have >25 custom props, so excluding
in the BE allows avoiding problems
macobo added a commit that referenced this pull request Feb 26, 2024
…changes (#3777)

Follow-up to #3719

The previous behavior was predicated on:
- Allowing a single custom property filter
- Allowing breaking down only by the chosen custom property filter

Now these restrictions are removed the previous auto-switching just becomes annoying
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants