From 667ca3d54d8fee325b9778cf545187d9d83c85ff Mon Sep 17 00:00:00 2001 From: Marcus Efraimsson Date: Wed, 19 Sep 2018 17:59:55 +0200 Subject: [PATCH 1/6] devenv: fix docker blocks paths --- devenv/docker/blocks/apache_proxy/docker-compose.yaml | 2 +- devenv/docker/blocks/collectd/docker-compose.yaml | 2 +- devenv/docker/blocks/graphite/docker-compose.yaml | 2 +- devenv/docker/blocks/graphite1/docker-compose.yaml | 2 +- devenv/docker/blocks/mssql/docker-compose.yaml | 2 +- devenv/docker/blocks/mssql_tests/docker-compose.yaml | 2 +- devenv/docker/blocks/mysql_opendata/docker-compose.yaml | 2 +- devenv/docker/blocks/mysql_tests/docker-compose.yaml | 2 +- devenv/docker/blocks/nginx_proxy/docker-compose.yaml | 2 +- devenv/docker/blocks/openldap/docker-compose.yaml | 2 +- devenv/docker/blocks/postgres_tests/docker-compose.yaml | 2 +- devenv/docker/blocks/prometheus/docker-compose.yaml | 4 ++-- devenv/docker/blocks/prometheus2/docker-compose.yaml | 4 ++-- devenv/docker/blocks/prometheus_mac/docker-compose.yaml | 4 ++-- 14 files changed, 17 insertions(+), 17 deletions(-) diff --git a/devenv/docker/blocks/apache_proxy/docker-compose.yaml b/devenv/docker/blocks/apache_proxy/docker-compose.yaml index 86d4befadd6..3791213f05a 100644 --- a/devenv/docker/blocks/apache_proxy/docker-compose.yaml +++ b/devenv/docker/blocks/apache_proxy/docker-compose.yaml @@ -5,5 +5,5 @@ # root_url = %(protocol)s://%(domain)s:10081/grafana/ apacheproxy: - build: blocks/apache_proxy + build: docker/blocks/apache_proxy network_mode: host diff --git a/devenv/docker/blocks/collectd/docker-compose.yaml b/devenv/docker/blocks/collectd/docker-compose.yaml index c95827f7928..c5e189b58d8 100644 --- a/devenv/docker/blocks/collectd/docker-compose.yaml +++ b/devenv/docker/blocks/collectd/docker-compose.yaml @@ -1,5 +1,5 @@ collectd: - build: blocks/collectd + build: docker/blocks/collectd environment: HOST_NAME: myserver GRAPHITE_HOST: graphite diff --git a/devenv/docker/blocks/graphite/docker-compose.yaml b/devenv/docker/blocks/graphite/docker-compose.yaml index 606e28638f7..acebd2bd9c0 100644 --- a/devenv/docker/blocks/graphite/docker-compose.yaml +++ b/devenv/docker/blocks/graphite/docker-compose.yaml @@ -1,5 +1,5 @@ graphite09: - build: blocks/graphite + build: docker/blocks/graphite ports: - "8080:80" - "2003:2003" diff --git a/devenv/docker/blocks/graphite1/docker-compose.yaml b/devenv/docker/blocks/graphite1/docker-compose.yaml index cd10593f423..1fa3e738ba8 100644 --- a/devenv/docker/blocks/graphite1/docker-compose.yaml +++ b/devenv/docker/blocks/graphite1/docker-compose.yaml @@ -1,6 +1,6 @@ graphite: build: - context: blocks/graphite1 + context: docker/blocks/graphite1 args: version: master ports: diff --git a/devenv/docker/blocks/mssql/docker-compose.yaml b/devenv/docker/blocks/mssql/docker-compose.yaml index a346fb791f7..05a93629e73 100644 --- a/devenv/docker/blocks/mssql/docker-compose.yaml +++ b/devenv/docker/blocks/mssql/docker-compose.yaml @@ -1,6 +1,6 @@ mssql: build: - context: blocks/mssql/build + context: docker/blocks/mssql/build environment: ACCEPT_EULA: Y MSSQL_SA_PASSWORD: Password! diff --git a/devenv/docker/blocks/mssql_tests/docker-compose.yaml b/devenv/docker/blocks/mssql_tests/docker-compose.yaml index 5da6aad82af..eea4d1e3561 100644 --- a/devenv/docker/blocks/mssql_tests/docker-compose.yaml +++ b/devenv/docker/blocks/mssql_tests/docker-compose.yaml @@ -1,6 +1,6 @@ mssqltests: build: - context: blocks/mssql/build + context: docker/blocks/mssql/build environment: ACCEPT_EULA: Y MSSQL_SA_PASSWORD: Password! diff --git a/devenv/docker/blocks/mysql_opendata/docker-compose.yaml b/devenv/docker/blocks/mysql_opendata/docker-compose.yaml index 594eeed284a..4d478ee0860 100644 --- a/devenv/docker/blocks/mysql_opendata/docker-compose.yaml +++ b/devenv/docker/blocks/mysql_opendata/docker-compose.yaml @@ -1,5 +1,5 @@ mysql_opendata: - build: blocks/mysql_opendata + build: docker/blocks/mysql_opendata environment: MYSQL_ROOT_PASSWORD: rootpass MYSQL_DATABASE: testdata diff --git a/devenv/docker/blocks/mysql_tests/docker-compose.yaml b/devenv/docker/blocks/mysql_tests/docker-compose.yaml index 035a6167017..a7509d47880 100644 --- a/devenv/docker/blocks/mysql_tests/docker-compose.yaml +++ b/devenv/docker/blocks/mysql_tests/docker-compose.yaml @@ -1,6 +1,6 @@ mysqltests: build: - context: blocks/mysql_tests + context: docker/blocks/mysql_tests environment: MYSQL_ROOT_PASSWORD: rootpass MYSQL_DATABASE: grafana_tests diff --git a/devenv/docker/blocks/nginx_proxy/docker-compose.yaml b/devenv/docker/blocks/nginx_proxy/docker-compose.yaml index a0ceceb83ac..aefd7226f36 100644 --- a/devenv/docker/blocks/nginx_proxy/docker-compose.yaml +++ b/devenv/docker/blocks/nginx_proxy/docker-compose.yaml @@ -5,5 +5,5 @@ # root_url = %(protocol)s://%(domain)s:10080/grafana/ nginxproxy: - build: blocks/nginx_proxy + build: docker/blocks/nginx_proxy network_mode: host diff --git a/devenv/docker/blocks/openldap/docker-compose.yaml b/devenv/docker/blocks/openldap/docker-compose.yaml index be06524a57d..d11858ccfb9 100644 --- a/devenv/docker/blocks/openldap/docker-compose.yaml +++ b/devenv/docker/blocks/openldap/docker-compose.yaml @@ -1,5 +1,5 @@ openldap: - build: blocks/openldap + build: docker/blocks/openldap environment: SLAPD_PASSWORD: grafana SLAPD_DOMAIN: grafana.org diff --git a/devenv/docker/blocks/postgres_tests/docker-compose.yaml b/devenv/docker/blocks/postgres_tests/docker-compose.yaml index f5ce0a5a3d3..7e6da7d8517 100644 --- a/devenv/docker/blocks/postgres_tests/docker-compose.yaml +++ b/devenv/docker/blocks/postgres_tests/docker-compose.yaml @@ -1,6 +1,6 @@ postgrestest: build: - context: blocks/postgres_tests + context: docker/blocks/postgres_tests environment: POSTGRES_USER: grafanatest POSTGRES_PASSWORD: grafanatest diff --git a/devenv/docker/blocks/prometheus/docker-compose.yaml b/devenv/docker/blocks/prometheus/docker-compose.yaml index 3c304cc74ad..db778060dde 100644 --- a/devenv/docker/blocks/prometheus/docker-compose.yaml +++ b/devenv/docker/blocks/prometheus/docker-compose.yaml @@ -1,5 +1,5 @@ prometheus: - build: blocks/prometheus + build: docker/blocks/prometheus network_mode: host ports: - "9090:9090" @@ -25,7 +25,7 @@ - "9093:9093" prometheus-random-data: - build: blocks/prometheus_random_data + build: docker/blocks/prometheus_random_data network_mode: host ports: - "8081:8080" diff --git a/devenv/docker/blocks/prometheus2/docker-compose.yaml b/devenv/docker/blocks/prometheus2/docker-compose.yaml index 589df868084..d586b4b5742 100644 --- a/devenv/docker/blocks/prometheus2/docker-compose.yaml +++ b/devenv/docker/blocks/prometheus2/docker-compose.yaml @@ -1,5 +1,5 @@ prometheus: - build: blocks/prometheus2 + build: docker/blocks/prometheus2 network_mode: host ports: - "9090:9090" @@ -25,7 +25,7 @@ - "9093:9093" prometheus-random-data: - build: blocks/prometheus_random_data + build: docker/blocks/prometheus_random_data network_mode: host ports: - "8081:8080" diff --git a/devenv/docker/blocks/prometheus_mac/docker-compose.yaml b/devenv/docker/blocks/prometheus_mac/docker-compose.yaml index ef53b07418a..b73d278fae2 100644 --- a/devenv/docker/blocks/prometheus_mac/docker-compose.yaml +++ b/devenv/docker/blocks/prometheus_mac/docker-compose.yaml @@ -1,5 +1,5 @@ prometheus: - build: blocks/prometheus_mac + build: docker/blocks/prometheus_mac ports: - "9090:9090" @@ -21,6 +21,6 @@ - "9093:9093" prometheus-random-data: - build: blocks/prometheus_random_data + build: docker/blocks/prometheus_random_data ports: - "8081:8080" From 7a95791025905a86f38027ff97d3713bf88aa15c Mon Sep 17 00:00:00 2001 From: Ben Doyle Date: Thu, 20 Sep 2018 14:16:43 +0100 Subject: [PATCH 2/6] Fix misspelled authentication in Auth overview doc --- docs/sources/auth/overview.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/sources/auth/overview.md b/docs/sources/auth/overview.md index 3a38ed83988..20010a9ac09 100644 --- a/docs/sources/auth/overview.md +++ b/docs/sources/auth/overview.md @@ -32,11 +32,11 @@ permissions and org memberships. ## Grafana Auth -Grafana of course has a built in user authentication system with password authenticaten enabled by default. You can +Grafana of course has a built in user authentication system with password authentication enabled by default. You can disable authentication by enabling anonymous access. You can also hide login form and only allow login through an auth provider (listed above). There is also options for allowing self sign up. -### Anonymous authenticaten +### Anonymous authentication You can make Grafana accessible without any login required by enabling anonymous access in the configuration file. @@ -84,4 +84,3 @@ Set to the option detailed below to true to hide sign-out menu link. Useful if y [auth] disable_signout_menu = true ``` - From 4a8d80a94077767713af7cc4e6668abb93a7c637 Mon Sep 17 00:00:00 2001 From: David Kaltschmidt Date: Thu, 20 Sep 2018 16:57:58 +0200 Subject: [PATCH 3/6] Explore: Fix metric suggestions when first letters have been typed --- public/app/containers/Explore/PromQueryField.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/public/app/containers/Explore/PromQueryField.tsx b/public/app/containers/Explore/PromQueryField.tsx index 491e7005bd0..8188e516161 100644 --- a/public/app/containers/Explore/PromQueryField.tsx +++ b/public/app/containers/Explore/PromQueryField.tsx @@ -255,6 +255,8 @@ class PromQueryField extends React.Component 3; // Determine candidates by CSS context if (_.includes(wrapperClasses, 'context-range')) { // Suggestions for metric[|] @@ -266,7 +268,7 @@ class PromQueryField extends React.Component Date: Thu, 20 Sep 2018 16:59:06 +0200 Subject: [PATCH 4/6] Explore: dont rate-hint on rate queries --- public/app/plugins/datasource/prometheus/datasource.ts | 2 +- .../plugins/datasource/prometheus/specs/datasource.test.ts | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/public/app/plugins/datasource/prometheus/datasource.ts b/public/app/plugins/datasource/prometheus/datasource.ts index ca80b3760a7..b53b9eb34c1 100644 --- a/public/app/plugins/datasource/prometheus/datasource.ts +++ b/public/app/plugins/datasource/prometheus/datasource.ts @@ -46,7 +46,7 @@ export function determineQueryHints(series: any[], datasource?: any): any[] { // Check for monotony const datapoints: number[][] = s.datapoints; - if (datapoints.length > 1) { + if (query.indexOf('rate(') === -1 && datapoints.length > 1) { let increasing = false; const monotonic = datapoints.filter(dp => dp[0] !== null).every((dp, index) => { if (index === 0) { diff --git a/public/app/plugins/datasource/prometheus/specs/datasource.test.ts b/public/app/plugins/datasource/prometheus/specs/datasource.test.ts index eef2bbd56b6..692a1827247 100644 --- a/public/app/plugins/datasource/prometheus/specs/datasource.test.ts +++ b/public/app/plugins/datasource/prometheus/specs/datasource.test.ts @@ -247,6 +247,12 @@ describe('PrometheusDatasource', () => { }); }); + it('returns no rate hint for a monotonously increasing series that already has a rate', () => { + const series = [{ datapoints: [[23, 1000], [24, 1001]], query: 'rate(metric[1m])', responseIndex: 0 }]; + const hints = determineQueryHints(series); + expect(hints).toEqual([null]); + }); + it('returns a rate hint w/o action for a complex monotonously increasing series', () => { const series = [{ datapoints: [[23, 1000], [24, 1001]], query: 'sum(metric)', responseIndex: 0 }]; const hints = determineQueryHints(series); From 0e173918aa575c943ce42ea990f9594c64f86f91 Mon Sep 17 00:00:00 2001 From: David Kaltschmidt Date: Thu, 20 Sep 2018 17:02:26 +0200 Subject: [PATCH 5/6] Explore: show series title in tooltip of legend item --- public/app/containers/Explore/Legend.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/public/app/containers/Explore/Legend.tsx b/public/app/containers/Explore/Legend.tsx index e00932fe566..439b6c3e54f 100644 --- a/public/app/containers/Explore/Legend.tsx +++ b/public/app/containers/Explore/Legend.tsx @@ -5,7 +5,9 @@ const LegendItem = ({ series }) => (
- {series.alias} + + {series.alias} + ); From 9e86809ace5e06c7669bb4dc92c718b0421f1909 Mon Sep 17 00:00:00 2001 From: David Kaltschmidt Date: Thu, 20 Sep 2018 17:22:38 +0200 Subject: [PATCH 6/6] Explore: remove closing brace with opening brace --- .../Explore/slate-plugins/braces.test.ts | 18 ++++++++++++++++++ .../containers/Explore/slate-plugins/braces.ts | 16 ++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/public/app/containers/Explore/slate-plugins/braces.test.ts b/public/app/containers/Explore/slate-plugins/braces.test.ts index dda805c07f7..410334d020f 100644 --- a/public/app/containers/Explore/slate-plugins/braces.test.ts +++ b/public/app/containers/Explore/slate-plugins/braces.test.ts @@ -53,4 +53,22 @@ describe('braces', () => { handler(event, change); expect(Plain.serialize(change.value)).toEqual('sum(rate(metric{namespace="dev", cluster="c1"}[2m]))'); }); + + it('removes closing brace when opening brace is removed', () => { + const change = Plain.deserialize('time()').change(); + let event; + change.move(5); + event = new window.KeyboardEvent('keydown', { key: 'Backspace' }); + handler(event, change); + expect(Plain.serialize(change.value)).toEqual('time'); + }); + + it('keeps closing brace when opening brace is removed and inner values exist', () => { + const change = Plain.deserialize('time(value)').change(); + let event; + change.move(5); + event = new window.KeyboardEvent('keydown', { key: 'Backspace' }); + const handled = handler(event, change); + expect(handled).toBeFalsy(); + }); }); diff --git a/public/app/containers/Explore/slate-plugins/braces.ts b/public/app/containers/Explore/slate-plugins/braces.ts index 2ea58569ef0..f3a76263ad6 100644 --- a/public/app/containers/Explore/slate-plugins/braces.ts +++ b/public/app/containers/Explore/slate-plugins/braces.ts @@ -43,6 +43,22 @@ export default function BracesPlugin() { return true; } + case 'Backspace': { + const text = value.anchorText.text; + const offset = value.anchorOffset; + const previousChar = text[offset - 1]; + const nextChar = text[offset]; + if (BRACES[previousChar] && BRACES[previousChar] === nextChar) { + event.preventDefault(); + // Remove closing brace if directly following + change + .deleteBackward() + .deleteForward() + .focus(); + return true; + } + } + default: { break; }