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)
|
* **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**: 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)
|
* **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
|
### Bugfixes
|
||||||
* **API**: HTTP API for deleting org returning incorrect message for a non-existing org [#6679](https://github.com/grafana/grafana/issues/6679)
|
* **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 (
|
const (
|
||||||
|
NoDataSetOK NoDataOption = "ok"
|
||||||
NoDataSetNoData NoDataOption = "no_data"
|
NoDataSetNoData NoDataOption = "no_data"
|
||||||
NoDataSetAlerting NoDataOption = "alerting"
|
|
||||||
NoDataKeepState NoDataOption = "keep_state"
|
NoDataKeepState NoDataOption = "keep_state"
|
||||||
|
NoDataSetAlerting NoDataOption = "alerting"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -35,7 +36,7 @@ func (s AlertStateType) IsValid() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s NoDataOption) 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 {
|
func (s NoDataOption) ToAlertState() AlertStateType {
|
||||||
|
@ -94,7 +94,7 @@ func createDialer() (*gomail.Dialer, error) {
|
|||||||
if setting.Smtp.CertFile != "" {
|
if setting.Smtp.CertFile != "" {
|
||||||
cert, err := tls.LoadX509KeyPair(setting.Smtp.CertFile, setting.Smtp.KeyFile)
|
cert, err := tls.LoadX509KeyPair(setting.Smtp.CertFile, setting.Smtp.KeyFile)
|
||||||
if err != nil {
|
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}
|
tlsconfig.Certificates = []tls.Certificate{cert}
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,9 @@ func (qp *QueryParser) Parse(model *simplejson.Json, dsInfo *models.DataSource,
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
functions = append(functions, f)
|
if f.Func != "" {
|
||||||
|
functions = append(functions, f)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
query.FunctionList = functions
|
query.FunctionList = functions
|
||||||
|
@ -81,6 +81,8 @@ func (parser *ResponseParser) Parse(res *http.Response, queryRef *Query) ([]*tsd
|
|||||||
if key == "cluster" && queryRef.AddClusterToAlias {
|
if key == "cluster" && queryRef.AddClusterToAlias {
|
||||||
namePrefix += value + " "
|
namePrefix += value + " "
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
for key, value := range mqeSerie.Tagset {
|
||||||
if key == "host" && queryRef.AddHostToAlias {
|
if key == "host" && queryRef.AddHostToAlias {
|
||||||
namePrefix += value + " "
|
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))
|
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() {
|
Convey("Containg wildcard series", func() {
|
||||||
query := &Query{
|
query := &Query{
|
||||||
Metrics: []Metric{
|
Metrics: []Metric{
|
||||||
|
@ -47,6 +47,7 @@ var noDataModes = [
|
|||||||
{text: 'Alerting', value: 'alerting'},
|
{text: 'Alerting', value: 'alerting'},
|
||||||
{text: 'No Data', value: 'no_data'},
|
{text: 'No Data', value: 'no_data'},
|
||||||
{text: 'Keep Last State', value: 'keep_state'},
|
{text: 'Keep Last State', value: 'keep_state'},
|
||||||
|
{text: 'Ok', value: 'ok'},
|
||||||
];
|
];
|
||||||
|
|
||||||
var executionErrorModes = [
|
var executionErrorModes = [
|
||||||
|
@ -89,7 +89,7 @@ function (_, TableModel) {
|
|||||||
if (column === 'sequence_number') { return; }
|
if (column === 'sequence_number') { return; }
|
||||||
if (!titleCol) { titleCol = index; }
|
if (!titleCol) { titleCol = index; }
|
||||||
if (column === self.annotation.titleColumn) { titleCol = index; return; }
|
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; }
|
if (column === self.annotation.textColumn) { textCol = index; return; }
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -208,30 +208,56 @@ describe('when generating timeseries from influxdb response', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('given annotation response', function() {
|
describe('given annotation response', function() {
|
||||||
var options = {
|
describe('with empty tagsColumn', function() {
|
||||||
alias: '',
|
var options = {
|
||||||
annotation: {
|
alias: '',
|
||||||
tagsColumn: 'datacenter, source'
|
annotation: {},
|
||||||
},
|
series: [
|
||||||
series: [
|
{
|
||||||
{
|
name: "logins.count",
|
||||||
name: "logins.count",
|
tags: {datacenter: 'Africa', server: 'server2'},
|
||||||
tags: {datacenter: 'Africa', server: 'server2'},
|
columns: ["time", "datacenter", "hostname", "source", "value"],
|
||||||
columns: ["time", "datacenter", "hostname", "source", "value"],
|
values: [
|
||||||
values: [
|
[1481549440372, "America", "10.1.100.10", "backend", 215.7432653659507],
|
||||||
[1481549440372, "America", "10.1.100.10", "backend", 215.7432653659507],
|
]
|
||||||
]
|
}
|
||||||
}
|
]
|
||||||
]
|
};
|
||||||
};
|
|
||||||
|
|
||||||
it('should multiple tags', function() {
|
it('should multiple tags', function() {
|
||||||
var series = new InfluxSeries(options);
|
var series = new InfluxSeries(options);
|
||||||
var annotations = series.getAnnotations();
|
var annotations = series.getAnnotations();
|
||||||
|
|
||||||
expect(annotations[0].tags.length).to.be(2);
|
expect(annotations[0].tags.length).to.be(0);
|
||||||
expect(annotations[0].tags[0]).to.be('America');
|
});
|
||||||
expect(annotations[0].tags[1]).to.be('backend');
|
});
|
||||||
|
|
||||||
|
describe('given annotation response', function() {
|
||||||
|
var options = {
|
||||||
|
alias: '',
|
||||||
|
annotation: {
|
||||||
|
tagsColumn: 'datacenter, source'
|
||||||
|
},
|
||||||
|
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(2);
|
||||||
|
expect(annotations[0].tags[0]).to.be('America');
|
||||||
|
expect(annotations[0].tags[1]).to.be('backend');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user