Use slices instead of linked lists for Metric

Also:

* Remove Gob encoder/decoder
* Stop using custom encoders/decoders for Timestamps (both ugorji and the Golang JSON codecs use nanosecond precision).
* Use idiomatic way to check for existence in metric.LastSample()
This commit is contained in:
Alfonso Acosta
2016-07-30 01:11:06 +00:00
parent 15cf1e16b2
commit b8bf60c6f1
9 changed files with 130 additions and 288 deletions

View File

@@ -62,7 +62,7 @@ func TestReporter(t *testing.T) {
}
if memoryUsage, ok := node.Metrics[process.MemoryUsage]; !ok {
t.Errorf("Expected memory usage metric, but not found")
} else if sample := memoryUsage.LastSample(); sample == nil {
} else if sample, ok := memoryUsage.LastSample(); !ok {
t.Errorf("Expected memory usage metric to have a sample, but there were none")
} else if sample.Value != 0. {
t.Errorf("Expected memory usage metric sample %f, got %f", 0., sample.Value)