mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Merge branch 'master' of github.com:grafana/grafana
This commit is contained in:
commit
0c94194a5b
@ -14,6 +14,7 @@
|
||||
* **Influxdb**: Support multiple tags in InfluxDB annotations. [#4550](https://github.com/grafana/grafana/pull/4550), thx [@adrianlzt](https://github.com/adrianlzt)
|
||||
* **LDAP**: Basic Auth now supports LDAP username and password, [#6940](https://github.com/grafana/grafana/pull/6940), thx [@utkarshcmu](https://github.com/utkarshcmu)
|
||||
* **LDAP**: Now works with Auth Proxy, role and organisation mapping & sync will regularly be performed. [#6895](https://github.com/grafana/grafana/pull/6895), thx [@Seuf](https://github.com/seuf)
|
||||
* **Alerting**: Adds OK as no data option. [#6866](https://github.com/grafana/grafana/issues/6866)
|
||||
|
||||
### Bugfixes
|
||||
* **API**: HTTP API for deleting org returning incorrect message for a non-existing org [#6679](https://github.com/grafana/grafana/issues/6679)
|
||||
|
@ -20,9 +20,10 @@ const (
|
||||
)
|
||||
|
||||
const (
|
||||
NoDataSetOK NoDataOption = "ok"
|
||||
NoDataSetNoData NoDataOption = "no_data"
|
||||
NoDataSetAlerting NoDataOption = "alerting"
|
||||
NoDataKeepState NoDataOption = "keep_state"
|
||||
NoDataSetAlerting NoDataOption = "alerting"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -35,7 +36,7 @@ func (s AlertStateType) IsValid() bool {
|
||||
}
|
||||
|
||||
func (s NoDataOption) IsValid() bool {
|
||||
return s == NoDataSetNoData || s == NoDataSetAlerting || s == NoDataKeepState
|
||||
return s == NoDataSetNoData || s == NoDataSetAlerting || s == NoDataKeepState || s == NoDataSetOK
|
||||
}
|
||||
|
||||
func (s NoDataOption) ToAlertState() AlertStateType {
|
||||
|
@ -94,7 +94,7 @@ func createDialer() (*gomail.Dialer, error) {
|
||||
if setting.Smtp.CertFile != "" {
|
||||
cert, err := tls.LoadX509KeyPair(setting.Smtp.CertFile, setting.Smtp.KeyFile)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, fmt.Errorf("Could not load cert or key file. error: %v", err)
|
||||
}
|
||||
tlsconfig.Certificates = []tls.Certificate{cert}
|
||||
}
|
||||
|
@ -49,8 +49,10 @@ func (qp *QueryParser) Parse(model *simplejson.Json, dsInfo *models.DataSource,
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if f.Func != "" {
|
||||
functions = append(functions, f)
|
||||
}
|
||||
}
|
||||
|
||||
query.FunctionList = functions
|
||||
|
||||
|
@ -81,6 +81,8 @@ func (parser *ResponseParser) Parse(res *http.Response, queryRef *Query) ([]*tsd
|
||||
if key == "cluster" && queryRef.AddClusterToAlias {
|
||||
namePrefix += value + " "
|
||||
}
|
||||
}
|
||||
for key, value := range mqeSerie.Tagset {
|
||||
if key == "host" && queryRef.AddHostToAlias {
|
||||
namePrefix += value + " "
|
||||
}
|
||||
|
@ -49,6 +49,28 @@ func TestWildcardExpansion(t *testing.T) {
|
||||
So(expandeQueries[2].RawQuery, ShouldEqual, fmt.Sprintf("`os.cpu.1.idle`|aggregate.min {cpu} where cluster in ('demoapp-1', 'demoapp-2') and host in ('staples-lab-1', 'staples-lab-2') from %v to %v", from, to))
|
||||
})
|
||||
|
||||
Convey("With two aggregate functions", func() {
|
||||
query := &Query{
|
||||
Metrics: []Metric{
|
||||
Metric{Metric: "os.cpu.3.idle", Alias: ""},
|
||||
},
|
||||
Hosts: []string{"staples-lab-1", "staples-lab-2"},
|
||||
Cluster: []string{"demoapp-1", "demoapp-2"},
|
||||
AddClusterToAlias: false,
|
||||
AddHostToAlias: false,
|
||||
FunctionList: []Function{
|
||||
Function{Func: "aggregate.min"},
|
||||
Function{Func: "aggregate.max"},
|
||||
},
|
||||
TimeRange: &tsdb.TimeRange{Now: now, From: "5m", To: "now"},
|
||||
}
|
||||
|
||||
expandeQueries, err := query.Build(availableMetrics)
|
||||
So(err, ShouldBeNil)
|
||||
So(len(expandeQueries), ShouldEqual, 1)
|
||||
So(expandeQueries[0].RawQuery, ShouldEqual, fmt.Sprintf("`os.cpu.3.idle`|aggregate.min|aggregate.max where cluster in ('demoapp-1', 'demoapp-2') and host in ('staples-lab-1', 'staples-lab-2') from %v to %v", from, to))
|
||||
})
|
||||
|
||||
Convey("Containg wildcard series", func() {
|
||||
query := &Query{
|
||||
Metrics: []Metric{
|
||||
|
@ -47,6 +47,7 @@ var noDataModes = [
|
||||
{text: 'Alerting', value: 'alerting'},
|
||||
{text: 'No Data', value: 'no_data'},
|
||||
{text: 'Keep Last State', value: 'keep_state'},
|
||||
{text: 'Ok', value: 'ok'},
|
||||
];
|
||||
|
||||
var executionErrorModes = [
|
||||
|
@ -89,7 +89,7 @@ function (_, TableModel) {
|
||||
if (column === 'sequence_number') { return; }
|
||||
if (!titleCol) { titleCol = index; }
|
||||
if (column === self.annotation.titleColumn) { titleCol = index; return; }
|
||||
if (_.includes(self.annotation.tagsColumn.replace(' ', '').split(","), column)) { tagsCol.push(index); return; }
|
||||
if (_.includes((self.annotation.tagsColumn || '').replace(' ', '').split(","), column)) { tagsCol.push(index); return; }
|
||||
if (column === self.annotation.textColumn) { textCol = index; return; }
|
||||
});
|
||||
|
||||
|
@ -207,6 +207,31 @@ describe('when generating timeseries from influxdb response', function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe('given annotation response', function() {
|
||||
describe('with empty tagsColumn', function() {
|
||||
var options = {
|
||||
alias: '',
|
||||
annotation: {},
|
||||
series: [
|
||||
{
|
||||
name: "logins.count",
|
||||
tags: {datacenter: 'Africa', server: 'server2'},
|
||||
columns: ["time", "datacenter", "hostname", "source", "value"],
|
||||
values: [
|
||||
[1481549440372, "America", "10.1.100.10", "backend", 215.7432653659507],
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
it('should multiple tags', function() {
|
||||
var series = new InfluxSeries(options);
|
||||
var annotations = series.getAnnotations();
|
||||
|
||||
expect(annotations[0].tags.length).to.be(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('given annotation response', function() {
|
||||
var options = {
|
||||
alias: '',
|
||||
@ -234,5 +259,6 @@ describe('when generating timeseries from influxdb response', function() {
|
||||
expect(annotations[0].tags[1]).to.be('backend');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user