mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-10 07:34:04 -08:00
Switch to new "__name__" metric name label.
This also fixes the compaction test, which before worked only because the input sample sorting was accidentally equal to the resulting on-disk sample sorting. Change-Id: I2a21c4b46ba562424b27058fc02eba84fa6a6006
This commit is contained in:
parent
c3b282bd14
commit
cc04238a85
|
@ -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)
|
||||
|
|
|
@ -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("<strong>" + label + "</strong>: " + 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 = '<span class="detail_swatch" style="background-color: ' + series.color + '"></span>';
|
||||
var content = swatch + series.labels["name"] + ": <strong>" + y + '</strong><br>';
|
||||
var content = swatch + series.labels["__name__"] + ": <strong>" + y + '</strong><br>';
|
||||
return content + self.renderLabels(series.labels);
|
||||
},
|
||||
onRender: function() {
|
||||
|
|
Loading…
Reference in a new issue