From f142548969ca7b0e5e44dd024c3aefb27ed4983f Mon Sep 17 00:00:00 2001 From: bergquist Date: Tue, 20 Mar 2018 22:21:24 +0100 Subject: [PATCH 01/11] dataproxy: adds dashboardid and panelid as tags closes #11315 --- pkg/api/pluginproxy/ds_proxy.go | 11 +++++++++++ public/app/features/panel/metrics_panel_ctrl.ts | 1 + public/app/plugins/datasource/graphite/datasource.ts | 2 ++ 3 files changed, 14 insertions(+) diff --git a/pkg/api/pluginproxy/ds_proxy.go b/pkg/api/pluginproxy/ds_proxy.go index b861a344c75..e2f9dd7381f 100644 --- a/pkg/api/pluginproxy/ds_proxy.go +++ b/pkg/api/pluginproxy/ds_proxy.go @@ -89,6 +89,9 @@ func (proxy *DataSourceProxy) HandleRequest() { span.SetTag("user_id", proxy.ctx.SignedInUser.UserId) span.SetTag("org_id", proxy.ctx.SignedInUser.OrgId) + proxy.addTraceFromHeaderValue(span, "X-Panel-Id", "panel_id") + proxy.addTraceFromHeaderValue(span, "X-Dashboard-Id", "dashboard_id") + opentracing.GlobalTracer().Inject( span.Context(), opentracing.HTTPHeaders, @@ -98,6 +101,14 @@ func (proxy *DataSourceProxy) HandleRequest() { proxy.ctx.Resp.Header().Del("Set-Cookie") } +func (proxy *DataSourceProxy) addTraceFromHeaderValue(span opentracing.Span, headerName string, tagName string) { + panelId := proxy.ctx.Req.Header.Get(headerName) + dashId, err := strconv.Atoi(panelId) + if err == nil { + span.SetTag(tagName, dashId) + } +} + func (proxy *DataSourceProxy) getDirector() func(req *http.Request) { return func(req *http.Request) { req.URL.Scheme = proxy.targetUrl.Scheme diff --git a/public/app/features/panel/metrics_panel_ctrl.ts b/public/app/features/panel/metrics_panel_ctrl.ts index 373211611d8..3dd0406d3d3 100644 --- a/public/app/features/panel/metrics_panel_ctrl.ts +++ b/public/app/features/panel/metrics_panel_ctrl.ts @@ -222,6 +222,7 @@ class MetricsPanelCtrl extends PanelCtrl { var metricsQuery = { timezone: this.dashboard.getTimezone(), panelId: this.panel.id, + dashboardId: this.dashboard.id, range: this.range, rangeRaw: this.range.raw, interval: this.interval, diff --git a/public/app/plugins/datasource/graphite/datasource.ts b/public/app/plugins/datasource/graphite/datasource.ts index f02945b8969..335cb400834 100644 --- a/public/app/plugins/datasource/graphite/datasource.ts +++ b/public/app/plugins/datasource/graphite/datasource.ts @@ -50,6 +50,8 @@ export function GraphiteDatasource(instanceSettings, $q, backendSrv, templateSrv data: params.join('&'), headers: { 'Content-Type': 'application/x-www-form-urlencoded', + 'X-Dashboard-Id': options.dashboardId, // enables distributed tracing in ds_proxy + 'X-Panel-Id': options.panelId, // enables distributed tracing in ds_proxy }, }; From 519fd8b2bacb8fdec02f47ffc97b5b12b7a74a38 Mon Sep 17 00:00:00 2001 From: bergquist Date: Wed, 21 Mar 2018 13:16:59 +0100 Subject: [PATCH 02/11] graphite: adds more traces for alerting --- pkg/tsdb/graphite/graphite.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/tsdb/graphite/graphite.go b/pkg/tsdb/graphite/graphite.go index 73b173813af..2960ba0edc4 100644 --- a/pkg/tsdb/graphite/graphite.go +++ b/pkg/tsdb/graphite/graphite.go @@ -28,12 +28,9 @@ func NewGraphiteExecutor(datasource *models.DataSource) (tsdb.TsdbQueryEndpoint, return &GraphiteExecutor{}, nil } -var ( - glog log.Logger -) +var glog = log.New("tsdb.graphite") func init() { - glog = log.New("tsdb.graphite") tsdb.RegisterTsdbQueryEndpoint("graphite", NewGraphiteExecutor) } @@ -52,6 +49,7 @@ func (e *GraphiteExecutor) Query(ctx context.Context, dsInfo *models.DataSource, } for _, query := range tsdbQuery.Queries { + glog.Info("graphite", "query", query.Model) if fullTarget, err := query.Model.Get("targetFull").String(); err == nil { target = fixIntervalFormat(fullTarget) } else { @@ -79,6 +77,9 @@ func (e *GraphiteExecutor) Query(ctx context.Context, dsInfo *models.DataSource, span.SetTag("target", target) span.SetTag("from", from) span.SetTag("until", until) + span.SetTag("datasource_id", dsInfo.Id) + span.SetTag("org_id", dsInfo.OrgId) + defer span.Finish() opentracing.GlobalTracer().Inject( From 6f363153d7789a45efc413dd28109c88f9ac62ef Mon Sep 17 00:00:00 2001 From: Julian Kornberger Date: Thu, 22 Mar 2018 14:14:44 +0100 Subject: [PATCH 03/11] Adjust permissions of unix socket fixes #8358 --- pkg/api/http_server.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/api/http_server.go b/pkg/api/http_server.go index 921a641b5da..387a543ca89 100644 --- a/pkg/api/http_server.go +++ b/pkg/api/http_server.go @@ -74,12 +74,15 @@ func (hs *HTTPServer) Start(ctx context.Context) error { return nil } case setting.SOCKET: - ln, err := net.Listen("unix", setting.SocketPath) + ln, err := net.ListenUnix("unix", &net.UnixAddr{Name: setting.SocketPath, Net: "unix"}) if err != nil { hs.log.Debug("server was shutdown gracefully") return nil } + // Make socket writable by group + os.Chmod(setting.SocketPath, 0660) + err = hs.httpSrv.Serve(ln) if err != nil { hs.log.Debug("server was shutdown gracefully") From 97fa5361ffa93f804bad6ad9e1c5d706f9584993 Mon Sep 17 00:00:00 2001 From: Leonard Gram Date: Fri, 23 Mar 2018 16:13:59 +0100 Subject: [PATCH 04/11] changelog: unix socket permissions --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1df6266c763..ee3d004f22d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ * **Templating**: Add comma templating format [#10632](https://github.com/grafana/grafana/issues/10632), thx [@mtanda](https://github.com/mtanda) * **Prometheus**: Support POST for query and query_range [#9859](https://github.com/grafana/grafana/pull/9859), thx [@mtanda](https://github.com/mtanda) * **Alerting**: Add support for retries on alert queries [#5855](https://github.com/grafana/grafana/issues/5855), thx [@Thib17](https://github.com/Thib17) +* **Server**: Adjust permissions of unix socket [#11343](https://github.com/grafana/grafana/pull/11343), thx [@corny](https://github.com/corny) ### Minor * **OpsGenie**: Add triggered alerts as description [#11046](https://github.com/grafana/grafana/pull/11046), thx [@llamashoes](https://github.com/llamashoes) From f223e99875e678ce6f2e1a8bb28dd098135080d6 Mon Sep 17 00:00:00 2001 From: Leonard Gram Date: Fri, 23 Mar 2018 16:25:20 +0100 Subject: [PATCH 05/11] cleanup --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ee3d004f22d..f3d4f357f3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,6 @@ * **Templating**: Add comma templating format [#10632](https://github.com/grafana/grafana/issues/10632), thx [@mtanda](https://github.com/mtanda) * **Prometheus**: Support POST for query and query_range [#9859](https://github.com/grafana/grafana/pull/9859), thx [@mtanda](https://github.com/mtanda) * **Alerting**: Add support for retries on alert queries [#5855](https://github.com/grafana/grafana/issues/5855), thx [@Thib17](https://github.com/Thib17) -* **Server**: Adjust permissions of unix socket [#11343](https://github.com/grafana/grafana/pull/11343), thx [@corny](https://github.com/corny) ### Minor * **OpsGenie**: Add triggered alerts as description [#11046](https://github.com/grafana/grafana/pull/11046), thx [@llamashoes](https://github.com/llamashoes) @@ -20,6 +19,7 @@ * **Units**: Second to HH:mm:ss formatter [#11107](https://github.com/grafana/grafana/issues/11107), thx [@gladdiologist](https://github.com/gladdiologist) * **Singlestat**: Add color to prefix and postfix in singlestat panel [#11143](https://github.com/grafana/grafana/pull/11143), thx [@ApsOps](https://github.com/ApsOps) * **Dashboards**: Version cleanup fails on old databases with many entries [#11278](https://github.com/grafana/grafana/issues/11278) +* **Server**: Adjust permissions of unix socket [#11343](https://github.com/grafana/grafana/pull/11343), thx [@corny](https://github.com/corny) # 5.0.4 (unreleased) * **Dashboard** Fixed bug where collapsed panels could not be directly linked to/renderer [#11114](https://github.com/grafana/grafana/issues/11114) & [#11086](https://github.com/grafana/grafana/issues/11086) From da83964a7e59a836bb4d3b869fc159599451a397 Mon Sep 17 00:00:00 2001 From: Marcus Efraimsson Date: Fri, 23 Mar 2018 16:41:08 +0100 Subject: [PATCH 06/11] notes about closing #11306 [skip ci] --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f3d4f357f3a..d4e962ba301 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ * **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) * **Postgres/MySQL**: Ability to insert 0s or nulls for missing intervals [#9487](https://github.com/grafana/grafana/issues/9487), thanks [@svenklemm](https://github.com/svenklemm) +* **Postgres/MySQL/MSSQL**: Fix precision for the time column in table mode [#11306](https://github.com/grafana/grafana/issues/11306) * **Graph**: Align left and right Y-axes to one level [#1271](https://github.com/grafana/grafana/issues/1271) & [#2740](https://github.com/grafana/grafana/issues/2740) thx [@ilgizar](https://github.com/ilgizar) * **Graph**: Thresholds for Right Y axis [#7107](https://github.com/grafana/grafana/issues/7107), thx [@ilgizar](https://github.com/ilgizar) * **Graph**: Support multiple series stacking in histogram mode [#8151](https://github.com/grafana/grafana/issues/8151), thx [@mtanda](https://github.com/mtanda) From 02f84e0c747cda9caae1137717fbeb1662be4c7b Mon Sep 17 00:00:00 2001 From: Tobias Wolf Date: Sat, 24 Mar 2018 14:41:41 +0100 Subject: [PATCH 07/11] Add hints for the 'pd' Duplicate Panel command from PR #11264 --- docs/sources/features/shortcuts.md | 1 + public/app/core/components/help/help.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/docs/sources/features/shortcuts.md b/docs/sources/features/shortcuts.md index cbcf3670c83..88c645eafdf 100644 --- a/docs/sources/features/shortcuts.md +++ b/docs/sources/features/shortcuts.md @@ -42,6 +42,7 @@ Hit `?` on your keyboard to open the shortcuts help modal. - `e` Toggle panel edit view - `v` Toggle panel fullscreen view - `p` `s` Open Panel Share Modal +- `p` `d` Duplicate Panel - `p` `r` Remove Panel ### Time Range diff --git a/public/app/core/components/help/help.ts b/public/app/core/components/help/help.ts index a544fc89854..a1d3c34ae5b 100644 --- a/public/app/core/components/help/help.ts +++ b/public/app/core/components/help/help.ts @@ -31,6 +31,7 @@ export class HelpCtrl { { keys: ['e'], description: 'Toggle panel edit view' }, { keys: ['v'], description: 'Toggle panel fullscreen view' }, { keys: ['p', 's'], description: 'Open Panel Share Modal' }, + { keys: ['p', 'd'], description: 'Duplicate Panel' }, { keys: ['p', 'r'], description: 'Remove Panel' }, ], 'Time Range': [ From 03b2561af29a7801977b213832d9ed33e83b1e3b Mon Sep 17 00:00:00 2001 From: Tobias Wolf Date: Sat, 24 Mar 2018 14:49:06 +0100 Subject: [PATCH 08/11] Missed the 'p d' hint in the popup-menu --- public/app/features/panel/panel_ctrl.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/public/app/features/panel/panel_ctrl.ts b/public/app/features/panel/panel_ctrl.ts index 429408ed803..f54877c2c37 100644 --- a/public/app/features/panel/panel_ctrl.ts +++ b/public/app/features/panel/panel_ctrl.ts @@ -190,6 +190,7 @@ export class PanelCtrl { text: 'Duplicate', click: 'ctrl.duplicate()', role: 'Editor', + shortcut: 'p d', }); menu.push({ From f2249a5bccef56dd50a60920e944992daa84a94d Mon Sep 17 00:00:00 2001 From: Sven Klemm Date: Sun, 25 Mar 2018 15:49:06 +0200 Subject: [PATCH 09/11] add missing word to graphite docs --- docs/sources/features/datasources/graphite.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sources/features/datasources/graphite.md b/docs/sources/features/datasources/graphite.md index 05a7df7fea8..7c4187da9ae 100644 --- a/docs/sources/features/datasources/graphite.md +++ b/docs/sources/features/datasources/graphite.md @@ -75,7 +75,7 @@ You can reference queries by the row “letter” that they’re on (similar to ## Point consolidation All Graphite metrics are consolidated so that Graphite doesn't return more data points than there are pixels in the graph. By default, -this consolidation is done using `avg` function. You can how Graphite consolidates metrics by adding the Graphite consolidateBy function. +this consolidation is done using `avg` function. You can control how Graphite consolidates metrics by adding the Graphite consolidateBy function. > *Notice* This means that legend summary values (max, min, total) cannot be all correct at the same time. They are calculated > client side by Grafana. And depending on your consolidation function only one or two can be correct at the same time. From bf4273b5844956e3b3ac6df3264e600ca29e23e1 Mon Sep 17 00:00:00 2001 From: Thomas Rohlik Date: Mon, 26 Mar 2018 16:34:49 +0200 Subject: [PATCH 10/11] Add new currency - Czech koruna Currency used in Czech republic. --- public/app/core/utils/kbn.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/public/app/core/utils/kbn.ts b/public/app/core/utils/kbn.ts index 4a29f3983e1..dcb04a3e38e 100644 --- a/public/app/core/utils/kbn.ts +++ b/public/app/core/utils/kbn.ts @@ -447,6 +447,7 @@ kbn.valueFormats.currencyDKK = kbn.formatBuilders.currency('kr'); kbn.valueFormats.currencyISK = kbn.formatBuilders.currency('kr'); kbn.valueFormats.currencyNOK = kbn.formatBuilders.currency('kr'); kbn.valueFormats.currencySEK = kbn.formatBuilders.currency('kr'); +kbn.valueFormats.currencyCZK = kbn.formatBuilders.currency('czk'); // Data (Binary) kbn.valueFormats.bits = kbn.formatBuilders.binarySIPrefix('b'); @@ -869,6 +870,7 @@ kbn.getUnitFormats = function() { { text: 'Icelandic Króna (kr)', value: 'currencyISK' }, { text: 'Norwegian Krone (kr)', value: 'currencyNOK' }, { text: 'Swedish Krona (kr)', value: 'currencySEK' }, + { text: 'Czech koruna (czk)', value: 'currencyCZK' }, ], }, { From e622d5582b29b2aea982bca8893bb07c0771f6af Mon Sep 17 00:00:00 2001 From: bergquist Date: Tue, 27 Mar 2018 10:56:19 +0200 Subject: [PATCH 11/11] changelog: adds note about closing #11102 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d4e962ba301..a940ff044db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ * **Singlestat**: Add color to prefix and postfix in singlestat panel [#11143](https://github.com/grafana/grafana/pull/11143), thx [@ApsOps](https://github.com/ApsOps) * **Dashboards**: Version cleanup fails on old databases with many entries [#11278](https://github.com/grafana/grafana/issues/11278) * **Server**: Adjust permissions of unix socket [#11343](https://github.com/grafana/grafana/pull/11343), thx [@corny](https://github.com/corny) +* **Shortcuts**: Add shortcut for duplicate panel [#11102](https://github.com/grafana/grafana/issues/11102) # 5.0.4 (unreleased) * **Dashboard** Fixed bug where collapsed panels could not be directly linked to/renderer [#11114](https://github.com/grafana/grafana/issues/11114) & [#11086](https://github.com/grafana/grafana/issues/11086)