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
feat(cardinality): Implement cardinality reporting #3342
Conversation
77ad55b
to
021cd65
Compare
d7e8de0
to
0bcb7ff
Compare
0bcb7ff
to
8a8f404
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for updating the docs!
/// The callback can be called multiple times with different reports | ||
/// for the same `limit` or not at all if there was no change in cardinality. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there was no change in cardinality.
What does that mean? Is this function called only when going to redis and not when using a cache?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly! Which comes down to, it is valid to only call the callback when the actual cardinality in the window increased.
relay-cardinality/src/limiter.rs
Outdated
limits: HashSet<&'a CardinalityLimit>, | ||
reports: BTreeMap<&'a CardinalityLimit, Vec<CardinalityReport>>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be a single map instead of a hash set and a btreemap, with an empty Vec
if limit.report
is false?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just implemented it, but I it's actually wrong. There can be cardinality reports for limits which have not been exceeded.
I'll revert and rename the field to make it more clear!
859cfdb
to
0473d8c
Compare
* master: feat(metric-stats): Report cardinality to metric stats (#3360) release: 0.8.56 fix(perfscore): Adds span op tag to perf score totals (#3326) ref(profiles): Return retention_days as part of the Kafka message (#3362) ref(filter): Add GTmetrix to the list of web crawlers (#3363) fix: Fix kafka topic default (#3350) ref(normalization): Remove duplicated normalization (#3355) feat(feedback): Emit outcomes for user feedback events (#3026) feat(cardinality): Implement cardinality reporting (#3342)
Makes the cardinality limiter able to report cardinality per "sub"-scope and return the collected information.
Cardinality Limits can now opt-in into recording/reporting cardinality per limit/generated scope. The reports will be accumulated and exposed through the
CardinalityResult
.The collected reports are not yet used in Relay, it's a preparation to use the reports in a followup:
#skip-changelog