Commit Graph

51 Commits

Author SHA1 Message Date
Jo
8919cafcb4
Identity: Unfurl UserID and Email in pkg/api to user identity.Requester (#76112)
* Unfurl OrgRole in pkg/api to allow using identity.Requester interface

* Unfurl Email in pkg/api to allow using identity.Requester interface

* Update UserID in pkg/api to allow using identity.Requester interface

* fix authed test

* fix datasource tests

* guard login

* fix preferences anon testing

* fix anonymous index rendering

* do not error with user id 0
2023-10-09 16:07:28 +02:00
Jo
729dafaff9
Auth: Unfurl OrgID in pkg/api to allow using identity.Requester interface (#76108)
Unfurl OrgID in pkg/api to allow using identity.Requester interface
2023-10-06 11:34:36 +02:00
idafurjes
6c5a573772
Chore: Move ReqContext to contexthandler service (#62102)
* Chore: Move ReqContext to contexthandler service

* Rename package to contextmodel

* Generate ngalert files

* Remove unused imports
2023-01-27 08:50:36 +01:00
idafurjes
a14621fff6
Chore: Add user service method SetUsingOrg and GetSignedInUserWithCacheCtx (#53343)
* Chore: Add user service method SetUsingOrg

* Chore: Add user service method GetSignedInUserWithCacheCtx

* Use method GetSignedInUserWithCacheCtx from user service

* Fix lint after rebase

* Fix lint

* Fix lint error

* roll back some changes

* Roll back changes in api and middleware

* Add xorm tags to SignedInUser ID fields
2022-08-11 13:28:55 +02:00
Artur Wierzbicki
a025109647
Dash previews: populate crawler queue from SQL query (#44083)
* add SQL migrations

* dashboard previews from sql: poc

* added todos

* refactor: use the same enums where possible

* use useEffect, always return json

* added todo

* refactor + delete files after use

* refactor + fix manual thumbnail upload

* refactor: move all interactions with sqlStore to thumbnail repo

* refactor: remove file operations in thumb crawler/service

* refactor: fix dashboard_thumbs sql store

* refactor: extracted thumbnail fetching/updating to a hook

* refactor: store thumbnails in redux store

* refactor: store thumbnails in redux store

* refactor: private'd repo methods

* removed redux storage, saving images as blobs

* allow for configurable rendering timeouts

* added 1) query for dashboards with stale thumbnails, 2) command for marking thumbnails as stale

* use sql-based queue in crawler

* ui for marking thumbnails as stale

* replaced `stale` boolean prop with `state` enum

* introduce rendering session

* compilation errors

* fix crawler stop button

* rename thumbnail state frozen to locked

* #44449: fix merge conflicts

* #44449: remove thumb methods from `Store` interface

* #44449: clean filepath, defer file closing

* #44449: fix rendering.Theme cyclic import

* #44449: linting

* #44449: linting

* #44449: mutex'd crawlerStatus access

* #44449: added integration tests for `sqlstore.dashboard_thumbs`

* #44449: added comments to explain the `ThumbnailState` enum

* #44449: use os.ReadFile rather then os.Open

* #44449: always enable dashboardPreviews feature during integration tests

* #44449: remove sleep time, adjust number of threads

* #44449: review fix: add `orgId` to `DashboardThumbnailMeta`

* #44449: review fix: automatic parsing of thumbnailState

* #44449: lint fixes

* #44449: review fix: prefer `WithDbSession` over `WithTransactionalDbSession`

* #44449: review fix: add a comment explaining source of the filepath

* #44449: review fix: added filepath validation

* #44449: review fixes https://github.com/grafana/grafana/pull/45063/files @fzambia

Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
Co-authored-by: Alexander Emelin <frvzmb@gmail.com>
2022-02-09 13:23:32 +04:00
Artur Wierzbicki
5148250366
Rendering service - add optional RenderingSession (#44098)
* rendering service changes:
- make node-renderer request timeout configurable
- introduce optional RenderingSession providing a long-lived session key

* remove console logs

* added comment explaining empty "afterRequest" method

* fix compilation error

* update imports formatting

* Update pkg/services/rendering/interface.go

Co-authored-by: Agnès Toulet <35176601+AgnesToulet@users.noreply.github.com>

* Update pkg/services/rendering/rendering.go

Co-authored-by: Agnès Toulet <35176601+AgnesToulet@users.noreply.github.com>

* review fix: extract renderKey related functions/structs to auth.go

* #44449: private'd `rendering.getRequestTimeout`

Co-authored-by: Agnès Toulet <35176601+AgnesToulet@users.noreply.github.com>
2022-01-27 02:02:19 +04:00
Selene
9f7942099b
Rendering: Add light theme for errors (#41616)
* Add light theme for error rendering

* Fix lint

* Update images and add rendering_limit_x images
2021-11-17 12:18:47 +01:00
Serge Zaitsev
57fcfd578d
Chore: replace macaron with web package (#40136)
* replace macaron with web package

* add web.go
2021-10-11 14:30:59 +02:00
Serge Zaitsev
063160aae2
Chore: pass url parameters through context.Context (#38826)
* pass url parameters through context.Context

* fix url param names without colon prefix

* change context params to vars

* replace url vars in tests using new api

* rename vars to params

* add some comments

* rename seturlvars to seturlparams
2021-09-14 18:34:56 +02:00
Serge Zaitsev
c3ab2fdeb7
Macaron: remove custom Request type (#37874)
* remove macaron.Request, use http.Request instead

* remove com dependency from bindings module

* fix another c.Req.Request
2021-09-01 11:18:30 +02:00
Agnès Toulet
ec71919e7b
Rendering: add CSV support (#33729)
* Rendering: add CSV rendering support

* Rendering: save csv files into a separate folder

* add missing field

* Renderer: get filename from renderer plugin

* apply PR suggestions

* Rendering: remove old PhantomJS error

* Rendering: separate RenderCSV and Render functions

* fix alerting test

* Rendering: fix handling error in HTTP mode

* apply PR feedback

* Update pkg/services/rendering/http_mode.go

Co-authored-by: Joan López de la Franca Beltran <joanjan14@gmail.com>

* apply PR feedback

* Update rendering metrics with type label

* Rendering: return error if not able to parse header

* Rendering: update grpc generated file

* Rendering: use context.WithTimeout to render CSV too

Co-authored-by: Joan López de la Franca Beltran <joanjan14@gmail.com>
2021-05-12 17:16:57 +02:00
Arve Knudsen
dd2d206d99
Backend: Remove more globals (#29644)
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-12-15 19:09:04 +01:00
Arve Knudsen
294770f411
Chore: Handle wrapped errors (#29223)
* Chore: Handle wrapped errors

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

Co-authored-by: Emil Tullstedt <emil.tullstedt@grafana.com>
2020-11-19 13:34:28 +01:00
Arve Knudsen
3d3a7cbba8
Chore: Fix staticcheck issues (#28860)
* Chore: Fix issues reported by staticcheck

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

* Undo changes

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

* Chore: Fix issues reported by staticcheck

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

* Fix test

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

* Fix test

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-11-05 13:07:06 +01:00
Marcus Efraimsson
76650e60e4
Image Rendering: New setting to control render request concurrency (#23950)
Fixes #23806

Co-Authored-By: Torkel Ödegaard <torkel@grafana.com>
Co-Authored-By: Arve Knudsen <arve.knudsen@gmail.com>
2020-04-27 17:25:08 +02:00
Marcus Efraimsson
871ad73414
Backend plugins: Renderer v2 plugin (#23625)
grafana-plugin-model is legacy and is replaced by new backend 
plugins SDK and architecture. Renderer is not part of SDK and 
we want to keep it that way for now since it's highly unlikely there 
will be more than one kind of renderer plugin.
So this PR adds support for renderer plugin v2.
Also adds support sending a Device Scale Factor parameter to the 
plugin v2 remote rendering service and by that replaces #22474.
Adds support sending a Headers parameter to the plugin v2 and
remote rendering service which for now only include 
Accect-Language header (the user locale in browser when using 
Grafana), ref grafana/grafana-image-renderer#45.
Fixes health check json details response.
Adds image renderer plugin configuration settings in defaults.ini 
and sample.ini.

Co-Authored-By: Arve Knudsen <arve.knudsen@gmail.com>
2020-04-21 16:16:41 +02:00
Carl Bergquist
3fdd2648b1
Chore: Avoid aliasing importing models in api package (#22492) 2020-03-04 12:57:20 +01:00
Jon Gyllenswärd
7a8c6a9b54
Reporting: Handle timeouts in rendering (#20415)
* Added timeout in grpc call to plugins for rendering
2019-11-18 16:58:15 +01:00
Mario Trangoni
8261613b51 pkg/util/{ip.go,url.go}: Fix some golint issues
See,
$ gometalinter --vendor --deadline 10m --disable-all --enable=golint  ./...
ip.go:8:6⚠️ func SplitIpPort should be SplitIPPort (golint)
url.go:14:6⚠️ func NewUrlQueryReader should be NewURLQueryReader (golint)
url.go:9:6⚠️ type UrlQueryReader should be URLQueryReader (golint)
url.go:37:6⚠️ func JoinUrlFragments should be JoinURLFragments (golint)
2019-01-28 22:29:20 +01:00
Torkel Ödegaard
cb96c6d942 Changed setting to be an alerting setting 2018-09-25 12:17:04 +02:00
Marcus Efraimsson
f106de0efd
enhance error message if phantomjs executable is not found
if arm build, explain that phantomjs is not included by default in arm
builds. If not explain that phantom js isn't installed correctly
2018-06-25 16:06:52 +02:00
Torkel Ödegaard
80d694d205
Backend image rendering as plugin (#11966)
* rendering: headless chrome progress

* renderer: minor change

* grpc: version hell

* updated grpc libs

* wip: minor progess

* rendering: new image rendering plugin is starting to work

* feat: now phantomjs works as well and updated alerting to use new rendering service

* refactor: renamed renderer package and service to rendering to make renderer name less confusing (rendering is internal service that handles the renderer plugin now)

* rendering: now render key is passed and render auth is working in plugin mode

* removed unneeded lines from gitignore

* rendering: now plugin mode supports waiting for all panels to complete rendering

* fix: LastSeenAt fix for render calls, was not set which causes a lot of updates to Last Seen at during rendering, this should fix sqlite db locked issues in seen in previous releases

* change: changed render tz url parameter to use proper timezone name as chrome does not handle UTC offset TZ values

* fix: another update to tz param generation

* renderer: added http mode to renderer service, new ini setting [rendering] server_url
2018-05-24 15:26:27 +02:00
Dan Cech
c0ecdee375
rename Context to ReqContext 2018-03-07 11:54:50 -05:00
Dan Cech
338655dd37
move Context and session out of middleware 2018-03-06 18:16:49 -05:00
bergquist
8a5fe5b0df renderer: avoid calling Handle twice 2017-12-28 14:37:10 +01:00
Torkel Ödegaard
cafed8ce8f Merge branch 'master' into develop 2017-12-12 13:19:07 +01:00
jomenxiao
ad2a69bff4 add encoding param 2017-12-11 16:01:17 +08:00
Torkel Ödegaard
beb9f8ee74 Merge remote-tracking branch 'origin/master' into develop 2017-12-07 14:14:50 +01:00
bergquist
d6d64c53cd typo 💥 2017-12-01 16:23:55 +01:00
jomenxiao
3f95180c98 fix render http[get] params error 2017-11-28 22:20:22 +08:00
Torkel Ödegaard
9fb60c2fc8 Merge branch 'develop' into panel-title-menu-ux 2017-08-02 09:56:08 +02:00
Torkel Ödegaard
34cda65998 fix: png rendering api & timeout parameter now works as it should AND default render timeout increased from 30 to 60 seconds, fixes #8710 2017-07-31 16:04:04 +02:00
Daniel Lee
f68d2816ab dashfolders: security for png rendering 2017-06-22 01:23:48 +02:00
Torkel Ödegaard
1a9aaa4138 feat(server side png rendering): added timezone parameter for server side rendering, refactoring PR #7264 2017-01-31 07:48:10 +01:00
Ryuichi Sakai
1bc55a2d38 Enable image rendering to use browser time offset 2017-01-15 22:01:28 +09:00
bergquist
1a32ab64b6 tech(renderer): improve renderOpts names 2016-09-26 11:07:36 +02:00
Torkel Ödegaard
175c651e65 fix(server side rendering): Fixed issues with server side rendering for alerting & for auth proxy scenarios, fixes #6115, fixes #5906 2016-09-23 12:29:53 +02:00
fg2it
303cd8a5af [RenderToPng fix] (#4901)
* removing useless code

* fix various minor typo

* don't silence phantomjs timeout and allow more time

* fix gofmt
2016-05-04 09:07:45 +02:00
bergquist
43073da7eb feat(renderer): add timeout for the renderer api
closes #4325
2016-03-10 16:02:10 +01:00
Torkel Ödegaard
059db533d5 HTTP API: grafana /render calls nows with api keys, Fixes #1649 2015-04-08 08:59:12 +02:00
Anthony Woods
7010df0fe8 fixes #1619 Secure PhantomJS Png rendering
removes auth hack to allow phantomjs to query pages as a user
without auth.  Instead we pass phantomjs the session cookie,
which it then includes in the request.
2015-03-21 07:14:13 +08:00
Torkel Ödegaard
397dfc54cd Fixed bug in png rendering when having changed public url 2015-02-06 14:17:40 +01:00
Torkel Ödegaard
e5fbbe96fd fixed error handling, and error logging for panel rendering 2015-02-05 12:23:24 +01:00
Torkel Ödegaard
10820f31c2 Changed go package path 2015-02-05 10:37:13 +01:00
Torkel Ödegaard
1d6413bfae More work on backend for user favorites 2015-01-29 12:10:34 +01:00
Torkel Ödegaard
3744bc3228 fixed server side rendering 2015-01-21 10:51:42 +01:00
Torkel Ödegaard
90925273a0 User / Account model split, User and account now seperate entities, collaborators are now AccountUsers 2015-01-19 18:01:04 +01:00
Torkel Ödegaard
1532eb4278 Fixed png rendering 2015-01-16 17:00:31 +01:00
Torkel Ödegaard
22156fe309 Big refactoring for context.User, and how current user info is fetching, now included collaborator role 2015-01-16 14:32:18 +01:00
Torkel Ödegaard
3226a3a58e Fixed hashing of passwords, Closes #3 2015-01-08 09:00:00 +01:00