Add unique_on to Internal Events Tracking
Problem
We want to continue progressing toward our event system vision outlined in the prototypical documentation and our objective to deprecate the old system. We need to take the next steps on top of Internal Events Tracking - iteration 0 (#407858 - closed)
Desired Outcome
Exact outcome TBD, this is still a placeholder that needs to be filled depenending on Users should be able to define a property from the standard context in a RedisHLL metric definition like this:
options:
events:
- i_code_review_user_create_mr
unique_on: user_id
Notice that "unique_on" might need some wordsmithing.
Limitations
- In this version the only valid properties to use for
unique_on
are those defined in the Standard Context. (namespace_id
,project_id
anduser_id
) - Since each Redis event is stored under one Redis key for now, we cannot allow multiple different
unique_on
on the same event.
Implementation
- Load the metric definitions and find the matching definitions based on event name
- Validate that a maximum of one
unique_on
property is defined. E.g. one metric cannot defineunique_on: user_id
and another oneunique_on: namespace_id
for the same event. -
InternalEventsTracking.track_event
should pass the value of the property specified byunique_on
toUsageDataCounters::HLLRedisCounter.track_event
Edited by Sebastian Rehm