Commit Graph

9583 Commits

Author SHA1 Message Date
Dimitris Sotirakis
02fbb1cd8f
Chore: Remove unused config fields (#60393)
Remove unused config fields
2022-12-19 13:08:43 +02:00
Sofia Papagiannaki
b1ef5ab320
Nested Folders: Support listing nested folder children (#58566)
* Nested Folders: Support listing nested folder children

* Filter out subfolders with no permissions

* Apply suggestion from code review
2022-12-19 10:52:04 +02:00
Karl Persson
0743c4eb87
ServiceAccount: Rewrite the api test to use fakes (#60441)
* RBAC: Add fake for permissions service

* ServiceAccount: Rewrite create api tests

* ServiceAccount: Rewrite api delete tests

* ServiceAccount: Rewrite api test for RetriveServiceAccount

* ServiceAccount: Refactor UpdateServiceAccount api test

* ServiceAccount: Refactor CreateToken api test

* ServiceAccount: refactor delete token api tests

* ServiceAccount: rewrite list tokens api test

* Remove test helper that is not used any more

* ServiceAccount: remove unused test helpers
2022-12-19 09:27:52 +01:00
Karl Persson
2e53a58bc3
Authn: Add client for api keys (#60339)
* AuthN: Add functionallity to test if auth client should be used

* AuthN: Add bolierplate client for api keys and register it

* AuthN: Add tests for api key client

* Inject service

* AuthN: Update client names

* ContextHandler: Set authn service

* AuthN: Implement authentication for api key client

* ContextHandler: Use authn service for api keys if flag is enabled

* AuthN: refactor authentication method to return additional value to
indicate if client could perform authentication

* update prefixes

* Add namespaced id to identity

* AuthN: Expand the Identity struct to include required fields from signed
in user

* Add error for disabled service account

* Add function to write error response based on errutil.Error

* Add error to log

* Return errors based on errutil.Error

* pass error

* update log message

* Fix namespaced ids

* Add tests

* Lint
2022-12-19 09:22:11 +01:00
sam boyer
cc4d18f626
kindsys: Include composable kinds and planned maturity in report (#60477)
kindsys: Include composable kinds + planned maturity
2022-12-19 09:14:51 +01:00
Yuri Tseretyan
92d12fdefa
Alerting: Remove fake secret service in tests (#60488) 2022-12-16 15:01:41 -05:00
Yuri Tseretyan
9ad45aedcf
Alerting: replace usage of simplejson to json.RawMessage in NotificationChannelConfig (#60423)
* introduce alias for json.RawMessage with name RawMessage. This is needed to keep raw JSON and implement a marshaler for YAML, which does not seem to be used but there are tests that fail.
* replace usage of simplejson with RawMessage in NotificationChannelConfig
* remove usage of simplejson in tests
* change migration code to convert simplejson to raw message
2022-12-16 13:01:06 -05:00
Ivana Huckova
09bb4423d2
Elasticsearch: Fix pipeline aggregation queries in backend to pass frontend tests (#60337)
* Elasticsearch: Fix pipeline aggregation queries in backend

* Update

* Update lint

* Update pkg/tsdb/elasticsearch/time_series_query.go

* Fix lint

* Fix merge
2022-12-16 17:45:43 +01:00
Kristin Laemmert
cc007e9727
chore: sqlstore cleanup (#60415)
* chore: remove unused test helper from sqlstore

TimeNow() is no longer used in any tests in this package.

* chore: move sqlstore.SQLBuilder to the infra/db package

This required some minor refactoring; we need to be a little more explicit about passing around the dialect and engine. On the other hand, that's a few fewer uses of the `dialect` global constant!

* chore: move UserDeletions into the only package using it

* cleanup around moving sqlbuilder

* remove dialect and sqlog global vars

* rename userDeletions to serviceAccountDeletions
2022-12-16 11:09:06 -05:00
Ivana Huckova
d332dab3ec
Elasticsearch: Refactor parse query (#60440)
* Refactor parse query to functions

* Move parsing to new file

* Create empty result variable and use it when returning early

* Fix linting

* Revert "Create empty result variable and use it when returning early"

This reverts commit 36a503f66e.
2022-12-16 16:30:36 +01:00
Kristin Laemmert
e4a877b123
chore: attempt to fix flapping "organization not found" tests (#60418)
we live in hope!
2022-12-16 10:10:59 -05:00
Alexander Weaver
91bd1cdb41
Revert "Alerting: Store alertmanager configuration history in a separate table in the database" (#60470)
Revert "Alerting: Store alertmanager configuration history in a separate table in the database (#60197)"

This reverts commit ec80f38c34.
2022-12-16 10:07:44 -05:00
Alex Moreno
174c61b949
Alerting: Set Dashboard and Panel IDs on rule group replacement (#60374)
* Set Dashboard and Panel IDs on rule group replacement

* fix comments and abbreviate test variable name

* Update pkg/services/ngalert/provisioning/alert_rules.go

Co-authored-by: Jean-Philippe Quéméner <JohnnyQQQQ@users.noreply.github.com>

Co-authored-by: Jean-Philippe Quéméner <JohnnyQQQQ@users.noreply.github.com>
2022-12-16 11:47:25 +01:00
Fionera
055c3b7332
Prometheus: Add POST support to client (#60243)
* Prometheus: Add POST support to client

* Prometheus: Revert client test change from 1c503908
2022-12-16 11:15:19 +01:00
Alexander Weaver
ec80f38c34
Alerting: Store alertmanager configuration history in a separate table in the database (#60197)
* Update config store to split between active and history tables

* Migrations to fix up indexes

* Implement migration from old format to new

* Move add migrations call

* Delete duplicated rows

* Explicitly map fields

* Quote the column name because it's a reserved word

* Lift migrations to top
2022-12-15 17:35:00 -06:00
Giuseppe Guerra
92c01e416e
Prometheus: Fix X-Id-Token and X-ID-Token sent to Prometheus in query requests (#60342)
* Prometheus: Use Set rather than map assignment in sdkHeaderToHttpHeader
Fixes #59940

* Prometheus: Add TestPrometheusCanonicalHeaders
2022-12-15 17:18:38 +01:00
Yuri Tseretyan
6637333748
Alerting: refactor notifiers to use package specific Logger interface (#60361)
* introduce Logger interface local to channles + implementaton that wraps the Grafana logger
* make NewFactoryConfig accept LoggerFactory
* add logger field to FactoryConfig
* update usages of log.Logger to internal interface
2022-12-15 11:10:31 -05:00
Sofia Papagiannaki
11d8bcbea9
Guardian: Introduce additional constructors (#59577)
* Guardian: Use dashboard UID instead of ID

* Apply suggestions from code review

Introduce several guardian constructors and each time use
the most appropriate one.
2022-12-15 16:34:17 +02:00
Marcus Efraimsson
6478d0a5ef
Plugins: Forward user header (X-Grafana-User) in backend plugin requests (#58646)
Grafana would forward the X-Grafana-User header to backend plugin request when 
dataproxy.send_user_header is enabled. In addition, X-Grafana-User will be automatically
forwarded in outgoing HTTP requests for core/builtin HTTP datasources. 
Use grafana-plugin-sdk-go v0.147.0.

Fixes #47734

Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
2022-12-15 15:28:25 +01:00
Ezequiel Victorero
8d5b19bc61
PublicDashboards: support time range selection on the backend (#60203) 2022-12-15 10:44:33 -03:00
Gábor Farkas
3cfeac9c5a
elastic: enabled more tests (#60331) 2022-12-15 07:40:41 -05:00
Emil Tullstedt
b7fc837c35
Chore: Upgrade golangci-lint to v1.50.1 (#60379) 2022-12-15 12:58:48 +01:00
Neil Fordyce
b0874d8059
DataProxy: Populate X-Grafana-Referer header (#60040)
* ProxyUtil: Populate X-Grafana-Referer header

* ProxyUtil: Move Referer/Origin header removal

So that the removal and setting X-Grafana-Referer logic applies to all
proxied requests and not just datasource proxy.

* ProxyUtil: Test to guard against multiline headers

* ProxyUtil: Explicitly check injected header isn't parsed
2022-12-15 10:08:10 +01:00
Dimitris Sotirakis
f73cdc5e80
Metadata: Move and rename genversions.go and genversions_test.go (#60315)
* Move and rename genversions.go and tests

* Fix lint - bring back cli.Exit

* Move package.json and fix tests

* Add necessary env vars for promote event
2022-12-15 03:51:11 -05:00
Yuri Tseretyan
0e7c95a4d2
Alerting: Remove reference to global models package in channels package (#60358)
* remove intermediate struct to create Base struct
* fix alertmanager
2022-12-14 16:21:55 -05:00
Sven Grossmann
386faf5958
OpenSearch: Use aoss servicename if OpenSearch is configured as serverless (#60344)
* Use `aoss` if opensearch is configured as `serverless`
2022-12-14 20:22:26 +01:00
Kristina
5a7f38053b
Remove explore compact URLs (#59686)
* Remove explore compact URLs

* Remove two explore link builders that create compact URLs

* Fix merge conflict
2022-12-14 12:57:53 -06:00
Yuri Tseretyan
de008005ce
Alerting: isolate ImageStore in notify package (#60353) 2022-12-14 13:20:20 -05:00
ying-jeanne
b059296cb0
[nested folder]Add circular reference detection in create nested folder (#60163)
* add circulic reference detection in create neste folder

* redeclare mock

* add log for getHeight when depassing limit
2022-12-14 11:07:55 -05:00
Yuri Tseretyan
7c3ab4a715
Alerting: Remove dependency on Grafana notifications package in alerting notifiers (#60271)
* create sender service interface and bridge to grafana notifier service
* update notifiers to use local sender interface
2022-12-14 10:59:37 -05:00
Yuri Tseretyan
07b5043222
Alerting: Add support for settings parse_mode and disable_notifications to Telegram reciever (#60198) 2022-12-14 10:44:39 -05:00
Andreas Christou
c81df0dec0
AzureMonitor: Add custom header support to Azure Monitor (#60269)
* Add integration test for Azure Monitor

- Add Azure Monitor to datasource types
- Update instance creation to correctly set HTTP client options
- Combine custom azure headers and custom grafana headers on HTTP client creation
- Update HTTP client tests

* Test custom azure headers
2022-12-14 15:09:11 +00:00
Yuri Tseretyan
ad09feed83
Alerting: rule backtesting API (#57318)
* Implement backtesting engine that can process regular rule specification (with queries to datasource) as well as special kind of rules that have data frame instead of query.
* declare a new API endpoint and model
* add feature toggle `alertingBacktesting`
2022-12-14 09:44:14 -05:00
Ivana Huckova
70e34e7f32
Elasticsearch: Fix defaulting to time field if no field is specified in aggregation (#60238)
* Elasticsearch: Add test for using timeField from datasource when not specified in query

* Add default to timefield

* Merge fix
2022-12-14 14:19:03 +01:00
Ivana Huckova
d3ef86bd90
Elasticsearch: Add query building for log queries (#60182)
* Elasticsearch: Fix ordering in raw_document and add logic for raw_data

* Add comments

* Fix raw data request to use correct timefield

* Fix linting

* Add raw data as metric type

* Fix linting

* Elasticsearch: Add defaults for log query

* Add higlight

* Fix lint

* Add snapshot test

* Implement correct query for logs

* Update

* Adjust naming and comments

* Fix lint

* Remove ifs
2022-12-14 13:56:09 +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
Kyle Brandt
55d2d872ec
Chore: Missed deprecations due to overly broad lint exclusion (#59732) 2022-12-14 12:32:45 +01:00
Ieva
6aa5a79cad
Access control: endpoint for searching single user permissions (#59669)
* initial commit

* clean up

* fix a bug and add tests

* more tests

* undo some unintended changes

* undo some unintended changes

* linting

* PR feedback - add user ID to search options

* simplify the query

* Apply suggestions from code review

Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com>

* remove unneeded formatting changes

Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com>
2022-12-14 10:53:25 +00:00
ms-hujia
5010765115
Azure Monitor: Propagate the error when failed to get datasource instance (#60210)
Propagate the error when failed to get instance
2022-12-14 10:36:41 +01:00
Misi
6d8bf5ac01
LDAP: Disable user in case it has been removed from LDAP directory (#60231)
* Fix login flow

* Align test

* Fix comments

* Improve test
2022-12-14 03:41:51 -05:00
Ryan McKinley
4064fa51c6
Export: move export page to a full page (not view on storage) (#60263)
Co-authored-by: nmarrs <nathanielmarrs@gmail.com>
2022-12-13 19:40:20 -08:00
Alexander Weaver
821614fb43
Alerting: Align notifier truncation and logging with prometheus/alertmanager (#59339)
* Move truncation code to util to mirror upstream

* Resolve merge conflicts

* Align logging of alert key

* Update tests and fix field passing bug

* Remove superfluous newline in test now that we trim whitespace

* Uptake minor log changes from upstream
2022-12-13 19:50:24 -06:00
Isabella Siu
d6bb2a7493
Cloudwatch: Fix deeplink with default region (#60260)
Cloudwatch: fix deeplink with default region
2022-12-13 15:24:28 -05:00
Ryan McKinley
cf055ab4ec
k8s: Add a dev only feature flag and simple service to get a client (#60204) 2022-12-13 07:41:16 -08:00
Domas
c2cea076ee
Chore: Add deprecation warnings for Sentry (#60165) 2022-12-13 16:41:42 +02:00
Dan Cech
fe3ae49cce
Backend: Consistently use context RemoteAddr function to determine remote address. (#60201)
consistently use context RemoteAddr function to determine remote address
2022-12-13 09:33:05 -05:00
Gabriel MABILLE
109df85cae
RBAC: Add benchmarks to search all users given a specific permission (#59980)
* RBAC: Add benchmarks to search all users given a specific permission

* Add missing time

* Inline benchmarks

* Make bench setup memory efficient

* fix user id

* comment

* Ran 10K_10k and got a better time this time

* change comment to pass linting

* change comment to pass linting

* Update pkg/services/accesscontrol/acimpl/service_bench_test.go

Co-authored-by: Ieva <ieva.vasiljeva@grafana.com>
2022-12-13 09:07:15 -05:00
Dimitris Sotirakis
be0e4ab179
Enterprise checks: Update pull request check regexp for enterprise (#60234)
Update pull request check regexp for enterprise
2022-12-13 08:01:20 -06:00
Eric Leijonmarck
371d7850a5
Auth: Service account store refactor (#58961)
* refactor: renaming of files from database to store

* refactor: make service account store private

- moves store interface to manager package
- adds an interface to the ProvideAPI constructor
- refactors tests to use the store when necessary
- adds mocks for the new interface implementations in the tests package

* wip

* refactor: make fakestore in service

* wip

* wip

* wip

* working tests

* trailing whitespaces

* Update pkg/services/serviceaccounts/api/api.go

* Update pkg/services/serviceaccounts/tests/common.go

* Update pkg/services/serviceaccounts/tests/common.go

* refactor: doc string for retriever

* fix import unused

* remove: serviceaccount from featuretoggle

* added: back legacy serviceaccounts feature toggle

* added: docs

* refactor: make query for the SearchQuery

* add: validation of service input fields

* add validation
2022-12-13 14:56:10 +01:00
Dominik Prokop
239888f229
Snapshots: Build snapshot originalUrl on the backend (#60232)
* Snapshots: Fix originalUrl spoof security issue

* Store relative URL only & validate UID

* use existing modal management tools

* Dummy commit to nudge CI

* Remove unused hooks file

* Fix import after backport

* Backport fixes

Co-authored-by: kay delaney <kay@grafana.com>
2022-12-13 05:48:54 -08:00