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

View file

@ -423,3 +423,30 @@ func (a alertmanagerMock) url() *url.URL {
}
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
var min = Infinity;
var max = -Infinity;
self.data.forEach(function(timeSeries) {
timeSeries.data.forEach(function(dataPoint) {
if (self.isStacked() === true) {
// When stacked is toggled
var max = 0;
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) {
min = dataPoint.y;
}
if (dataPoint.y > max && dataPoint.y != null) {
max = dataPoint.y;
}
});
});
});
if (min === max) {
self.rickshawGraph.max = max + 1;
self.rickshawGraph.min = min - 1;
} else {
self.rickshawGraph.max = max + (0.1*(Math.abs(max - min)));
self.rickshawGraph.min = min - (0.1*(Math.abs(max - min)));
if (min === max) {
self.rickshawGraph.max = max + 1;
self.rickshawGraph.min = min - 1;
} else {
self.rickshawGraph.max = max + (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 });