Merge remote-tracking branch 'upstream/master' into docs-5.1

This commit is contained in:
Daniel Lee 2018-04-20 15:15:42 +02:00
commit f4f12c1e84
9 changed files with 93 additions and 98 deletions

View File

@ -117,7 +117,7 @@ jobs:
- image: circleci/python:2.7-stretch - image: circleci/python:2.7-stretch
steps: steps:
- attach_workspace: - attach_workspace:
at: dist at: .
- run: - run:
name: install awscli name: install awscli
command: 'sudo pip install awscli' command: 'sudo pip install awscli'
@ -139,10 +139,6 @@ workflows:
filters: filters:
tags: tags:
only: /.*/ only: /.*/
- gometalinter:
filters:
tags:
only: /.*/
- build: - build:
filters: filters:
tags: tags:

View File

@ -1,4 +1,4 @@
# 5.1.0 (unreleased) # 5.1.0-beta1 (2018-04-20)
* **MSSQL**: New Microsoft SQL Server data source [#10093](https://github.com/grafana/grafana/pull/10093), [#11298](https://github.com/grafana/grafana/pull/11298), thx [@linuxchips](https://github.com/linuxchips) * **MSSQL**: New Microsoft SQL Server data source [#10093](https://github.com/grafana/grafana/pull/10093), [#11298](https://github.com/grafana/grafana/pull/11298), thx [@linuxchips](https://github.com/linuxchips)
* **Prometheus**: The heatmap panel now support Prometheus histograms [#10009](https://github.com/grafana/grafana/issues/10009) * **Prometheus**: The heatmap panel now support Prometheus histograms [#10009](https://github.com/grafana/grafana/issues/10009)

View File

@ -16,6 +16,7 @@ weight = 1
Description | Download Description | Download
------------ | ------------- ------------ | -------------
Stable for Debian-based Linux | [grafana_5.0.4_amd64.deb](https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana_5.0.4_amd64.deb) Stable for Debian-based Linux | [grafana_5.0.4_amd64.deb](https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana_5.0.4_amd64.deb)
Beta for Debian-based Linux | [grafana_5.1.0-beta1_amd64.deb](https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana_5.1.0-beta1_amd64.deb)
Read [Upgrading Grafana]({{< relref "installation/upgrading.md" >}}) for tips and guidance on updating an existing Read [Upgrading Grafana]({{< relref "installation/upgrading.md" >}}) for tips and guidance on updating an existing
installation. installation.
@ -29,6 +30,13 @@ sudo apt-get install -y adduser libfontconfig
sudo dpkg -i grafana_5.0.4_amd64.deb sudo dpkg -i grafana_5.0.4_amd64.deb
``` ```
## Install Latest Beta
```bash
wget https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana_5.1.0-beta1_amd64.deb
sudo apt-get install -y adduser libfontconfig
sudo dpkg -i grafana_5.1.0-beta1_amd64.deb
```
## APT Repository ## APT Repository
Add the following line to your `/etc/apt/sources.list` file. Add the following line to your `/etc/apt/sources.list` file.

View File

@ -16,6 +16,7 @@ weight = 2
Description | Download Description | Download
------------ | ------------- ------------ | -------------
Stable for CentOS / Fedora / OpenSuse / Redhat Linux | [5.0.4 (x86-64 rpm)](https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.0.4-1.x86_64.rpm) Stable for CentOS / Fedora / OpenSuse / Redhat Linux | [5.0.4 (x86-64 rpm)](https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.0.4-1.x86_64.rpm)
Latest Beta for CentOS / Fedora / OpenSuse / Redhat Linux | [5.1.0-beta1 (x86-64 rpm)](https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.1.0-beta1.x86_64.rpm)
Read [Upgrading Grafana]({{< relref "installation/upgrading.md" >}}) for tips and guidance on updating an existing Read [Upgrading Grafana]({{< relref "installation/upgrading.md" >}}) for tips and guidance on updating an existing
@ -29,6 +30,12 @@ You can install Grafana using Yum directly.
$ sudo yum install https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.0.4-1.x86_64.rpm $ sudo yum install https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.0.4-1.x86_64.rpm
``` ```
## Install Beta
```bash
$ sudo yum install https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.1.0-beta1.x86_64.rpm
```
Or install manually using `rpm`. Or install manually using `rpm`.
#### On CentOS / Fedora / Redhat: #### On CentOS / Fedora / Redhat:

View File

@ -13,6 +13,7 @@ weight = 3
Description | Download Description | Download
------------ | ------------- ------------ | -------------
Latest stable package for Windows | [grafana-5.0.4.windows-x64.zip](https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.0.4.windows-x64.zip) Latest stable package for Windows | [grafana-5.0.4.windows-x64.zip](https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.0.4.windows-x64.zip)
Latest beta package for Windows | [grafana.5.1.0-beta1.windows-x64.zip](https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.0.0-beta5.windows-x64.zip)
Read [Upgrading Grafana]({{< relref "installation/upgrading.md" >}}) for tips and guidance on updating an existing Read [Upgrading Grafana]({{< relref "installation/upgrading.md" >}}) for tips and guidance on updating an existing
installation. installation.

View File

@ -1,6 +1,6 @@
#! /usr/bin/env bash #! /usr/bin/env bash
deb_ver=5.0.0-beta5 deb_ver=5.1.0-beta1
rpm_ver=5.0.0-beta5 rpm_ver=5.1.0-beta1
wget https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana_${deb_ver}_amd64.deb wget https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana_${deb_ver}_amd64.deb

View File

@ -10,6 +10,7 @@ import (
"net/http" "net/http"
"net/url" "net/url"
"path" "path"
"runtime"
"time" "time"
"github.com/grafana/grafana/pkg/cmd/grafana-cli/logger" "github.com/grafana/grafana/pkg/cmd/grafana-cli/logger"
@ -155,6 +156,8 @@ func sendRequest(repoUrl string, subPaths ...string) ([]byte, error) {
req, err := http.NewRequest(http.MethodGet, u.String(), nil) req, err := http.NewRequest(http.MethodGet, u.String(), nil)
req.Header.Set("grafana-version", grafanaVersion) req.Header.Set("grafana-version", grafanaVersion)
req.Header.Set("grafana-os", runtime.GOOS)
req.Header.Set("grafana-arch", runtime.GOARCH)
req.Header.Set("User-Agent", "grafana "+grafanaVersion) req.Header.Set("User-Agent", "grafana "+grafanaVersion)
if err != nil { if err != nil {

View File

@ -1,30 +1,19 @@
import { describe, beforeEach, it, expect, angularMocks } from 'test/lib/common';
import helpers from 'test/specs/helpers';
import { GraphiteDatasource } from '../datasource'; import { GraphiteDatasource } from '../datasource';
import moment from 'moment'; import moment from 'moment';
import _ from 'lodash'; import _ from 'lodash';
import $q from 'q';
import { TemplateSrvStub } from 'test/specs/helpers';
describe('graphiteDatasource', function() { describe('graphiteDatasource', () => {
let ctx = new helpers.ServiceTestContext(); let ctx: any = {
let instanceSettings: any = { url: [''], name: 'graphiteProd', jsonData: {} }; backendSrv: {},
$q: $q,
beforeEach(angularMocks.module('grafana.core')); templateSrv: new TemplateSrvStub(),
beforeEach(angularMocks.module('grafana.services')); };
beforeEach(ctx.providePhase(['backendSrv', 'templateSrv']));
beforeEach(
angularMocks.inject(function($q, $rootScope, $httpBackend, $injector) {
ctx.$q = $q;
ctx.$httpBackend = $httpBackend;
ctx.$rootScope = $rootScope;
ctx.$injector = $injector;
$httpBackend.when('GET', /\.html$/).respond('');
})
);
beforeEach(function() { beforeEach(function() {
ctx.ds = ctx.$injector.instantiate(GraphiteDatasource, { ctx.instanceSettings = { url: [''], name: 'graphiteProd', jsonData: {} };
instanceSettings: instanceSettings, ctx.ds = new GraphiteDatasource(ctx.instanceSettings, ctx.$q, ctx.backendSrv, ctx.templateSrv);
});
}); });
describe('When querying graphite with one target using query editor target spec', function() { describe('When querying graphite with one target using query editor target spec', function() {
@ -38,7 +27,7 @@ describe('graphiteDatasource', function() {
let results; let results;
let requestOptions; let requestOptions;
beforeEach(function() { beforeEach(async () => {
ctx.backendSrv.datasourceRequest = function(options) { ctx.backendSrv.datasourceRequest = function(options) {
requestOptions = options; requestOptions = options;
return ctx.$q.when({ return ctx.$q.when({
@ -46,40 +35,39 @@ describe('graphiteDatasource', function() {
}); });
}; };
ctx.ds.query(query).then(function(data) { await ctx.ds.query(query).then(function(data) {
results = data; results = data;
}); });
ctx.$rootScope.$apply();
}); });
it('should generate the correct query', function() { it('should generate the correct query', function() {
expect(requestOptions.url).to.be('/render'); expect(requestOptions.url).toBe('/render');
}); });
it('should set unique requestId', function() { it('should set unique requestId', function() {
expect(requestOptions.requestId).to.be('graphiteProd.panelId.3'); expect(requestOptions.requestId).toBe('graphiteProd.panelId.3');
}); });
it('should query correctly', function() { it('should query correctly', function() {
let params = requestOptions.data.split('&'); let params = requestOptions.data.split('&');
expect(params).to.contain('target=prod1.count'); expect(params).toContain('target=prod1.count');
expect(params).to.contain('target=prod2.count'); expect(params).toContain('target=prod2.count');
expect(params).to.contain('from=-1h'); expect(params).toContain('from=-1h');
expect(params).to.contain('until=now'); expect(params).toContain('until=now');
}); });
it('should exclude undefined params', function() { it('should exclude undefined params', function() {
let params = requestOptions.data.split('&'); let params = requestOptions.data.split('&');
expect(params).to.not.contain('cacheTimeout=undefined'); expect(params).not.toContain('cacheTimeout=undefined');
}); });
it('should return series list', function() { it('should return series list', function() {
expect(results.data.length).to.be(1); expect(results.data.length).toBe(1);
expect(results.data[0].target).to.be('prod1.count'); expect(results.data[0].target).toBe('prod1.count');
}); });
it('should convert to millisecond resolution', function() { it('should convert to millisecond resolution', function() {
expect(results.data[0].datapoints[0][0]).to.be(10); expect(results.data[0].datapoints[0][0]).toBe(10);
}); });
}); });
@ -110,22 +98,21 @@ describe('graphiteDatasource', function() {
], ],
}; };
beforeEach(() => { beforeEach(async () => {
ctx.backendSrv.datasourceRequest = function(options) { ctx.backendSrv.datasourceRequest = function(options) {
return ctx.$q.when(response); return ctx.$q.when(response);
}; };
ctx.ds.annotationQuery(options).then(function(data) { await ctx.ds.annotationQuery(options).then(function(data) {
results = data; results = data;
}); });
ctx.$rootScope.$apply();
}); });
it('should parse the tags string into an array', () => { it('should parse the tags string into an array', () => {
expect(_.isArray(results[0].tags)).to.eql(true); expect(_.isArray(results[0].tags)).toEqual(true);
expect(results[0].tags.length).to.eql(2); expect(results[0].tags.length).toEqual(2);
expect(results[0].tags[0]).to.eql('tag1'); expect(results[0].tags[0]).toEqual('tag1');
expect(results[0].tags[1]).to.eql('tag2'); expect(results[0].tags[1]).toEqual('tag2');
}); });
}); });
@ -149,14 +136,14 @@ describe('graphiteDatasource', function() {
ctx.ds.annotationQuery(options).then(function(data) { ctx.ds.annotationQuery(options).then(function(data) {
results = data; results = data;
}); });
ctx.$rootScope.$apply(); // ctx.$rootScope.$apply();
}); });
it('should parse the tags string into an array', () => { it('should parse the tags string into an array', () => {
expect(_.isArray(results[0].tags)).to.eql(true); expect(_.isArray(results[0].tags)).toEqual(true);
expect(results[0].tags.length).to.eql(2); expect(results[0].tags.length).toEqual(2);
expect(results[0].tags[0]).to.eql('tag1'); expect(results[0].tags[0]).toEqual('tag1');
expect(results[0].tags[1]).to.eql('tag2'); expect(results[0].tags[1]).toEqual('tag2');
}); });
}); });
}); });
@ -166,21 +153,21 @@ describe('graphiteDatasource', function() {
let results = ctx.ds.buildGraphiteParams({ let results = ctx.ds.buildGraphiteParams({
targets: [{}], targets: [{}],
}); });
expect(results.length).to.be(0); expect(results.length).toBe(0);
}); });
it('should uri escape targets', function() { it('should uri escape targets', function() {
let results = ctx.ds.buildGraphiteParams({ let results = ctx.ds.buildGraphiteParams({
targets: [{ target: 'prod1.{test,test2}' }, { target: 'prod2.count' }], targets: [{ target: 'prod1.{test,test2}' }, { target: 'prod2.count' }],
}); });
expect(results).to.contain('target=prod1.%7Btest%2Ctest2%7D'); expect(results).toContain('target=prod1.%7Btest%2Ctest2%7D');
}); });
it('should replace target placeholder', function() { it('should replace target placeholder', function() {
let results = ctx.ds.buildGraphiteParams({ let results = ctx.ds.buildGraphiteParams({
targets: [{ target: 'series1' }, { target: 'series2' }, { target: 'asPercent(#A,#B)' }], targets: [{ target: 'series1' }, { target: 'series2' }, { target: 'asPercent(#A,#B)' }],
}); });
expect(results[2]).to.be('target=asPercent(series1%2Cseries2)'); expect(results[2]).toBe('target=asPercent(series1%2Cseries2)');
}); });
it('should replace target placeholder for hidden series', function() { it('should replace target placeholder for hidden series', function() {
@ -191,35 +178,35 @@ describe('graphiteDatasource', function() {
{ target: 'asPercent(#A,#B)' }, { target: 'asPercent(#A,#B)' },
], ],
}); });
expect(results[0]).to.be('target=' + encodeURIComponent('asPercent(series1,sumSeries(series1))')); expect(results[0]).toBe('target=' + encodeURIComponent('asPercent(series1,sumSeries(series1))'));
}); });
it('should replace target placeholder when nesting query references', function() { it('should replace target placeholder when nesting query references', function() {
let results = ctx.ds.buildGraphiteParams({ let results = ctx.ds.buildGraphiteParams({
targets: [{ target: 'series1' }, { target: 'sumSeries(#A)' }, { target: 'asPercent(#A,#B)' }], targets: [{ target: 'series1' }, { target: 'sumSeries(#A)' }, { target: 'asPercent(#A,#B)' }],
}); });
expect(results[2]).to.be('target=' + encodeURIComponent('asPercent(series1,sumSeries(series1))')); expect(results[2]).toBe('target=' + encodeURIComponent('asPercent(series1,sumSeries(series1))'));
}); });
it('should fix wrong minute interval parameters', function() { it('should fix wrong minute interval parameters', function() {
let results = ctx.ds.buildGraphiteParams({ let results = ctx.ds.buildGraphiteParams({
targets: [{ target: "summarize(prod.25m.count, '25m', 'sum')" }], targets: [{ target: "summarize(prod.25m.count, '25m', 'sum')" }],
}); });
expect(results[0]).to.be('target=' + encodeURIComponent("summarize(prod.25m.count, '25min', 'sum')")); expect(results[0]).toBe('target=' + encodeURIComponent("summarize(prod.25m.count, '25min', 'sum')"));
}); });
it('should fix wrong month interval parameters', function() { it('should fix wrong month interval parameters', function() {
let results = ctx.ds.buildGraphiteParams({ let results = ctx.ds.buildGraphiteParams({
targets: [{ target: "summarize(prod.5M.count, '5M', 'sum')" }], targets: [{ target: "summarize(prod.5M.count, '5M', 'sum')" }],
}); });
expect(results[0]).to.be('target=' + encodeURIComponent("summarize(prod.5M.count, '5mon', 'sum')")); expect(results[0]).toBe('target=' + encodeURIComponent("summarize(prod.5M.count, '5mon', 'sum')"));
}); });
it('should ignore empty targets', function() { it('should ignore empty targets', function() {
let results = ctx.ds.buildGraphiteParams({ let results = ctx.ds.buildGraphiteParams({
targets: [{ target: 'series1' }, { target: '' }], targets: [{ target: 'series1' }, { target: '' }],
}); });
expect(results.length).to.be(2); expect(results.length).toBe(2);
}); });
}); });
@ -231,7 +218,7 @@ describe('graphiteDatasource', function() {
ctx.backendSrv.datasourceRequest = function(options) { ctx.backendSrv.datasourceRequest = function(options) {
requestOptions = options; requestOptions = options;
return ctx.$q.when({ return ctx.$q.when({
data: [{ target: 'prod1.count', datapoints: [[10, 1], [12, 1]] }], data: ['backend_01', 'backend_02'],
}); });
}; };
}); });
@ -241,10 +228,9 @@ describe('graphiteDatasource', function() {
results = data; results = data;
}); });
ctx.$rootScope.$apply(); expect(requestOptions.url).toBe('/tags/autoComplete/tags');
expect(requestOptions.url).to.be('/tags/autoComplete/tags'); expect(requestOptions.params.expr).toEqual([]);
expect(requestOptions.params.expr).to.eql([]); expect(results).not.toBe(null);
expect(results).not.to.be(null);
}); });
it('should generate tags query with a filter expression', () => { it('should generate tags query with a filter expression', () => {
@ -252,21 +238,19 @@ describe('graphiteDatasource', function() {
results = data; results = data;
}); });
ctx.$rootScope.$apply(); expect(requestOptions.url).toBe('/tags/autoComplete/tags');
expect(requestOptions.url).to.be('/tags/autoComplete/tags'); expect(requestOptions.params.expr).toEqual(['server=backend_01']);
expect(requestOptions.params.expr).to.eql(['server=backend_01']); expect(results).not.toBe(null);
expect(results).not.to.be(null);
}); });
it('should generate tag query for an expression with whitespace after', () => { it('should generate tags query for an expression with whitespace after', () => {
ctx.ds.metricFindQuery('tags(server=backend_01 )').then(data => { ctx.ds.metricFindQuery('tags(server=backend_01 )').then(data => {
results = data; results = data;
}); });
ctx.$rootScope.$apply(); expect(requestOptions.url).toBe('/tags/autoComplete/tags');
expect(requestOptions.url).to.be('/tags/autoComplete/tags'); expect(requestOptions.params.expr).toEqual(['server=backend_01']);
expect(requestOptions.params.expr).to.eql(['server=backend_01']); expect(results).not.toBe(null);
expect(results).not.to.be(null);
}); });
it('should generate tag values query for one tag', () => { it('should generate tag values query for one tag', () => {
@ -274,11 +258,10 @@ describe('graphiteDatasource', function() {
results = data; results = data;
}); });
ctx.$rootScope.$apply(); expect(requestOptions.url).toBe('/tags/autoComplete/values');
expect(requestOptions.url).to.be('/tags/autoComplete/values'); expect(requestOptions.params.tag).toBe('server');
expect(requestOptions.params.tag).to.be('server'); expect(requestOptions.params.expr).toEqual([]);
expect(requestOptions.params.expr).to.eql([]); expect(results).not.toBe(null);
expect(results).not.to.be(null);
}); });
it('should generate tag values query for a tag and expression', () => { it('should generate tag values query for a tag and expression', () => {
@ -286,11 +269,10 @@ describe('graphiteDatasource', function() {
results = data; results = data;
}); });
ctx.$rootScope.$apply(); expect(requestOptions.url).toBe('/tags/autoComplete/values');
expect(requestOptions.url).to.be('/tags/autoComplete/values'); expect(requestOptions.params.tag).toBe('server');
expect(requestOptions.params.tag).to.be('server'); expect(requestOptions.params.expr).toEqual(['server=~backend*']);
expect(requestOptions.params.expr).to.eql(['server=~backend*']); expect(results).not.toBe(null);
expect(results).not.to.be(null);
}); });
it('should generate tag values query for a tag with whitespace after', () => { it('should generate tag values query for a tag with whitespace after', () => {
@ -298,11 +280,10 @@ describe('graphiteDatasource', function() {
results = data; results = data;
}); });
ctx.$rootScope.$apply(); expect(requestOptions.url).toBe('/tags/autoComplete/values');
expect(requestOptions.url).to.be('/tags/autoComplete/values'); expect(requestOptions.params.tag).toBe('server');
expect(requestOptions.params.tag).to.be('server'); expect(requestOptions.params.expr).toEqual([]);
expect(requestOptions.params.expr).to.eql([]); expect(results).not.toBe(null);
expect(results).not.to.be(null);
}); });
it('should generate tag values query for a tag and expression with whitespace after', () => { it('should generate tag values query for a tag and expression with whitespace after', () => {
@ -310,11 +291,10 @@ describe('graphiteDatasource', function() {
results = data; results = data;
}); });
ctx.$rootScope.$apply(); expect(requestOptions.url).toBe('/tags/autoComplete/values');
expect(requestOptions.url).to.be('/tags/autoComplete/values'); expect(requestOptions.params.tag).toBe('server');
expect(requestOptions.params.tag).to.be('server'); expect(requestOptions.params.expr).toEqual(['server=~backend*']);
expect(requestOptions.params.expr).to.eql(['server=~backend*']); expect(results).not.toBe(null);
expect(results).not.to.be(null);
}); });
}); });
}); });

View File

@ -341,19 +341,19 @@ $input-border: 1px solid $input-border-color;
margin-right: $gf-form-margin; margin-right: $gf-form-margin;
position: relative; position: relative;
background-color: $input-bg; background-color: $input-bg;
padding-right: $input-padding-x;
border: $input-border; border: $input-border;
border-radius: $input-border-radius; border-radius: $input-border-radius;
&::after { &::after {
position: absolute; position: absolute;
top: 35%; top: 35%;
right: $input-padding-x/2; right: $input-padding-x;
background-color: transparent; background-color: transparent;
color: $input-color; color: $input-color;
font: normal normal normal $font-size-sm/1 FontAwesome; font: normal normal normal $font-size-sm/1 FontAwesome;
content: '\f0d7'; content: '\f0d7';
pointer-events: none; pointer-events: none;
font-size: 11px;
} }
.gf-form-input { .gf-form-input {