-
Notifications
You must be signed in to change notification settings - Fork 184
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
Gather sort #39
Gather sort #39
Conversation
@@ -66,7 +67,7 @@ impl RegistryCore { | |||
} | |||
|
|||
fn gather(&self) -> Vec<proto::MetricFamily> { | |||
let mut mf_by_name = HashMap::new(); | |||
let mut mf_by_name = HashMap::with_capacity(self.colloctors_by_id.len()); |
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.
you can use BtreeMap directly.
// here, even for inconsistent metrics. So sort equal metrics | ||
// by their timestamp, with missing timestamps (implying "now") | ||
// coming last. | ||
m1.get_timestamp_ms().cmp(&m2.get_timestamp_ms()) |
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.
need to check timesamp_ms is none?
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.
Ported from client_golang, that is the way client_golang choose, rust should be the same, as it is ported from client_golang.
LGTM |
Resolved #32
PTAL @siddontang @disksing