Commit Graph
93 Commits
Author SHA1 Message Date
Emil Tullstedt fc47e0d35e Docs: Update curl example to use --user for basic auth (#61226) 2023-01-11 11:18:26 +01:00
Emil Tullstedt 649b50055c Chore: Move all backend contribution documents to a single directory (#61140) 2023-01-11 11:16:52 +01:00
Emil Tullstedt 67661c2535 Fix: Use an existing Dockerfile for the Go image (#61158) 2023-01-10 17:11:43 +01:00
Emil Tullstedt bf574e98c8 Chore: Upgrade Go to 1.19.4 (#60794) 2022-12-29 13:03:56 +01:00
Emil Tullstedt 88323a30b7 Logging: Fix running tests multiple times (#60559)
- Create new ctxLogProviders for each scenario to support
go test -count=n for n>1. Currently, it just kept adding providers for
every new run, which would make it add way more key-value pairs to
the provider than necessary.

- Adding a helper method to the scenario to make it easier to set up tests
for logging and easier to read the tests. I also flattened the test file, to
reduce the complexity of each test function.
2022-12-27 16:42:03 +01:00
Emil Tullstedt b7fc837c35 Chore: Upgrade golangci-lint to v1.50.1 (#60379) 2022-12-15 12:58:48 +01:00
Emil Tullstedt 3188a8288e Settings: Update reference to go-kit/log (#60309)
Introduced after last update to #59732.
2022-12-14 12:48:09 +00:00
Emil Tullstedt f864be5024 Chore: Deny gopkg.in/yaml.v2 (#60187) 2022-12-13 14:31:04 +01:00
Emil Tullstedt f485f8a8f8 Chore: Upgrade Go dependencies (#59501) 2022-11-29 16:37:45 +01:00
Emil Tullstedt 990d8cd22e Chore: Upgrade go-sqlite3 to v1.14.16 (#58581) 2022-11-10 15:49:28 +01:00
Emil Tullstedt 75701695d8 pkg/web: avoid shared middleware slice (#58458) 2022-11-08 10:58:04 -05:00
Emil Tullstedt 89eba7a108 Server: Write internal server error on missing write (#57813) 2022-11-07 16:14:41 +01:00
Emil Tullstedt 1ba25b2baa Preferences: Create indices (#48356) 2022-11-07 15:52:26 +01:00
Emil Tullstedt 428dd54094 Chore: Upgrade Go to 1.19.3 (#58052) 2022-11-04 14:50:43 +01:00
Emil Tullstedtandemerson_gong d0dfb28ee4 Security: Upgrade x/text to version unaffected by CVE-2022-32149 (#57797) (#57803)
Co-authored-by: emerson_gong <yong-jie.gong@microfocus.com>
2022-11-02 14:28:43 +01:00
Emil Tullstedt 1e2b7c5368 Errors: Add HTTP writer for errutil.Error (#57661) 2022-10-26 16:57:53 +02:00
Emil Tullstedt 2c9526fdf7 Docs: Update errors documentation (#57402)
Expand on what a base should represent and update some out of date info.
2022-10-21 20:50:29 +02:00
Emil Tullstedt 22756913ba Errutil: Update documentation for Go 1.19 (#55807) 2022-10-07 12:47:43 +02:00
Emil Tullstedt c2d3a31772 Chore: Upgrade Go to 1.19.2 (#56355) 2022-10-07 12:47:24 +02:00
Emil Tullstedt bb479e030a RBAC: Redirect to /login when forceLogin is set (#56469) 2022-10-07 08:18:56 +02:00
Emil Tullstedt 6aef353b59 Tracing: Fix bug where errors are not reported to OTel (#55925) 2022-09-28 15:54:47 +02:00
Emil Tullstedt b0b1e8d568 Tracing: Document Tracer and Span interfaces (#55926) 2022-09-28 15:53:48 +02:00
Emil Tullstedt f7a3e50b23 UsageStats: Add traces when sending usage stats (#55474) 2022-09-26 15:10:54 +02:00
Emil Tullstedt 647997cc4c Alerting: Fix flaky test (#55551)
The length of the identifier from the underlying library is 9 or more characters depending on the rate at which the identifiers are generated. See https://pkg.go.dev/github.com/teris-io/shortid

The test previously made the assumption that the length will always be 10, which would intermittently fail.
2022-09-21 14:17:25 +02:00
Emil Tullstedt c10a69c007 Cleanup: Add traces to cleanup jobs (#55465) 2022-09-21 12:01:21 +02:00
Emil Tullstedt 4711454b81 Org: Fix service initialization (#55460) 2022-09-20 08:28:47 -04:00
Emil Tullstedt 104388dcc1 Chore: Update swagger to v0.30.2 (#55159) 2022-09-14 14:47:19 +00:00
Emil Tullstedt b287047052 Chore: Upgrade Go to 1.19.1 (#54902)
* WIP

* Set public_suffix to a pre Ruby 2.6 version

* we don't need to install python

* Stretch->Buster

* Bump versions in lib.star

* Manually update linter

Sort of messy, but the .mod-file need to contain all dependencies that
use 1.16+ features, otherwise they're assumed to be compiled with
-lang=go1.16 and cannot access generics et al.

Bingo doesn't seem to understand that, but it's possible to manually
update things to get Bingo happy.

* undo reformatting

* Various lint improvements

* More from the linter

* goimports -w ./pkg/

* Disable gocritic

* Add/modify linter exceptions

* lint + flatten nested list

Go 1.19 doesn't support nested lists, and there wasn't an obvious workaround.
https://go.dev/doc/comment#lists
2022-09-12 12:03:49 +02:00
Emil Tullstedt 0ffbf901d7 ContextHandler: Use stdlib format for middleware (#54219) 2022-08-25 14:35:21 +02:00
Emil Tullstedt ce7593686d Errors: Allow using Base as an error type (#53824) 2022-08-22 11:07:33 +02:00
Emil Tullstedt cc777e175e Chore: Panic! in the Logs (#53664) 2022-08-12 13:43:16 +00:00
Emil Tullstedt 78f26a079c Chore: Upgrade to Go version 1.17.12 (#52523) 2022-07-20 14:27:44 +02:00
Emil Tullstedt c8b5307c61 Preferences: Get home dashboard from teams (#52225) 2022-07-14 08:20:11 -04:00
Emil Tullstedtandeleijonmarck 06bd8b8e7a CSRF: Fix additional headers option (#50629)
* CSRF: Fix additional headers option

* fix: type assertion on error fail on wrapped error

* Update pkg/middleware/csrf/csrf_test.go

Co-authored-by: Emil Tullstedt <emil.tullstedt@grafana.com>

* update test

Co-authored-by: eleijonmarck <eric.leijonmarck@gmail.com>
2022-07-13 19:28:59 +01:00
Emil Tullstedt dd6d71ee4b HTTP: Add function for using new style errors with fallback (#51627) 2022-07-13 13:14:28 +02:00
Emil Tullstedt c12d1727f0 Docker: Update glibc version (#51107) 2022-07-06 17:30:56 +02:00
Emil TullstedtandJeff Levin a14ca8fb62 Dependencies: Clean up gofrs/uuid (#51615)
* Dependencies: switch from gofrs/uuid to google/uuid

Co-authored-by: Jeff Levin <jeff@levinology.com>
2022-06-30 10:55:33 -08:00
Emil TullstedtandSofia Papagiannaki 0e7a495829 Docs: Update backend architecture contributor documentation (#51172)
Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>
2022-06-30 10:47:10 -04:00
Emil Tullstedt b45c71c9ca Loki: Create component for sending logs to Loki (#51500) 2022-06-30 10:24:44 +02:00
Emil Tullstedt 7d815a1db5 Alerting: Use google/uuid instead of gofrs/uuid (#51242) 2022-06-28 11:57:24 +02:00
Emil Tullstedt f35aa8c7d7 Chore: Update golang.org/x dependencies (#51028) 2022-06-20 11:24:21 +02:00
Emil Tullstedt f1834163ec ShortURL: Use new Error type (#50859) 2022-06-15 15:11:36 +02:00
Emil Tullstedt 929fcd5910 Preferences: Use inmemory structure for testing (#50491) 2022-06-14 10:54:19 +02:00
Emil Tullstedt 264c2a9d1e Errors: Introduce error type with Grafana specific metadata (#47504) 2022-06-14 10:50:11 +02:00
3e81fa0716 API: Migrate CSRF to service and support additional options (#48120)
* API: Migrate CSRF to service and support additional options

* minor

* public Csrf service to use in tests

* WIP

* remove fmt

* comment

* WIP

* remove fmt prints

* todo add prefix slash

* remove fmt prints

* linting fix

* remove trimPrefix

Co-authored-by: Eric Leijonmarck <eric.leijonmarck@gmail.com>
Co-authored-by: IevaVasiljeva <ieva.vasiljeva@grafana.com>
2022-06-02 15:52:30 +02:00
Emil Tullstedt 39096208ed Settings: Sunset non-duration based login lifetime config (#49944) 2022-06-01 12:29:15 +02:00
Emil Tullstedt d3ffb9e245 Usage stats: Divide collection into multiple functions to isolate failures (#49928) 2022-06-01 10:27:06 +00:00
Emil Tullstedt 51ff2b8c58 Logging: Unify logging fakes (#48822) 2022-05-06 17:44:22 +02:00
Emil TullstedtandTorkel Ödegaard fc0346fe5b Dashboards: Use home dashboard from org again (#48244)
* Dashboards: Use home dashboard from org again

* Set homeDashboardID

Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
2022-04-26 11:46:26 +02:00
Emil Tullstedt d76e5d7c6a Usage stats: Detect Prometheus flavors (#47942)
* Naïve Prometheus flavor detector

* Add concurrency and memoization

* Remove concurrency

* Fix tests

* close response body

* Add tests
2022-04-20 13:51:33 +00:00
Emil Tullstedt 24038d9985 Chore: Update Go version (#47914)
* Remove makefile (it's not used anymore)

* Directly download and install nodejs package

The Packages file for deb.nodesource.com/node_16.x doesn't list older
versions, so only the most recent version of nodejs is available. We
don't want to require every update to the build container to have to
update nodejs if a never version is available, so I manually download
the deb and install it with dpkg.

* Update Go version

* Update lib.star

* Generate new .drone.yml
2022-04-20 09:14:12 +02:00
Emil Tullstedt 3df625e9f4 UsageStats: Move stats collection to separate service (#47381)
* Remove specific stats from usage stats service

* Create statscollector service

* refactor

* Update and move tests

Mostly equivalent tests to before, but they've been divided over the two
services and removed the behavior driven legacy from GoConvey to
reduce the complexity of the tests.

* Collect featuremgmr metrics (copied over from #47407)

I removed the metrics registration from the feature manager in the merge
and re-add them in this commit. Separated to make things easier to
review.
2022-04-08 13:41:26 +02:00
Emil Tullstedt 7bc821baf2 Logger: Use specified format for file logger (#46970)
Fixes #45941
2022-03-26 11:40:08 +01:00
Emil TullstedtandKarl Persson 0e5ac29763 Data sources: Grant creator edit permissions to data source by default (#46168)
* Data sources: Sent user ID when creating data source

* Data sources: Grant a data source creator edit permissions

* Use edit permisison and only append if user id is in command

Co-authored-by: Karl Persson <kalle.persson@grafana.com>
2022-03-21 17:16:05 +01:00
Emil Tullstedt ae2595e86a Chore: Upgrade go-datemath dependency (#44592)
* Datemath: Upgrade dependency

* go mod tidy
2022-01-31 15:17:48 +01:00
Emil TullstedtandJames Brown 25736b6afb Auth: implement auto_sign_up for auth.jwt (#43502)
Co-authored-by: James Brown <jbrown@easypost.com>
2022-01-13 17:15:22 +01:00
Emil Tullstedt fdd196a627 Datemath: Remove unused functions (#43665) 2022-01-07 12:53:31 +01:00
Emil Tullstedt df4e9ca12b Datemath: Support fiscal years (#43558) 2022-01-04 13:56:34 +01:00
Emil Tullstedt 12e0a94316 JWT: Split race-y test into two stable tests (#41950) 2021-11-19 12:05:04 +01:00
Emil Tullstedt dbb8246b6b JWT: Increase distance from now in tests (#41794) 2021-11-17 12:03:56 +01:00
Emil Tullstedt 3b637f4b44 Access control: Redirect non-API calls (#41100) 2021-11-04 09:59:52 +01:00
Emil Tullstedt 1505b8c0b0 Docs: Document PKCE support for OAuth (#39949) 2021-10-13 16:45:39 +02:00
Emil Tullstedt e73cd2fdeb OAuth: Support PKCE (#39948) 2021-10-13 16:45:15 +02:00
Emil Tullstedt de9bcd6163 Docs: Document new exporter for usage insights (#38593) 2021-09-22 11:21:53 +02:00
Emil Tullstedt ad971cc9be LDAP: Search all DNs for users (#38891) 2021-09-14 10:49:37 +02:00
Emil Tullstedt 55efeb0c02 Revert "AccessControl: Implement a way to register fixed roles (#35641)" (#37397)
This reverts commit 88c11f1cc0.
2021-07-30 13:58:49 +02:00
Emil Tullstedt dc7a641978 Docs: Fix code sample for access control provisioning (#35406) 2021-06-09 13:47:21 +02:00
Emil Tullstedt 96da84ca49 Access control: Rename predefined roles to fixed roles (docs) (#34472) 2021-05-26 14:59:24 +02:00
Emil Tullstedt 0f4806db8a Access control: Rename predefined roles to fixed roles (code) (#34469)
* s/grafana:roles:/fixed:/

* Update free text references to predefined roles
2021-05-25 15:36:01 +02:00
Emil Tullstedt c2e761f28e Access control: Attach ID to error message (#33472) 2021-05-12 23:00:27 +02:00
Emil Tullstedt 68cdbb611f Access control: Use global scope for users permissions (#33941)
Quick fix. We eventually will want to make users endpoints more aware of
the access control system.
2021-05-11 20:04:29 +02:00
Emil Tullstedt 4496ae496e Access control: Clean up users scopes (#33532)
Following discussion in grafana/grafana-enterprise#1292, removing
org-scoped users scopes to make it clear that the local organization is
the default and the alternative to that is a global scope (for a select
few endpoints)
2021-05-03 10:27:12 +02:00
Emil Tullstedt 840828b5d2 Access control: Allow empty scope requirement lists (#33518) 2021-04-29 13:22:13 +02:00
Emil Tullstedt a87dd17501 UsageStats: Purpose named variables (#31264) 2021-02-17 10:19:27 +01:00
Emil TullstedtandDiana Payton 2a55e00c78 Licensing: Document new v7.4 options and APIs (#30217)
Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com>
2021-01-19 18:09:05 +01:00
Emil Tullstedt af27dd7e7d Licensing: Send map of environment variables to plugins (#30347)
Replace hard-coded `GF_ENTERPRISE_LICENSE_TEXT` with a
`map[string]string` to allow the licensing service to allow sending any
environment variable through to the plugins for licensing purposes.
2021-01-18 14:42:39 +01:00
Emil Tullstedt 3ea1fd035f LDAP: Update use_ssl documentation (#29964) 2020-12-23 09:14:02 +01:00
Emil Tullstedt 46d568129e Chore: Bump build pipeline version (#29023) 2020-11-11 13:12:45 +01:00
Emil Tullstedt 2e4191afca Chore(crewjam/saml): go get -u (#27598) 2020-09-15 16:38:23 +02:00
Emil Tullstedt 10141c5e6c Stats: Use more efficient SQL and add timeouts (#27390) 2020-09-08 09:52:08 +02:00
Emil Tullstedt d5687cce11 Stats: Correct the number of arguments for SQL call (#27182)
* Stats: Correct the number of arguments for SQL call

* Stats: Run admin stats call as integration test
2020-08-25 08:59:44 +02:00
Emil TullstedtandSofia Papagiannaki 954a2811b3 Stats: Stop counting the same user multiple times (#26777)
* Stats: Cache based stats implementation

* Stats: Correct logic and add larger scale test

* Stats: linter

* Stats: SQL implementation

* Stats: cleanup SQL

* Stats: Tab -> Spaces

* Update pkg/services/sqlstore/stats.go

Co-authored-by: Sofia Papagiannaki <papagian@users.noreply.github.com>

* Stats: Quote 'user' table with dialect.Quote

* Stats: Ensure test is run as integration test

* Stats: Use boolean value

...because if (v) { true } else { false } is unnecessary at best.

Co-authored-by: Sofia Papagiannaki <papagian@users.noreply.github.com>
2020-08-24 11:23:14 +02:00
Emil Tullstedt b68634fbb4 Tests: Batch of GoConvey to Testify conversions (#27008) 2020-08-14 14:43:25 +02:00
Emil Tullstedt d664853179 Tests: Change util GoConvey tests to use testify (#26724) 2020-08-13 11:10:48 +02:00
Emil Tullstedt ec76d69b49 Chore: Update developer guide to reflect changes to go get (#26646) 2020-07-29 11:23:46 +02:00
Emil Tullstedt e95bcc4ba2 Config: add meta feature toggle (#21786) 2020-01-28 12:00:07 +01:00
Emil TullstedtandTorkel Ödegaard 3fabbbff4d Footer: Display Grafana edition (#21717)
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
2020-01-27 09:24:44 +01:00
Emil Tullstedt 26f72ccc4e Config: Use license info instead of build info for feature toggling (#21558) 2020-01-17 15:44:12 +01:00
Emil Tullstedt 23f3ec020a Build: Ignore content of /pkg/extensions, not directory (#21540) 2020-01-16 14:29:48 +01:00
Emil TullstedtandTorkel Ödegaard 29687903f8 Admin: Add promotional page for Grafana Enterprise (#21422)
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
2020-01-15 14:50:44 +01:00
Emil Tullstedt 30771f25bf Revert "Modules: Add goavro dependency for extensions (#20920)" (#20928)
Goavro doesn't compile on 32-bit systems.

This reverts commit 413be3a6a0.
2019-12-06 14:10:07 +01:00
Emil Tullstedt 413be3a6a0 Modules: Add goavro dependency for extensions (#20920) 2019-12-06 10:33:19 +01:00
Emil Tullstedt d4e013fd44 NavLinks: Make ordering in navigation configurable (#20382)
The ordering of links in the navigation bar is currently based the order of the slice containing the navigation tree. Since Grafana supports adding more links to the navigation bar with `RunIndexDataHooks` which runs at the very end of the function this means that any link registered through a hook will be placed last in the slice and be displayed last in the menu. With this PR the ordering can be specified with a weight which allows for placing links created by extensions in a more intuitive place where applicable.

Stable sorting is used to ensure that the current FIFO ordering is preserved when either no weight is set or two items shares the same weight.
2019-11-15 09:28:55 +01:00