-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Fixing tagging on submetrics #609
Conversation
Codecov Report
@@ Coverage Diff @@
## master #609 +/- ##
==========================================
- Coverage 62.04% 62.03% -0.01%
==========================================
Files 97 97
Lines 7501 7510 +9
==========================================
+ Hits 4654 4659 +5
- Misses 2589 2593 +4
Partials 258 258
Continue to review full report at Codecov.
|
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.
LGTM, sorry for breaking this and thanks for fixing it!
stats/stats.go
Outdated
if st == other { | ||
return true | ||
} | ||
if st == nil || other == nil || len(st.tags) < len(other.tags) { |
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.
Ah, actually, I'm not sure, but I think that if other == nil || len(other.tags) == 0
, then we should always return true
, since every set contains the empty set.
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.
actually, nil
is not an empty set, but if you indeed pass an empty set you will get a true
response.
I questioned myself that when implementing, then I went to a Ruby repl and tried something like [1,2,3].includes?(nil)
and got false
, so I decided to follow the same approach.
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 have no idea what ruby does, but in the case of SampleTags
, a nil
pointer is basically the same as an empty tag set. I'm not very familiar with how tagging of submetrics is supposed to work and if this is the desired behaviour though, just that mathematically the empty set is a subset of all sets.
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 don't really care about that. Let's make that return true
then.
Fixes #590 by validating that sub metric tags are included in the sample tags.