diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 9286c09966c..f4b0efdf14f 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -9,9 +9,9 @@ Please include this information: - What OS are you running grafana on? - What did you do? - What was the expected result? -- What happenend instead? +- What happened instead? -**IMPORTANT** If it realates to metric data viz: +**IMPORTANT** If it relates to metric data viz: - An image or text representation of your metric query - The raw query and response for the network request (check this in chrome dev tools network tab, here you can see metric requests and other request, please include the request body and request response) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f911729cc1..6c9a2cc4b11 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -# 3.1.0 (unreleased) +# 3.1.0-beta1 (2016-06-23) ### Enhancements * **Dashboard Export/Import**: Dashboard export now templetize data sources and constant variables, users pick these on import, closes [#5084](https://github.com/grafana/grafana/issues/5084) @@ -11,16 +11,16 @@ * **InfluxDB**: Add spread function, closes [#5211](https://github.com/grafana/grafana/issues/5211) * **Scripts**: Use restart instead of start for deb package script, closes [#5282](https://github.com/grafana/grafana/pull/5282) * **Logging**: Moved to structured logging lib, and moved to component specific level filters via config file, closes [#4590](https://github.com/grafana/grafana/issues/4590) -* **Search**: Add search limit query parameter, closes [#5292](https://github.com/grafana/grafana/pull/5292) * **OpenTSDB**: Support nested template variables in tag_values function, closes [4398](https://github.com/grafana/grafana/issues/4398) * **Datasource**: Pending data source requests are cancelled before new ones are issues (Graphite & Prometheus), closes [5321](https://github.com/grafana/grafana/issues/5321) ### Breaking changes * **Logging** : Changed default logging output format (now structured into message, and key value pairs, with logger key acting as component). You can also no change in config to json log ouput. -* **Graphite** : The Graph panel no longer have a Graphite PNG option. closes #[5367](https://github.com/grafana/grafana/issues/5367) +* **Graphite** : The Graph panel no longer have a Graphite PNG option. closes [#5367](https://github.com/grafana/grafana/issues/5367) ### Bug fixes -* **PNG rendering**: Fixed phantomjs rendering and y-axis label rotation. fixes #[5220](https://github.com/grafana/grafana/issues/5220) +* **PNG rendering**: Fixed phantomjs rendering and y-axis label rotation. fixes [#5220](https://github.com/grafana/grafana/issues/5220) +* **CLI**: The cli tool now supports reading plugin.json from dist/plugin.json. fixes [#5410](https://github.com/grafana/grafana/issues/5410) # 3.0.4 Patch release (2016-05-25) * **Panel**: Fixed blank dashboard issue when switching to other dashboard while in fullscreen edit mode, fixes [#5163](https://github.com/grafana/grafana/pull/5163) diff --git a/conf/defaults.ini b/conf/defaults.ini index 7543418e946..9f3a697e4dd 100644 --- a/conf/defaults.ini +++ b/conf/defaults.ini @@ -251,7 +251,7 @@ templates_pattern = emails/*.html # Use space to separate multiple modes, e.g. "console file" mode = console, file -# Either "trace", "debug", "info", "warn", "error", "critical", default is "info" +# Either "debug", "info", "warn", "error", "critical", default is "info" level = info # For "console" mode only diff --git a/docker/blocks/collectd/collectd.conf.tpl b/docker/blocks/collectd/collectd.conf.tpl index c19654b39f9..69b019007fb 100644 --- a/docker/blocks/collectd/collectd.conf.tpl +++ b/docker/blocks/collectd/collectd.conf.tpl @@ -14,10 +14,10 @@ LoadPlugin interface LoadPlugin uptime LoadPlugin swap LoadPlugin write_graphite - - - ReportByCpu {{ REPORT_BY_CPU | default("false") }} - +LoadPlugin processes +LoadPlugin aggregation +LoadPlugin match_regex +# LoadPlugin memcached # expose host's mounts into container using -v /:/host:ro (location inside container does not matter much) @@ -46,6 +46,9 @@ LoadPlugin write_graphite ReportByDevice false ReportReserved true ReportInodes true + ValuesAbsolute true + ValuesPercentage true + ReportInodes true @@ -53,6 +56,15 @@ LoadPlugin write_graphite IgnoreSelected false + + + Plugin "cpu" + Type "cpu" + GroupBy "Host" + GroupBy "TypeInstance" + CalculateAverage true + + Interface "lo" @@ -61,6 +73,24 @@ LoadPlugin write_graphite IgnoreSelected true +# +# Host "memcached" +# Port "11211" +# + + + + + Plugin "^cpu$" + PluginInstance "^[0-9]+$" + + + Plugin "aggregation" + + Target stop + + Target "write" + diff --git a/docker/blocks/collectd/fig b/docker/blocks/collectd/fig index 99f45a66d12..6c2e7e25893 100644 --- a/docker/blocks/collectd/fig +++ b/docker/blocks/collectd/fig @@ -9,3 +9,4 @@ collectd: COLLECT_INTERVAL: 10 links: - graphite + - memcached diff --git a/docker/blocks/memcached/fig b/docker/blocks/memcached/fig new file mode 100644 index 00000000000..a0da9df2bc2 --- /dev/null +++ b/docker/blocks/memcached/fig @@ -0,0 +1,5 @@ +memcached: + image: memcached:latest + ports: + - "11211:11211" + diff --git a/docker/blocks/prometheus/fig b/docker/blocks/prometheus/fig index ecfcf395d26..b4979918149 100644 --- a/docker/blocks/prometheus/fig +++ b/docker/blocks/prometheus/fig @@ -6,6 +6,12 @@ prometheus: volumes: - /var/docker/prometheus:/prometheus-data +node_exporter: + image: prom/node-exporter + net: bridge + ports: + - "9100:9100" + fake-prometheus-data: image: grafana/fake-data-gen net: bridge diff --git a/docker/blocks/prometheus/prometheus.yml b/docker/blocks/prometheus/prometheus.yml index 5c853622af3..f3e8c8c3469 100644 --- a/docker/blocks/prometheus/prometheus.yml +++ b/docker/blocks/prometheus/prometheus.yml @@ -23,4 +23,4 @@ scrape_configs: # scheme defaults to 'http'. target_groups: - - targets: ['localhost:9090', '172.17.0.1:9091'] + - targets: ['localhost:9090', '172.17.0.1:9091', '172.17.0.1:9100', '172.17.0.1:9150'] diff --git a/docs/VERSION b/docs/VERSION index 4a36342fcab..fd2a01863fd 100644 --- a/docs/VERSION +++ b/docs/VERSION @@ -1 +1 @@ -3.0.0 +3.1.0 diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index c969a568906..e4a528dcdbd 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -45,6 +45,7 @@ pages: - ['guides/basic_concepts.md', 'User Guides', 'Basic Concepts'] - ['guides/gettingstarted.md', 'User Guides', 'Getting Started'] +- ['guides/whats-new-in-v3-1.md', 'User Guides', "What's New in Grafana v3.1"] - ['guides/whats-new-in-v3.md', 'User Guides', "What's New in Grafana v3.0"] - ['guides/whats-new-in-v2-6.md', 'User Guides', "What's New in Grafana v2.6"] - ['guides/whats-new-in-v2-5.md', 'User Guides', "What's New in Grafana v2.5"] diff --git a/docs/sources/guides/whats-new-in-v3-1.md b/docs/sources/guides/whats-new-in-v3-1.md new file mode 100644 index 00000000000..9613cc1682c --- /dev/null +++ b/docs/sources/guides/whats-new-in-v3-1.md @@ -0,0 +1,68 @@ +--- +page_title: What's New in Grafana v3.1 +page_description: What's new in Grafana v3.1 +page_keywords: grafana, new, changes, features, documentation +--- + +# What's New in Grafana v3.1 + +## Dashboard Export & Import + +The export feature is now accessed from the share menu. + + + +Dashboards exported from Grafana 3.1 are now more portable and easier for others to import than before. +The export process extracts information data source types used by panels and adds these to a new `inputs` +section in the dashboard json. So when you or another person tries to import the dashboard they will be asked to +select data source and optional metrix prefix options. + + + +The above screenshot shows the new import modal that gives you 3 options for how to import a dashboard. +One notable new addition here is the ability to import directly from Dashboards shared on [Grafana.net](https://grafana.net). + +The next step in the import process: + + + +Here you can change the name of the dashboard and also pick what data sources you want the dashboard to use. The above screenshot +shows a CollectD dashboard for Graphite that requires a metric prefix be specified. + +## Discover Dashboards + +On [Grafana.net](https://grafana.net) you can now browse & search for dashboards. We have already added a few but +more are being uploaded every day. To import a dashboard just copy the dashboard url and head back to Grafana, +then Dashboard Search -> Import -> Paste Grafana.net Dashboard URL. + + + +## Constant template variables + +We added a new template variable named constant that makes it easier to share and export dashboard that have custom prefixes. + +## Dashboard Urls +Having current time range and template variable value always sync with the URL makes it possible to always copy your current +Grafana url to share with a colleague without having to use the Share modal. + +## Internal metrics + +Do you want metrics about viewing metrics? Ofc you do! In this release we added support for sending metrics about Grafana to graphite. +You can configure interval and server in the config file. + +## Logging + +Switched logging framework to log15 to enable key value per logging and filtering based on different log levels. +Its now possible to configure different log levels for different modules. + +### Breaking changes +- **Logging** format have been changed to improve log filtering. +- **Graphite PNG** Graphite PNG support dropped from Graph panel (use Grafana native PNG instead). +- **Migration** No longer possible to migrate dashboards from 1.x (Stored in ES or Influx 0.8). + +## CHANGELOG + +For a detailed list and link to github issues for everything included +in the 3.1 release please view the +[CHANGELOG.md](https://github.com/grafana/grafana/blob/master/CHANGELOG.md) +file. diff --git a/docs/sources/installation/configuration.md b/docs/sources/installation/configuration.md index de2055a2ae4..0c2bd7366e7 100644 --- a/docs/sources/installation/configuration.md +++ b/docs/sources/installation/configuration.md @@ -446,6 +446,19 @@ Grafana backend index those json dashboards which will make them appear in regul ### path The full path to a directory containing your json dashboards. +## [log] + +### mode +Either "console", "file", "syslog". Default is console and file +Use space to separate multiple modes, e.g. "console file" + +### level +Either "debug", "info", "warn", "error", "critical", default is "info" + +### filter +optional settings to set different levels for specific loggers. +Ex `filters = sqlstore:debug` + ## [metrics] ### enabled diff --git a/docs/sources/installation/debian.md b/docs/sources/installation/debian.md index 6084b9b317d..f87ba3f045a 100644 --- a/docs/sources/installation/debian.md +++ b/docs/sources/installation/debian.md @@ -10,7 +10,8 @@ page_keywords: grafana, installation, debian, ubuntu, guide Description | Download ------------ | ------------- -Stable .deb for Debian-based Linux | [grafana_3.0.4-1464167696.deb](https://grafanarel.s3.amazonaws.com/builds/grafana_3.0.4-1464167696_amd64.deb) +Stable .deb for Debian-based Linux | [3.0.4](https://grafanarel.s3.amazonaws.com/builds/grafana_3.0.4-1464167696_amd64.deb) +Beta .deb for Debian-based Linux | [3.1.0-beta1](https://grafanarel.s3.amazonaws.com/builds/grafana_3.1.0-1466666977beta1_amd64.deb) ## Install Stable @@ -18,6 +19,12 @@ Stable .deb for Debian-based Linux | [grafana_3.0.4-1464167696.deb](https://graf $ sudo apt-get install -y adduser libfontconfig $ sudo dpkg -i grafana_3.0.4-1464167696_amd64.deb +## Install 3.1 beta + + $ wget https://grafanarel.s3.amazonaws.com/builds/grafana_3.1.0-1466666977beta1_amd64.deb + $ sudo apt-get install -y adduser libfontconfig + $ sudo dpkg -i grafana_3.1.0-1466666977beta1_amd64.deb + ## APT Repository Add the following line to your `/etc/apt/sources.list` file. diff --git a/docs/sources/installation/rpm.md b/docs/sources/installation/rpm.md index 854ba91fcf7..0e423eb0af4 100644 --- a/docs/sources/installation/rpm.md +++ b/docs/sources/installation/rpm.md @@ -10,9 +10,10 @@ page_keywords: grafana, installation, centos, fedora, opensuse, redhat, guide Description | Download ------------ | ------------- -Stable .RPM for CentOS / Fedora / OpenSuse / Redhat Linux | [grafana-3.0.4-1464167696.x86_64.rpm](https://grafanarel.s3.amazonaws.com/builds/grafana-3.0.4-1464167696.x86_64.rpm) +Stable .RPM for CentOS / Fedora / OpenSuse / Redhat Linux | [3.0.4 (x86-64 rpm)](https://grafanarel.s3.amazonaws.com/builds/grafana-3.0.4-1464167696.x86_64.rpm) +Beta .RPM for CentOS / Fedora / OpenSuse / Redhat Linux | [3.1.0-beta1 (x86-64 rpm)](https://grafanarel.s3.amazonaws.com/builds/grafana-3.1.0-1466666977beta1.x86_64.rpm) -## Install Stable Release from package file +## Install Latest Stable You can install Grafana using Yum directly. @@ -29,6 +30,23 @@ Or install manually using `rpm`. $ sudo rpm -i --nodeps grafana-3.0.4-1464167696.x86_64.rpm +## Install 3.1 Beta + +You can install Grafana using Yum directly. + + $ sudo yum install https://grafanarel.s3.amazonaws.com/builds/grafana-3.1.0-1466666977beta1.x86_64.rpm + +Or install manually using `rpm`. + +#### On CentOS / Fedora / Redhat: + + $ sudo yum install initscripts fontconfig + $ sudo rpm -Uvh https://grafanarel.s3.amazonaws.com/builds/grafana-3.1.0-1466666977beta1.x86_64.rpm + +#### On OpenSuse: + + $ sudo rpm -i --nodeps https://grafanarel.s3.amazonaws.com/builds/grafana-3.1.0-1466666977beta1.x86_64.rpm + ## Install via YUM Repository Add the following to a new file at `/etc/yum.repos.d/grafana.repo` diff --git a/docs/sources/reference/annotations.md b/docs/sources/reference/annotations.md index 51852abcdf2..668a163b672 100644 --- a/docs/sources/reference/annotations.md +++ b/docs/sources/reference/annotations.md @@ -40,3 +40,10 @@ as the name for the fields that should be used for the annotation title, tags an For InfluxDB you need to enter a query like in the above screenshot. You need to have the ```where $timeFilter``` part. If you only select one column you will not need to enter anything in the column mapping fields. +## Prometheus Annotations +![](/img/v3/annotations_prom.png) + +Prometheus supports two ways to query annotations. + +- A regular metric query +- A Prometheus query for pending and firing alerts (for details see [Inspecting alerts during runtime](https://prometheus.io/docs/alerting/rules/#inspecting-alerts-during-runtime)) diff --git a/docs/sources/reference/export_import.md b/docs/sources/reference/export_import.md index e83c68401d4..0e830db959f 100644 --- a/docs/sources/reference/export_import.md +++ b/docs/sources/reference/export_import.md @@ -8,78 +8,97 @@ page_keywords: grafana, export, import, documentation ## Exporting a dashboard -Dashboards are exported in Grafana JSON format, and contain everything you need (layout, variables, styles, data sources, queries, etc)to import the dashboard at a later time. +Dashboards are exported in Grafana JSON format, and contain everything you need (layout, variables, styles, data sources, queries, etc)to import the dashboard at a later time. -#### Export to file +The export feature is accessed from the share menu. -To export a dashboard, locate the settings menu within the desired dashboard and click the gear icon. The export option will always be available, and will open a browser save-as dialog window. + - +### Making a dashboard portable -#### Copy JSON +If you want to export a dashboard for others to use then it could be a good idea to +add template variables for things like a metric prefix (use contant variable) and server name. -The raw JSON may be accessed directly from within the interface and copy/pasted into an editor of your choice to be saved later. To view this JSON, locate the settings menu within the desired dashboard and click the gear icon. The View JSON option will always be available, and will open the raw JSON in a text area. To copy the entire JSON file, click into the text area, the select all `CTRL`+`A` (PC, Linux) or `⌘`+`A` (Mac). - - +A template varible of the type `Constant` will automatically be hidden in +the dashboard, and will also be added as an required input when the dashboard is imported. ## Importing a dashboard -Grafana 2.0 now has integrated dashboard storage engine that can be configured to use an internal sqlite3 database, MySQL, or Postgres. This eliminates the need to use Elasticsearch for dashboard storage for Graphite users. Grafana 2.0 does not support storing dashboards in InfluxDB. +To import a dashboard open dashboard search and then hit the import button. -The import view can be found at the Dashboard Picker dropdown, next to the New Dashboard and Playlist buttons. + - +From here you can upload a dashboard json file, paste a [Grafana.net](https://grafana.net) dashboard +url or paste dashboard json text directly into the text area. + -#### Import from a file +In step 2 of the import process Grafana will let you change the name of the dashboard, pick what +data source you want the dashboard to use and specify any metric prefixes (if the dashboard use any). -To import a dashboard through a local JSON file, click the 'Choose file' button in the Import from File section. Note that JSON is not linted or validated prior during upload, so we recommend validating locally if you're editing. In a pinch, you can use http://jsonlint.com/, and if you are editing dashboard JSON frequently, there are linter plugins for popular text editors. +## Discover dashboards on Grafana.net +Find dashboads for common server applications at [Grafana.net/dashboards](https://grafana.net/dashboards). -#### Importing dashboards from Elasticsearch + -Start by going to the `Data Sources` view (via the side menu), and make sure your Elasticsearch data source is added. Specify the Elasticsearch index name where your existing Grafana v1.x dashboards are stored (the default is `grafana-dash`). +## Import & Sharing with Grafana 2.x or 3.0 -![](/img/v2/datasource_edit_elastic.jpg) +Dashboards on Grafana.net use a new feature in Grafana 3.1 that allows the import process +to update each panel so that they are using a data source of your choosing. If you are running a +Grafana version older than 3.1 then you might need to do some manual steps either +before or after import in order for the dashboard to work properly. -#### Importing dashboards from InfluxDB +Dashboards exported from Grafana 3.1+ have a new json section `__inputs` +that define what data sources and metric prefixes the dashboard uses. -Start by going to the `Data Sources` view (via the side menu), and make sure your InfluxDB data source is added. Specify the database name where your Grafana v1.x dashboards are stored, the default is `grafana`. +Example: +```json +{ + "__inputs": [ + { + "name": "DS_GRAPHITE", + "label": "graphite", + "description": "", + "type": "datasource", + "pluginId": "graphite", + "pluginName": "Graphite" + }, + { + "name": "VAR_PREFIX", + "type": "constant", + "label": "prefix", + "value": "collectd", + "description": "" + } + ], +} -### Import view +``` -In the Import view you find the section `Migrate dashboards`. Pick the data source you added (from Elasticsearch or InfluxDB), and click the `Import` button. +These are then referenced in the dashboard panels like this: -![](/img/v2/migrate_dashboards.jpg) +```json +{ + "rows": [ + { + "panels": [ + { + "type": "graph", + "datasource": "${DS_GRAPHITE}", + } + ] + } + ] +} +``` -Your dashboards should be automatically imported into the Grafana 2.0 back-end. Dashboards will no longer be stored in your previous Elasticsearch or InfluxDB databases. +These inputs and their usage in data source properties are automatically added during export in Grafana 3.1. +If you run an older version of Grafana and want to share a dashboard on Grafana.net you need to manually +add the inputs and templatize the datasource properties like above. +If you want to import a dashboard from Grafana.net into an older version of Grafana then you can either import +it as usual and then update the data source option in the metrics tab so that the panel is using the correct +data source. Another alternative is to open the json file in a a text editor and update the data source properties +to value that matches a name of your data source. -## Troubleshooting - -### Template variables could not be initialized. - -When importing a dashboard, keep an eye out for template variables in your JSON that may not exist in your instance of Grafana. For example, - - "templating": { - "list": [ - { - "allFormat": "glob", - "current": { - "tags": [], - "text": "google_com + monkey_id_au", - "value": [ - "google_com", - "monkey_id_au" - ] - }, - "datasource": null, - -To resolve this, remove any unnecessary JSON that may be specific to the instance you are exporting from. In this case, we can remove the entire "current" section entirely, and Grafana will populate default. - - "templating": { - "list": [ - { - "allFormat": "glob", - "datasource": null, - \ No newline at end of file diff --git a/docs/sources/versions.html_fragment b/docs/sources/versions.html_fragment index 0d62ee1e461..df6dbd4db7f 100644 --- a/docs/sources/versions.html_fragment +++ b/docs/sources/versions.html_fragment @@ -1,3 +1,4 @@ +
  • Version v3.1
  • Version v3.0
  • Version v2.6
  • Version v2.5
  • diff --git a/package.json b/package.json index 9094cdf9172..b7987a50001 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "company": "Coding Instinct AB" }, "name": "grafana", - "version": "3.1.0", + "version": "3.2.0-pre1", "repository": { "type": "git", "url": "http://github.com/grafana/grafana.git" diff --git a/packaging/publish/publish.sh b/packaging/publish/publish.sh index 892bfc178cc..2ab50095695 100755 --- a/packaging/publish/publish.sh +++ b/packaging/publish/publish.sh @@ -1,20 +1,20 @@ #! /usr/bin/env bash -deb_ver=3.0.4-1464167696 -rpm_ver=3.0.4-1464167696 +deb_ver=3.1.0-1466666977beta1 +rpm_ver=3.1.0-1466666977beta1 -wget https://grafanarel.s3.amazonaws.com/builds/grafana_${deb_ver}_amd64.deb +# wget https://grafanarel.s3.amazonaws.com/builds/grafana_${deb_ver}_amd64.deb -package_cloud push grafana/stable/debian/jessie grafana_${deb_ver}_amd64.deb -package_cloud push grafana/stable/debian/wheezy grafana_${deb_ver}_amd64.deb +# package_cloud push grafana/stable/debian/jessie grafana_${deb_ver}_amd64.deb +# package_cloud push grafana/stable/debian/wheezy grafana_${deb_ver}_amd64.deb package_cloud push grafana/testing/debian/jessie grafana_${deb_ver}_amd64.deb package_cloud push grafana/testing/debian/wheezy grafana_${deb_ver}_amd64.deb -wget https://grafanarel.s3.amazonaws.com/builds/grafana-${rpm_ver}.x86_64.rpm +# wget https://grafanarel.s3.amazonaws.com/builds/grafana-${rpm_ver}.x86_64.rpm package_cloud push grafana/testing/el/6 grafana-${rpm_ver}.x86_64.rpm package_cloud push grafana/testing/el/7 grafana-${rpm_ver}.x86_64.rpm -package_cloud push grafana/stable/el/7 grafana-${rpm_ver}.x86_64.rpm -package_cloud push grafana/stable/el/6 grafana-${rpm_ver}.x86_64.rpm +# package_cloud push grafana/stable/el/7 grafana-${rpm_ver}.x86_64.rpm +# package_cloud push grafana/stable/el/6 grafana-${rpm_ver}.x86_64.rpm diff --git a/pkg/cmd/grafana-cli/commands/commands.go b/pkg/cmd/grafana-cli/commands/commands.go index 06e8dd16d21..3f8826ce8ba 100644 --- a/pkg/cmd/grafana-cli/commands/commands.go +++ b/pkg/cmd/grafana-cli/commands/commands.go @@ -48,13 +48,10 @@ var pluginCommands = []cli.Command{ Usage: "list all installed plugins", Action: runCommand(lsCommand), }, { - Name: "uninstall", - Usage: "uninstall ", - Action: runCommand(removeCommand), - }, { - Name: "remove", - Usage: "remove ", - Action: runCommand(removeCommand), + Name: "uninstall", + Aliases: []string{"remove"}, + Usage: "uninstall ", + Action: runCommand(removeCommand), }, } diff --git a/pkg/cmd/grafana-cli/services/services.go b/pkg/cmd/grafana-cli/services/services.go index c5991a6c7bc..1c53619c071 100644 --- a/pkg/cmd/grafana-cli/services/services.go +++ b/pkg/cmd/grafana-cli/services/services.go @@ -33,11 +33,23 @@ func ListAllPlugins(repoUrl string) (m.PluginRepo, error) { } func ReadPlugin(pluginDir, pluginName string) (m.InstalledPlugin, error) { - pluginDataPath := path.Join(pluginDir, pluginName, "plugin.json") - pluginData, _ := IoHelper.ReadFile(pluginDataPath) + distPluginDataPath := path.Join(pluginDir, pluginName, "dist", "plugin.json") + + var data []byte + var err error + data, err = IoHelper.ReadFile(distPluginDataPath) + + if err != nil { + pluginDataPath := path.Join(pluginDir, pluginName, "plugin.json") + data, err = IoHelper.ReadFile(pluginDataPath) + + if err != nil { + return m.InstalledPlugin{}, errors.New("Could not find dist/plugin.json or plugin.json on " + pluginName + " in " + pluginDir) + } + } res := m.InstalledPlugin{} - json.Unmarshal(pluginData, &res) + json.Unmarshal(data, &res) if res.Info.Version == "" { res.Info.Version = "0.0.0" diff --git a/public/app/core/utils/kbn.js b/public/app/core/utils/kbn.js index f54979b0e97..83f577b460d 100644 --- a/public/app/core/utils/kbn.js +++ b/public/app/core/utils/kbn.js @@ -1,8 +1,9 @@ define([ 'jquery', 'lodash', + 'moment' ], -function($, _) { +function($, _, moment) { 'use strict'; var kbn = {}; @@ -580,6 +581,18 @@ function($, _) { } }; + kbn.toDuration = function(size, timeScale) { + return moment.duration(size, timeScale); + }; + + kbn.valueFormats.dtdurationms = function(size) { + return kbn.toDuration(size, 'ms').humanize(); + }; + + kbn.valueFormats.dtdurations = function(size) { + return kbn.toDuration(size, 's').humanize(); + }; + ///// FORMAT MENU ///// kbn.getUnitFormats = function() { @@ -616,6 +629,8 @@ function($, _) { {text: 'minutes (m)', value: 'm' }, {text: 'hours (h)', value: 'h' }, {text: 'days (d)', value: 'd' }, + {text: 'duration (ms)', value: 'dtdurationms' }, + {text: 'duration (s)', value: 'dtdurations' } ] }, { diff --git a/public/app/features/dashboard/dashboard_ctrl.ts b/public/app/features/dashboard/dashboard_ctrl.ts index 3f3c9eb4c0b..18e8893a507 100644 --- a/public/app/features/dashboard/dashboard_ctrl.ts +++ b/public/app/features/dashboard/dashboard_ctrl.ts @@ -71,7 +71,6 @@ export class DashboardCtrl { }; $scope.broadcastRefresh = function() { - $rootScope.performance.panelsRendered = 0; $rootScope.$broadcast('refresh'); };