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-08-01 10:21:57 +00:00
parent 15cf1e16b2
commit b8bf60c6f1
9 changed files with 130 additions and 288 deletions
+2 -2
View File
@@ -88,10 +88,10 @@ func TestReporter(t *testing.T) {
// Should have metrics
for key, want := range metrics {
wantSample := want.LastSample()
wantSample, _ := want.LastSample()
if metric, ok := node.Metrics[key]; !ok {
t.Errorf("Expected %s metric, but not found", key)
} else if sample := metric.LastSample(); sample == nil {
} else if sample, ok := metric.LastSample(); !ok {
t.Errorf("Expected %s metric to have a sample, but there were none", key)
} else if sample.Value != wantSample.Value {
t.Errorf("Expected %s metric sample %f, got %f", key, wantSample, sample.Value)