34 Commits

Author SHA1 Message Date
6768c6c059 Chore: Remove public vars in setting package (#81018)
Removes the public variable setting.SecretKey plus some other ones. 
Introduces some new functions for creating setting.Cfg.
2024-01-23 12:36:22 +01:00
e99f75f0ca Alerting: Linking external images securely - Azure Blob (#1) (#56598) 2022-11-01 13:02:17 +01:00
687e79538b Alerting: Add a general screenshot service and alerting-specific image service. (#49293)
This commit adds a pkg/services/screenshot package for taking and uploading screenshots of Grafana dashboards. It supports taking screenshots of both dashboards and individual panels within a dashboard, using the rendering service.

The screenshot package has the following services, most of which can be composed:

BrowserScreenshotService (Takes screenshots with headless Chrome)
CachableScreenshotService (Caches screenshots taken with another service such as BrowserScreenshotService)
NoopScreenshotService (A no-op screenshot service for tests)
SingleFlightScreenshotService (Prevents duplicate screenshots when taking screenshots of the same dashboard or panel in parallel)
ScreenshotUnavailableService (A screenshot service that returns ErrScreenshotsUnavailable)
UploadingScreenshotService (A screenshot service that uploads taken screenshots)

The screenshot package does not support wire dependency injection yet. ngalert constructs its own version of the service. See https://github.com/grafana/grafana/issues/49296

This PR also adds an ImageScreenshotService to ngAlert. This is used to take screenshots with a screenshotservice and then store their location reference for use by alert instances and notifiers.
2022-05-22 22:33:49 +08:00
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
70c7724b65 GCS image uploader: Add tests (#28521)
* GCS uploader: Add tests

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

* Use go generate

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-10-26 20:35:12 +01:00
1646de4540 Image uploader: Fix uploading of images to GCS (#26493)
* GCS image uploader: Re-implement with Google SDK

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

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-10-24 13:00:36 +02:00
a5d9196a53 Chore/fix lint issues (#27704)
* Chore: Fix linting issues

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-09-22 16:22:19 +02:00
4e94c0959a Image Store: Add support for using signed URLs when uploading images to GCS (#26840)
Enables creating signed URLs when uploading images to Google Cloud Storage. 
By using signed urls, not only is the public URL expiration configurable but the 
images in the bucket are not publicly accessible.

Fixes #26773

Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com>
2020-09-07 19:10:14 +02:00
41d432b5ae Chore: Enable whitespace linter (#25903)
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-07-06 20:17:28 +02:00
42032f6c03 ImgUploader: add support for non-amazon S3 (#20354)
* imguploader: add support for non-Amazon S3 endpoints and forcing of path-style S3 addressing

fixes #11240

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-01-02 15:10:20 +01:00
35e0e078b7 pkg/util: Check errors (#19832)
* pkg/util: Check errors
* pkg/services: DRY up code
2019-10-23 10:40:12 +02:00
2fff8f77dc move log package to /infra (#17023)
ref #14679

Signed-off-by: zhulongcheng <zhulongcheng.me@gmail.com>
2019-05-13 08:45:54 +02:00
1b6203e430 removes error2 logger 2019-01-15 11:49:18 +01:00
fa7d7ed5df Initial Baby Step to refactoring settings from global vars to instance (#11777)
* wip: start on refactoring settings

* settings: progress on settings refactor

* refactor: progress on settings refactoring

* fix: fixed failing test

* settings: moved smtp settings from global to instance
2018-04-30 16:21:04 +02:00
c82e23d96e imguploader: Add support for new internal image store (#6922) 2018-01-12 21:40:12 +01:00
b840514797 imguploader: log if the configuration is invalid 2017-12-28 15:48:19 +01:00
af15e3c0d0 Implement Azure Blob external image uploader 2017-12-27 08:53:00 -05:00
767b460ff1 [GCS] Support for gcs path 2017-11-21 17:22:40 +00:00
e4541a7fd1 support for s3 path (#9151) 2017-10-04 21:04:20 +02:00
50d82155ed Merge branch 'master' of https://github.com/williamjoy/grafana into williamjoy-master 2017-09-27 09:37:26 +02:00
88a8991722 config bucket and region for s3 uploader
this is to support cn-north-1 region as it can get s3 url programatically.
also keeps support 'bucket_url' for backward compatiblity
2017-09-19 04:57:25 -04:00
c7698a09ed pass context to image uploaders 2017-09-15 16:11:02 +02:00
fcdf282090 GCS support via JSON API 2017-09-15 16:11:02 +02:00
1188f8df73 gofmt fixes 2017-09-15 16:11:02 +02:00
72d7c4d620 Added GCS support #8370 2017-09-15 16:11:02 +02:00
6d9e8bd147 webdav: allow specification of a different public_url than upload url 2017-04-25 17:22:18 +02:00
be5c4f47a6 s3: support for alternative s3 bucket url syntax, closes #7871 2017-03-20 14:10:44 +01:00
7e4c101d02 S3 IAM support (#7058)
* add s3 dependencly

* rewrite image uploader by aws-sdk-go

* improve backward compatibility of s3 image uploading

* set default for expires option

* remove acl and expires
2017-01-11 14:00:49 +01:00
92121ea656 feat(alerting): add nop uploader
ref #6183
2016-10-05 07:34:48 +02:00
50b41130ca feat(alerting): fixed s3 upload issue, progress on alerting on null/missing data, updated ini package to get the support for line continuations 2016-09-07 10:11:00 +02:00
99e99922b4 feat(alerting): add support for uploading images to webdav.
closes #5770
2016-08-11 16:48:54 +02:00
357358898d feat(annotations): working on alert annotations, #5694 2016-08-01 10:07:00 +02:00
2b276d5cd1 feat(alerting): working on alert notification and image rendering 2016-07-30 13:36:21 +02:00
4fc50742a0 feat(alerting): working on image rendering with alert notifications 2016-07-29 14:55:02 +02:00