Merge branch 'release-1.6'

This commit is contained in:
Frederic Branczyk 2017-05-22 13:44:44 +02:00
commit 45df5c2daf
No known key found for this signature in database
GPG key ID: CA14788B1E48B256
5 changed files with 103 additions and 52 deletions

View file

@ -1,3 +1,9 @@
## 1.6.3 / 2017-05-18
* [BUGFIX] Fix disappearing Alertmanger targets in Alertmanager discovery.
* [BUGFIX] Fix panic with remote_write on ARMv7.
* [BUGFIX] Fix stacked graphs to adapt min/max values.
## 1.6.2 / 2017-05-11 ## 1.6.2 / 2017-05-11
* [BUGFIX] Fix potential memory leak in Kubernetes service discovery * [BUGFIX] Fix potential memory leak in Kubernetes service discovery

View file

@ -506,6 +506,7 @@ func alertmanagerFromGroup(tg *config.TargetGroup, cfg *config.AlertmanagerConfi
var res []alertmanager var res []alertmanager
for _, lset := range tg.Targets { for _, lset := range tg.Targets {
lset = lset.Clone()
// Set configured scheme as the initial scheme label for overwrite. // Set configured scheme as the initial scheme label for overwrite.
lset[model.SchemeLabel] = model.LabelValue(cfg.Scheme) lset[model.SchemeLabel] = model.LabelValue(cfg.Scheme)
lset[pathLabel] = model.LabelValue(postPath(cfg.PathPrefix)) lset[pathLabel] = model.LabelValue(postPath(cfg.PathPrefix))
@ -516,7 +517,8 @@ func alertmanagerFromGroup(tg *config.TargetGroup, cfg *config.AlertmanagerConfi
lset[ln] = lv lset[ln] = lv
} }
} }
lset := relabel.Process(lset, cfg.RelabelConfigs...)
lset = relabel.Process(lset, cfg.RelabelConfigs...)
if lset == nil { if lset == nil {
continue continue
} }

View file

@ -423,3 +423,30 @@ func (a alertmanagerMock) url() *url.URL {
} }
return u return u
} }
func TestLabelSetNotReused(t *testing.T) {
tg := makeInputTargetGroup()
_, err := alertmanagerFromGroup(tg, &config.AlertmanagerConfig{})
if err != nil {
t.Fatal(err)
}
if !reflect.DeepEqual(tg, makeInputTargetGroup()) {
t.Fatal("Target modified during alertmanager extraction")
}
}
func makeInputTargetGroup() *config.TargetGroup {
return &config.TargetGroup{
Targets: []model.LabelSet{
model.LabelSet{
model.AddressLabel: model.LabelValue("1.1.1.1:9090"),
model.LabelName("notcommon1"): model.LabelValue("label"),
},
},
Labels: model.LabelSet{
model.LabelName("common"): model.LabelValue("label"),
},
Source: "testsource",
}
}

File diff suppressed because one or more lines are too long

View file

@ -557,24 +557,40 @@ Prometheus.Graph.prototype.updateGraph = function() {
}); });
// Find and set graph's max/min // Find and set graph's max/min
var min = Infinity; if (self.isStacked() === true) {
var max = -Infinity; // When stacked is toggled
self.data.forEach(function(timeSeries) { var max = 0;
timeSeries.data.forEach(function(dataPoint) { self.data.forEach(function(timeSeries) {
var currSeriesMax = 0;
timeSeries.data.forEach(function(dataPoint) {
if (dataPoint.y > currSeriesMax && dataPoint.y != null) {
currSeriesMax = dataPoint.y;
}
});
max += currSeriesMax;
});
self.rickshawGraph.max = max*1.05;
self.rickshawGraph.min = 0;
} else {
var min = Infinity;
var max = -Infinity;
self.data.forEach(function(timeSeries) {
timeSeries.data.forEach(function(dataPoint) {
if (dataPoint.y < min && dataPoint.y != null) { if (dataPoint.y < min && dataPoint.y != null) {
min = dataPoint.y; min = dataPoint.y;
} }
if (dataPoint.y > max && dataPoint.y != null) { if (dataPoint.y > max && dataPoint.y != null) {
max = dataPoint.y; max = dataPoint.y;
} }
});
}); });
}); if (min === max) {
if (min === max) { self.rickshawGraph.max = max + 1;
self.rickshawGraph.max = max + 1; self.rickshawGraph.min = min - 1;
self.rickshawGraph.min = min - 1; } else {
} else { self.rickshawGraph.max = max + (0.1*(Math.abs(max - min)));
self.rickshawGraph.max = max + (0.1*(Math.abs(max - min))); self.rickshawGraph.min = min - (0.1*(Math.abs(max - min)));
self.rickshawGraph.min = min - (0.1*(Math.abs(max - min))); }
} }
var xAxis = new Rickshaw.Graph.Axis.Time({ graph: self.rickshawGraph }); var xAxis = new Rickshaw.Graph.Axis.Time({ graph: self.rickshawGraph });