From 86f2b879a28b032bf0b3bd5e743cc92e0e9010c5 Mon Sep 17 00:00:00 2001 From: Mario Trangoni Date: Wed, 10 Apr 2019 19:34:48 +0200 Subject: [PATCH 1/5] docs/*: Fix codespell issues See, $ codespell -S './src/img/*.png,./.git*' -L que Signed-off-by: Mario Trangoni --- CHANGELOG.md | 2 +- docs/sources/configuration/index.md | 2 +- docs/sources/guides/gettingstarted.md | 2 +- docs/sources/reference/alerting.md | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f34bdf..4fb0511 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -189,7 +189,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - setAliasByRegex() function ### Changed -- **Docs**: deprecate special repo with builded plugin. +- **Docs**: deprecate special repo with built plugins. - **Triggers panel**: remove 'default' from datasources list (cause error), iss [#340](https://github.com/alexanderzobnin/grafana-zabbix/issues/340) - Add dist/ directory to repo to correspond development guide http://docs.grafana.org/plugins/development/ diff --git a/docs/sources/configuration/index.md b/docs/sources/configuration/index.md index a75be97..2958f53 100644 --- a/docs/sources/configuration/index.md +++ b/docs/sources/configuration/index.md @@ -56,7 +56,7 @@ Direct access is still supported because in some cases it may be useful to acces Direct DB Connection allows plugin to use existing SQL data source for querying history data directly from Zabbix database. This way usually faster than pulling data from Zabbix API, especially on the wide time ranges, and reduces -amount of data transfered. +amount of data transferred. Read [how to configure](./sql_datasource) SQL data source in Grafana. diff --git a/docs/sources/guides/gettingstarted.md b/docs/sources/guides/gettingstarted.md index f160772..c5597ca 100644 --- a/docs/sources/guides/gettingstarted.md +++ b/docs/sources/guides/gettingstarted.md @@ -25,7 +25,7 @@ Another case to use regex is comparing the same metrics for different hosts. Use ![Backend system time](../img/getstarting-regex_backend_system_time.png) ## Bar Chart -Let's create a graph wich show queries stats for MySQL database. Select Group, Host, Application (_MySQL_ in my case) and Items. I use `/MySQL .* operations/` regex for filtering different types of operations. +Let's create a graph which show queries stats for MySQL database. Select Group, Host, Application (_MySQL_ in my case) and Items. I use `/MySQL .* operations/` regex for filtering different types of operations. ![MySQL operations 1](../img/getstarting-mysql_operations_1.png) diff --git a/docs/sources/reference/alerting.md b/docs/sources/reference/alerting.md index e1670d4..49dc0e1 100644 --- a/docs/sources/reference/alerting.md +++ b/docs/sources/reference/alerting.md @@ -14,7 +14,7 @@ consists of two main parts: - **Alerting execution engine** The alert rules are evaluated in the Grafana backend in a scheduler and query execution engine that is part of core - Grafana. Only some data soures are supported right now. They include Graphite, Prometheus, InfluxDB and OpenTSDB. + Grafana. Only some data sources are supported right now. They include Graphite, Prometheus, InfluxDB and OpenTSDB. - **Alerting visualisations** Alerts highlight panels with problems and it can easily be found on the dashboard. From 2f9be7a1847bf66c8e8fbe04933c130069a84e9f Mon Sep 17 00:00:00 2001 From: Mario Trangoni Date: Wed, 10 Apr 2019 19:35:34 +0200 Subject: [PATCH 2/5] src/*: Fix codespell issues See, $ codespell -S './src/img/*.png,./.git*' -L que Signed-off-by: Mario Trangoni --- src/datasource-zabbix/add-metric-function.directive.js | 2 +- src/datasource-zabbix/dataProcessor.js | 8 ++++---- src/datasource-zabbix/partials/config.html | 2 +- src/datasource-zabbix/timeseries.js | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/datasource-zabbix/add-metric-function.directive.js b/src/datasource-zabbix/add-metric-function.directive.js index 795a254..64c2c41 100644 --- a/src/datasource-zabbix/add-metric-function.directive.js +++ b/src/datasource-zabbix/add-metric-function.directive.js @@ -66,7 +66,7 @@ angular }); $input.blur(function() { - // clicking the function dropdown menu wont + // clicking the function dropdown menu won't // work if you remove class at once setTimeout(function() { $input.val(''); diff --git a/src/datasource-zabbix/dataProcessor.js b/src/datasource-zabbix/dataProcessor.js index 1c5942e..4ff8c9e 100644 --- a/src/datasource-zabbix/dataProcessor.js +++ b/src/datasource-zabbix/dataProcessor.js @@ -19,7 +19,7 @@ let AVERAGE = ts.AVERAGE; let MIN = ts.MIN; let MAX = ts.MAX; let MEDIAN = ts.MEDIAN; -let PERCENTIL = ts.PERCENTIL; +let PERCENTILE = ts.PERCENTILE; function limit(order, n, orderByFunc, timeseries) { let orderByCallback = aggregationFunctions[orderByFunc]; @@ -121,9 +121,9 @@ function aggregateWrapper(groupByCallback, interval, datapoints) { return groupBy(sortedPoints, interval, groupByCallback); } -function percentil(interval, n, datapoints) { +function percentile(interval, n, datapoints) { var flattenedPoints = ts.flattenDatapoints(datapoints); - var groupByCallback = _.partial(PERCENTIL, n); + var groupByCallback = _.partial(PERCENTILE, n); return groupBy(flattenedPoints, interval, groupByCallback); } @@ -155,7 +155,7 @@ let metricFunctions = { transformNull: transformNull, aggregateBy: aggregateByWrapper, // Predefined aggs - percentil: percentil, + percentile: percentile, average: _.partial(aggregateWrapper, AVERAGE), min: _.partial(aggregateWrapper, MIN), max: _.partial(aggregateWrapper, MAX), diff --git a/src/datasource-zabbix/partials/config.html b/src/datasource-zabbix/partials/config.html index 1e9f682..0bd3a3e 100644 --- a/src/datasource-zabbix/partials/config.html +++ b/src/datasource-zabbix/partials/config.html @@ -99,7 +99,7 @@ In order to use this feature it should be created and configured first. Zabbix plugin uses this data source for querying history data directly from the database. This way usually faster than pulling data from Zabbix API, especially on the wide time ranges, and reduces - amount of data transfered. + amount of data transferred.
diff --git a/src/datasource-zabbix/timeseries.js b/src/datasource-zabbix/timeseries.js index 1e23114..de20b4a 100644 --- a/src/datasource-zabbix/timeseries.js +++ b/src/datasource-zabbix/timeseries.js @@ -333,7 +333,7 @@ function expMovingAverage(datapoints, n) { return ema; } -function PERCENTIL(n, values) { +function PERCENTILE(n, values) { var sorted = _.sortBy(values); return sorted[Math.floor(sorted.length * n / 100)]; } @@ -509,7 +509,7 @@ const exportedFunctions = { MIN, MAX, MEDIAN, - PERCENTIL, + PERCENTILE, sortByTime, flattenDatapoints, }; From a114b3f3bcba60df41091a03b6ed9b394c18c6b5 Mon Sep 17 00:00:00 2001 From: Mario Trangoni Date: Wed, 10 Apr 2019 19:42:18 +0200 Subject: [PATCH 3/5] ci: Add codespell spelling check Signed-off-by: Mario Trangoni --- .circleci/config.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index ecbfe4f..cf7cda4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -155,12 +155,23 @@ jobs: at: ../gh-pages - run: ./.circleci/deploy-docs.sh + codespell: + docker: + - image: circleci/python + + steps: + - checkout + - run: sudo pip install codespell + - run: codespell -S './.git*,./src/img*' -L que + workflows: version: 2 build-master: jobs: - build: filters: *filter-only-master + - codespell: + filters: *filter-only-master - lint: filters: *filter-only-master - test: @@ -170,6 +181,8 @@ workflows: jobs: - build: filters: *filter-not-release-or-master + - codespell: + filters: *filter-not-release-or-master - lint: filters: *filter-not-release-or-master - test: @@ -179,6 +192,8 @@ workflows: jobs: - build: filters: *filter-only-release + - codespell: + filters: *filter-only-release - lint: filters: *filter-only-release - test: @@ -186,6 +201,7 @@ workflows: - make-release: requires: - build + - codespell - lint - test filters: *filter-only-release From 0e81752ab82feb1eacc3b4dff8c2b5f2e2b89188 Mon Sep 17 00:00:00 2001 From: Mario Trangoni Date: Wed, 10 Apr 2019 20:00:17 +0200 Subject: [PATCH 4/5] lint: Fix disallowSpacesInsideArrayBrackets issues See, disallowSpacesInsideArrayBrackets: Illegal space after opening bracket at src/datasource-zabbix/specs/utils.spec.js : 156 | }, 157 | { 158 | array: [ [[1, 2], [3, 4]], [[1, 2], [3, 4]] ], --------------------------^ 159 | depth: 3 160 | }, disallowSpacesInsideArrayBrackets: Illegal space before closing bracket at src/datasource-zabbix/specs/utils.spec.js : 156 | }, 157 | { 158 | array: [ [[1, 2], [3, 4]], [[1, 2], [3, 4]] ], -------------------------------------------------------------^ 159 | depth: 3 160 | }, Signed-off-by: Mario Trangoni --- src/datasource-zabbix/specs/utils.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/datasource-zabbix/specs/utils.spec.js b/src/datasource-zabbix/specs/utils.spec.js index 3367f1f..01cc76f 100644 --- a/src/datasource-zabbix/specs/utils.spec.js +++ b/src/datasource-zabbix/specs/utils.spec.js @@ -155,7 +155,7 @@ describe('Utils', () => { depth: 2 }, { - array: [ [[1, 2], [3, 4]], [[1, 2], [3, 4]] ], + array: [[[1, 2], [3, 4]], [[1, 2], [3, 4]]], depth: 3 }, ]; From 938ca83e47e4bba570f7358f91dc772d0a266b4f Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Fri, 19 Apr 2019 13:14:41 +0300 Subject: [PATCH 5/5] add migration for percentile agg --- src/datasource-zabbix/metricFunctions.js | 2 +- src/datasource-zabbix/migrations.ts | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/datasource-zabbix/metricFunctions.js b/src/datasource-zabbix/metricFunctions.js index 7953963..891e271 100644 --- a/src/datasource-zabbix/metricFunctions.js +++ b/src/datasource-zabbix/metricFunctions.js @@ -140,7 +140,7 @@ addFuncDef({ }); addFuncDef({ - name: 'percentil', + name: 'percentile', category: 'Aggregate', params: [ { name: 'interval', type: 'string' }, diff --git a/src/datasource-zabbix/migrations.ts b/src/datasource-zabbix/migrations.ts index fd77d9f..a4f60cc 100644 --- a/src/datasource-zabbix/migrations.ts +++ b/src/datasource-zabbix/migrations.ts @@ -33,6 +33,7 @@ export function migrate(target) { if (isGrafana2target(target)) { return migrateFrom2To3version(target); } + migratePercentileAgg(target); return target; } @@ -51,6 +52,16 @@ function convertToRegex(str) { } } +function migratePercentileAgg(target) { + if (target.functions) { + for (const f of target.functions) { + if (f.def && f.def.name === 'percentil') { + f.def.name = 'percentile'; + } + } + } +} + export const DS_CONFIG_SCHEMA = 2; export function migrateDSConfig(jsonData) { if (!jsonData) {