-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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
Fix fingerprint construction and comparison bugs #121
Conversation
} | ||
|
||
return false | ||
return f.String() < o.String() |
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.
One caveat:
What about the stringified LENGTH in the format HASH-F-LENGTH-L? Will this handle said case appropriately?
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.
Question: String() is an alias for ToRowKey(), so even if "1000" < "2" by that definition, that ordering is still consistent with what's on disk, right?
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.
labelMatterLength -> labelMatterModulus
?
labelMatterModulus := labelMatterLength % 10
Format string takes precision up to two digits? Then you can merely f.String() < o.String()
?
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 believe that is correct. I would want to verify it, though.
2013/4/9 juliusv notifications@github.com
In model/fingerprinting.go:
@@ -151,20 +152,7 @@ func (f fingerprint) LastCharacterOfLastLabelValue() string {
}func (f fingerprint) Less(o Fingerprint) bool {
- if f.Hash() < o.Hash() {
return true
- }
- if f.FirstCharacterOfFirstLabelName() < o.FirstCharacterOfFirstLabelName() {
return true
- }
- if f.LabelMatterLength() < o.LabelMatterLength() {
return true
- }
- if f.LastCharacterOfLastLabelValue() < o.LastCharacterOfLastLabelValue() {
return true
- }
- return false
- return f.String() < o.String()
Question: String() is an alias for ToRowKey(), so even if "1000" < "2" by
that definition, that ordering is still consistent with what's on disk,
right?—
Reply to this email directly or view it on GitHubhttps://github.com//pull/121/files#r3710121
.
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.
Well, the DTO fingerprint is just a proto version of String() / ToRowKey():
func (f fingerprint) ToDTO() *dto.Fingerprint {
return &dto.Fingerprint{
Signature: proto.String(f.ToRowKey()),
}
}
and then the LevelDB key is built from that via:
targetKey = &dto.SampleKey{
Fingerprint: fingerprint.ToDTO(),
Timestamp: fooTime,
}
So my theory should hold. Ok to just keep my code as it is now then?
Aside from that small nit, 👍 |
Seems like just using String() is the easiest way of doing this.
…ison Fix fingerprint construction and comparison bugs
Add a blog post on detecting and dealing with outliers.
Bug 2056802: scrape: Fix label_limits cache usage
No description provided.