diff --git a/storage/metric/compaction_regression_test.go b/storage/metric/compaction_regression_test.go index 642d8f614..58466ceeb 100644 --- a/storage/metric/compaction_regression_test.go +++ b/storage/metric/compaction_regression_test.go @@ -16,6 +16,7 @@ package metric import ( "flag" "fmt" + "sort" "testing" "time" @@ -34,7 +35,7 @@ func generateTestSamples(endTime clientmodel.Timestamp, numTs int, samplesPerTs startTime := endTime.Add(-interval * time.Duration(samplesPerTs-1)) for ts := 0; ts < numTs; ts++ { metric := clientmodel.Metric{} - metric["name"] = clientmodel.LabelValue(fmt.Sprintf("metric_%d", ts)) + metric[clientmodel.MetricNameLabel] = clientmodel.LabelValue(fmt.Sprintf("metric_%d", ts)) for i := 0; i < samplesPerTs; i++ { sample := &clientmodel.Sample{ Metric: metric, @@ -44,6 +45,7 @@ func generateTestSamples(endTime clientmodel.Timestamp, numTs int, samplesPerTs samples = append(samples, sample) } } + sort.Sort(samples) return samples } @@ -92,7 +94,7 @@ func checkStorageSaneAndEquivalent(t *testing.T, name string, ts *TieredStorage, } entire, err := ts.DiskStorage.MetricSamples.ForEach(&MetricSamplesDecoder{}, &AcceptAllFilter{}, cc) if err != nil { - t.Fatalf("%s: Error dumping samples: %s", name, err) + t.Fatalf("%s: Error checking samples: %s", name, err) } if !entire { t.Fatalf("%s: Didn't scan entire corpus", name) diff --git a/web/static/js/graph.js b/web/static/js/graph.js index a64a13dd6..81463d1d7 100644 --- a/web/static/js/graph.js +++ b/web/static/js/graph.js @@ -341,7 +341,7 @@ Prometheus.Graph.prototype.updateRefresh = function() { Prometheus.Graph.prototype.renderLabels = function(labels) { var labelStrings = []; for (label in labels) { - if (label != "name") { + if (label != "__name__") { labelStrings.push("" + label + ": " + labels[label]); } } @@ -349,10 +349,10 @@ Prometheus.Graph.prototype.renderLabels = function(labels) { } Prometheus.Graph.prototype.metricToTsName = function(labels) { - var tsName = labels["name"] + "{"; + var tsName = labels["__name__"] + "{"; var labelStrings = []; for (label in labels) { - if (label != "name") { + if (label != "__name__") { labelStrings.push(label + "=\"" + labels[label] + "\""); } } @@ -437,7 +437,7 @@ Prometheus.Graph.prototype.updateGraph = function(reloadGraph) { graph: self.rickshawGraph, formatter: function(series, x, y) { var swatch = ''; - var content = swatch + series.labels["name"] + ": " + y + '
'; + var content = swatch + series.labels["__name__"] + ": " + y + '
'; return content + self.renderLabels(series.labels); }, onRender: function() {