Add property deduplication support to usage metrics (count distinct property values)
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 39.9k
- Forks
- 3.4k
- Avg merge
- 6h 51m
- Merged PRs (30d)
- 232
Description
Feature request
Is your feature request related to a problem?
Yes. Currently, usage metrics can only count the total number of events that match a filter. For many use cases, we need to count unique values of a property instead of total event count.
For example, I want to track "unique games played" per user, not just their total number of game sessions. If a user plays Game A five times and Game B three times, I want the usage metric to show "2 unique games" rather than "8 total sessions."
Describe the solution you'd like
Add a "Count distinct property values" aggregation option to usage metrics, similar to how insights support count(DISTINCT property).
The configuration would include:
- Aggregation type: Choose between "Count events" (current behavior) or "Count distinct property values" (new)
- Property to deduplicate on: When "Count distinct" is selected, specify which property to use (e.g.,
game_id,product_id,server_id)
This would allow usage metrics like:
- Unique games played (not total sessions)
- Unique products purchased (not total orders)
- Unique servers accessed (not total API calls)
Describe alternatives you've considered
- Using SQL insights with
count(DISTINCT properties.property_name)- This works for analysis but doesn't integrate with customer profiles or usage metrics - Creating separate events for each unique value - This is cumbersome and doesn't scale well
Additional context
This feature would make usage metrics significantly more powerful for measuring breadth of engagement (variety) rather than just depth (volume).
Debug info
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue does not name any files, tests, or entry points. Start by locating the usage metrics aggregation and configuration code, then compare it with the insights implementation of count(DISTINCT property); done means usage metrics can select event counts or distinct property values and the behavior is covered by tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- analytics
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100