Commit Graph

919 Commits

Author SHA1 Message Date
bergquist
6c7454fc2b tag alert queries that return no_data 2017-09-18 14:53:30 +02:00
bergquist
bc678899f7 better formating for error trace 2017-09-18 11:08:58 +02:00
bergquist
8c8fdadb78 trace failed executions 2017-09-18 11:08:58 +02:00
bergquist
e128310045 use tags instead of logs 2017-09-18 11:08:58 +02:00
bergquist
2e350bbb8e adds basic traces using open traces 2017-09-18 11:08:58 +02:00
bergquist
89eda76f29 require dashboard panels to have id
closes #9234
2017-09-18 10:32:58 +02:00
bergquist
c7698a09ed pass context to image uploaders 2017-09-15 16:11:02 +02:00
bergquist
491e6897e7 metrics: set summary unit
we have to use milleseconds since graphite
doesnt support float64
2017-09-14 19:28:54 +02:00
bergquist
2de94d6548 convert old metrics to prom metrics 2017-09-14 14:26:32 +02:00
bergquist
057b8a6b2d improve error message for timeouts
closes #9220
2017-09-11 20:07:57 +02:00
mxlxm
c5400ffe76 mysql: use collation instead of charset (#9156)
- use charset would issue additional 'SET NAMES <VALUE>' queries, set
collation would be better. see: https://github.com/go-sql-driver/mysql#charset
2017-09-04 12:32:07 +02:00
Callum Loh
74ddebc8ea Fix spelling for Hipchat notifier (#9112) 2017-08-29 08:08:51 +02:00
Jason Stangroome
632a5e9b97 Support Azure MySQL (#8618)
Azure's MySQL implementation appears to always respond with an Authentication Method Switch Request Packet requesting `mysql_native_password` auth even though the client's initial Handshake Response already included the native password credentials.

Most MySQL client libraries support this but Golang's go-sql-driver/mysql requires the `allowNativePasswords` DSN parameter set to enable it. Without this parameter, Grafana fails to authenticate to the database with the error message "this user requires mysql native password authentication."

References:

* https://web.archive.org/web/20160814002743/http://dev.mysql.com/doc/internals/en/connection-phase-packets.html#packet-Protocol::AuthSwitchRequest
* https://web.archive.org/web/20160814002743/http://dev.mysql.com/doc/internals/en/connection-phase-packets.html#packet-Protocol::HandshakeResponse
* https://github.com/go-sql-driver/mysql#user-content-allownativepasswords
2017-08-24 10:24:10 +02:00
Torkel Ödegaard
4f9fbcc211 dataproxy: added caching of datasources when doing data proxy requests, #9078 2017-08-23 13:31:26 +02:00
Andrei Burd
3222677493 Datasource Print the received error (#9043) 2017-08-16 16:56:51 +02:00
Torkel Ödegaard
668cb3c1ef Merge branch 'v4.4.x' 2017-08-09 10:37:06 +02:00
Torkel Ödegaard
e8a20643d6 feat: store last seen date for users and present in stats and user lists, closes #9007 2017-08-09 10:36:41 +02:00
Torkel Ödegaard
7c14ade623 Merge branch 'v4.4.x' 2017-08-08 09:28:41 +02:00
Torkel Ödegaard
7031f7e772 fix: sqlite3 and storing/displaying dates used wrong timezone, fixes #8996 2017-08-08 09:28:16 +02:00
David Wittman
8f5fbb4254 Fix typo in PagerDuty notifier options template (#8978) 2017-08-03 08:57:59 +02:00
Torkel Ödegaard
24a79a6bea Merge branch 'v4.4.x' 2017-07-24 12:30:28 +02:00
Torkel Ödegaard
723f5bc9e8 fix: dsahboard_version data column type changed to MEDIUMTEXT, fixes #8813 2017-07-24 12:30:13 +02:00
Liang Jiameng
f8d22385ce add a placeholder to DingTalk Url (#8820) 2017-07-10 16:51:03 +02:00
0x6875790d0a
a622c55b1b (feat) Add image to LINE notify (#8771) 2017-07-07 11:20:27 +02:00
Daniel Lee
6d4c29ea9b migrations: dashboard version migration handles nulls
If a dashboard has a null value for updated_by then the migration
for the dashboard version table fails. This change uses coalesce to
set -1 instead of null when inserting into the created_by column
which has a non-null constraint. Fixes #8783.
2017-07-05 22:14:03 +02:00
Daniel Lee
16cda723d3 migrations: dashboard version migration handles nulls
If a dashboard has a null value for updated_by then the migration
for the dashboard version table fails. This change uses coalesce to
set -1 instead of null when inserting into the created_by column
which has a non-null constraint. Fixes #8783.
2017-07-05 22:06:00 +02:00
Liang Jiameng
109fd998ed Add a new notifier : DingTalk (#8473)
* add alerting notifier: DingDing

* add alerting notifier: DingDing

* add dingding unit test

* add dingding unit test

* delete debug code & format code style.

* fix build failed: dingding_test.go
2017-07-04 15:16:32 +02:00
Daniel Lee
b8aa203707 signup: fix email sent logic for tempuser
Fixes #8656 and properly sets the email_sent and email_sent_on fields
for a tempuser (signup user).
2017-06-30 20:21:08 +02:00
Torkel Ödegaard
08b37186a5 fix: fixed failing sql unit test 2017-06-07 15:42:48 +02:00
Torkel Ödegaard
e7e675e471 Merge branch 'walmartlabs-master' (Dashboard History Feature, #8472) 2017-06-07 14:30:03 +02:00
Torkel Ödegaard
391dc1e225 dasboard_history: fixed sql integration test 2017-06-07 14:25:46 +02:00
Torkel Ödegaard
46412c8475 dasboard_history: security fix, added orgId filter to dashboard version lookup 2017-06-07 14:21:40 +02:00
Torkel Ödegaard
7b5f7ed553 dashboard_history: SQL did not work when using MySQL, fixes to dashboard version numbering, so inserts start at 1, added migration to fix old dashboards with version 0 2017-06-06 15:40:10 +02:00
Torkel Ödegaard
5409f4c0eb dashboard_history: fixed issue with save as & overwrite 2017-06-06 14:39:57 +02:00
Torkel Ödegaard
e2061312f5 refactoring: moved compare dashboard version command out of sqlstore, the code in this command did not use any sql operations and was more high level, could be moved out and use existing queries to get the versions 2017-06-06 00:15:40 +02:00
Torkel Ödegaard
746d6cdc88 refactoring: changed name on compare command to make properties more explainatory 2017-06-05 23:29:25 +02:00
Torkel Ödegaard
cabbfe9adc refactoring: moved dashboard history item formating (message) and fixed dashboard history migration issue, and removed from frontend tests that where no longer needed 2017-06-05 22:59:04 +02:00
Torkel Ödegaard
f18ebea03e fix: dashboard save modals had double submit on enter after my refactoring this morning 2017-06-05 18:01:16 +02:00
Torkel Ödegaard
82d4d54dc5 refactoring: fixed broken unit test in last commit 2017-06-05 17:51:51 +02:00
Torkel Ödegaard
c87418d060 refactoring: Dashboard history restore operation is now reusing existing
operations instead of duplicating a bunch of get & save logic.
2017-06-05 17:45:27 +02:00
Torkel Ödegaard
c296ae1178 refactoring: fixing unit tests broken in last commit 2017-06-05 16:52:36 +02:00
Torkel Ödegaard
e18007153d refactoring: Renamed dashboard version queries that wrongly had Command suffix, added missing OrgId to dashboard history commands and queries 2017-06-05 16:34:32 +02:00
Anton Yackushev
bab21c9069 misspell: Corrected some misspelled words 2017-06-05 15:20:34 +03:00
Torkel Ödegaard
f3980504e2 Merge branch 'master' into walmartlabs-master 2017-06-05 13:43:00 +02:00
Dan Cech
f224fd8310 reduce length of dashboard columns used in compound indexes (#8507) 2017-06-04 14:28:03 +02:00
sanchitraizada
77c046aac6 Implement review feedback 2017-06-01 17:57:09 -04:00
Dan Cech
c0d5b61403 tweak column lengths for utf8mb4 support on older mysql (#8483) 2017-05-29 08:31:36 +02:00
Ben Tranter
a927b893ae Use DBSession for getMaxVersion 2017-05-25 23:04:00 -04:00
sanchitraizada
e6616cc551 Merge pull request #10 from walmartlabs/version-control
History and Version Control for Dashboard Updates
2017-05-25 14:50:47 -07:00
Ben Tranter
b6e46c9eb8 History and Version Control for Dashboard Updates
A simple version control system for dashboards. Closes #1504.

Goals

1. To create a new dashboard version every time a dashboard is saved.
2. To allow users to view all versions of a given dashboard.
3. To allow users to rollback to a previous version of a dashboard.
4. To allow users to compare two versions of a dashboard.

Usage

Navigate to a dashboard, and click the settings cog. From there, click
the "Changelog" button to be brought to the Changelog view. In this
view, a table containing each version of a dashboard can be seen. Each
entry in the table represents a dashboard version. A selectable
checkbox, the version number, date created, name of the user who created
that version, and commit message is shown in the table, along with a
button that allows a user to restore to a previous version of that
dashboard. If a user wants to restore to a previous version of their
dashboard, they can do so by clicking the previously mentioned button.
If a user wants to compare two different versions of a dashboard, they
can do so by clicking the checkbox of two different dashboard versions,
then clicking the "Compare versions" button located below the dashboard.
From there, the user is brought to a view showing a summary of the
dashboard differences. Each summarized change contains a link that can
be clicked to take the user a JSON diff highlighting the changes line by
line.

Overview of Changes

Backend Changes

- A `dashboard_version` table was created to store each dashboard
  version, along with a dashboard version model and structs to represent
  the queries and commands necessary for the dashboard version API
  methods.
- API endpoints were created to support working with dashboard
  versions.
- Methods were added to create, update, read, and destroy dashboard
  versions in the database.
  - Logic was added to compute the diff between two versions, and
  display it to the user.
  - The dashboard migration logic was updated to save a "Version
  1" of each existing dashboard in the database.

Frontend Changes

- New views
- Methods to pull JSON and HTML from endpoints

New API Endpoints

Each endpoint requires the authorization header to be sent in
the format,

```
Authorization: Bearer <jwt>
```

where `<jwt>` is a JSON web token obtained from the Grafana
admin panel.

`GET "/api/dashboards/db/:dashboardId/versions?orderBy=<string>&limit=<int>&start=<int>"`

Get all dashboard versions for the given dashboard ID. Accepts
three URL parameters:

- `orderBy` String to order the results by. Possible values
  are `version`, `created`, `created_by`, `message`. Default
  is `versions`. Ordering is always in descending order.
- `limit` Maximum number of results to return
- `start` Position in results to start from

`GET "/api/dashboards/db/:dashboardId/versions/:id"`

Get an individual dashboard version by ID, for the given
dashboard ID.

`POST "/api/dashboards/db/:dashboardId/restore"`

Restore to the given dashboard version. Post body is of
content-type `application/json`, and must contain.

```json
{
  "dashboardId": <int>,
  "version": <int>
}
```

`GET "/api/dashboards/db/:dashboardId/compare/:versionA...:versionB"`

Compare two dashboard versions by ID for the given
dashboard ID, returning a JSON delta formatted
representation of the diff. The URL format follows
what GitHub does. For example, visiting
[/api/dashboards/db/18/compare/22...33](http://ec2-54-80-139-44.compute-1.amazonaws.com:3000/api/dashboards/db/18/compare/22...33)
will return the diff between versions 22 and 33 for
the dashboard ID 18.

Dependencies Added

- The Go package [gojsondiff](https://github.com/yudai/gojsondiff)
  was added and vendored.
2017-05-24 19:14:39 -04:00