Commit Graph

8395 Commits

Author SHA1 Message Date
George Robinson
ed56755dd7
Alerting: Remove duplicate error message (#51515) 2022-06-29 09:39:24 +01:00
Dan Keder
9595fd6b66
Prometheus: Support 1ms resolution intervals (#44707)
* Prometheus: Support 1ms resolution in time ranges

* UI: Support 1ms resolution in time ranges
2022-06-29 07:39:50 +02:00
Jguer
6d0261263c
ServiceAccounts: Add Service Account Token last used at date (#51446)
* ServiceAccounts Add api key last used at

* ServiceAccounts: LastUpdateAt tests
2022-06-28 16:42:40 +02:00
idafurjes
6c43eb0b4d
Split Create User (#50502)
* Split Create User

* Use new create user and User from package user

* Add service to wire

* Making create user work

* Replace user from user pkg

* One more

* Move Insert to orguser Service/Store

* Remove unnecessary conversion

* Cleaunp

* Fix Get User and add fakes

* Fixing get org id for user logic, adding fakes and other adjustments

* Add some tests for ourguser service and store

* Fix insert org logic

* Add comment about deprecation

* Fix after merge with main

* Move orguser service/store to org service/store

* Remove orguser from wire

* Unimplement new Create user and use User from pkg user

* Fix wire generation

* Fix lint

* Fix lint - use only User and CrateUserCommand from user pkg

* Remove User and CreateUserCommand from models

* Fix lint 2
2022-06-28 14:32:25 +02:00
Emil Tullstedt
7d815a1db5
Alerting: Use google/uuid instead of gofrs/uuid (#51242) 2022-06-28 11:57:24 +02:00
George Robinson
f04dfc589c
Alerting: Add support for images in Pushover alerts (#51372) 2022-06-28 09:40:01 +01:00
George Robinson
5053468c65
Alerting: Add support for images in Telegram (#51433) 2022-06-28 09:39:40 +01:00
Víctor Martínez Bevià
a7f1ca133e
Init legacy guardian when creating folder scenario (#50800) 2022-06-28 11:09:25 +03:00
Timur Olzhabayev
7c886fb6f9
Frontend Logging: Integrate grafana javascript agent (#50801)
Add Grafana Javascript Agent integration to Grafana
2022-06-28 03:25:30 -04:00
Ryan McKinley
b6a9b9804d
Plugin admin: Add a page to show where panel plugins are used in dashboards (#50909) 2022-06-27 20:23:43 -04:00
Jean-Philippe Quéméner
cd0fefec5b
Alerting: change optimistic lock to use proper insert select (#51461)
* Alerting: change optimistic lock to proper insert select

* remove debug logging

* fix postgres

* fix mysql

* remove empty line for go-lint

* add some docs

* use constants
2022-06-28 00:20:21 +02:00
Yuriy Tseretyan
94e709fdcb
Alerting: Simplify eval.Evaluator interface (#51463)
* remove ExpressionService from argument list of Evaluator's methods
2022-06-27 17:40:44 -04:00
Jean-Philippe Quéméner
bf255965a2
Alerting: prevent the use of the same uid across all contact points (#51440)
* Alerting: prevent the use of the same uid across all contact points

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

Co-authored-by: Yuriy Tseretyan <yuriy.tseretyan@grafana.com>

Co-authored-by: Yuriy Tseretyan <yuriy.tseretyan@grafana.com>
2022-06-27 12:57:47 -04:00
Ieva
0c0cf36ab8
Access control: role checks before updates (#51449)
* add role checks

* linting
2022-06-27 12:40:12 -04:00
Kristin Laemmert
945f015770
backend/datasources: move datasources models into the datasources service package (#51267)
* backend/datasources: move datasources models into the datasources service pkg
2022-06-27 12:23:15 -04:00
Yuriy Tseretyan
78c012df65
move eval_conditions to API models package (#51447) 2022-06-27 11:52:41 -04:00
Alexander Emelin
120c92b950
Search: Fix indexing - re-index after initial provisioning (#50959) 2022-06-27 18:11:08 +03:00
Ashley Harrison
ee3f4f1709
Navigation: Display Starred dashboards in the Navbar (#51038)
* remove feature toggle, add empty state and fix bug with initial starring

* Extract empty message into lingui

* remove full stop

* add empty message in the backend

* remove unused import

* translate starred + empty starred states

* betterer changes
2022-06-27 15:41:00 +01:00
Yuriy Tseretyan
4a9872d108
reload permissions after create folder (#51288) 2022-06-27 09:31:49 -04:00
Marcus Efraimsson
04df634ef5
Plugins: Improved handling of symlinks (#51324)
Improves how we handle symlinks in plugin management.
2022-06-27 12:24:02 +02:00
Vardan Torosyan
f1661166b2
Service accounts: Grafana service accounts are enabled by default (#51402)
* Remove feature flag for service accounts

* Fix failing tests and remove remaining usage

* Fix failing tests and remove remaining usage
2022-06-27 10:22:49 +02:00
Sofia Papagiannaki
1399ab50b3
API: Universal swagger generation (#51033) 2022-06-27 10:54:31 +03:00
Jguer
0689c5839a
Auth: Add option for case insensitive login (#49262)
* add case insensitive option

* treat id as case insensitive

* Users: Add integration tests for case insensitive querying

* Prefer config struct to global variable

* change key to case_insensitive_login

* impede conflicting users from logging in

* add tests for impeding user retrieval if conflicting

* nits and picks

Co-authored-by: gamab <gabi.mabs@gmail.com>

* Add check in transaction for conflicting user

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

* add update tests

* skip on mysql

* add custom messages for user admin view

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

* nit: extra else

* linting mistake

Co-authored-by: gamab <gabi.mabs@gmail.com>
Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com>
2022-06-24 16:59:45 +02:00
George Robinson
dc68213114
Alerting: Remove fmt.Println from Threema (#51380) 2022-06-24 14:50:53 +01:00
Andres Martinez Gotor
b10ddfdf8c
AzureMonitor: Parse non-fatal errors for Logs (#51320) 2022-06-24 08:56:58 +02:00
Ezequiel Victorero
9e80e44b45
Public Dashboards: fix updating public dashboard configuration (#51350)
* Public Dashboards: fix updating public dashboard configuration
2022-06-23 18:44:59 -03:00
Alexander Weaver
0d9389e1f4
Alerting: Code-gen parsing of URL parameters and fix related bugs (#50731)
* Extend template and generate

* Generate and fix up alertmanager endpoints

* Prometheus routes

* fix up Testing endpoints

* touch up ruler API

* Update provisioning and fix 500

* Drop dead code

* Remove more dead code

* Resolve merge conflicts
2022-06-23 15:13:39 -05:00
sam boyer
80f6560c9c
coremodels: Change input filename (#51349) 2022-06-23 12:47:47 -07:00
Ryan McKinley
dd5a3b7747
Heatmap: Replace the heatmap panel with new implementation (#50229) 2022-06-23 11:48:28 -07:00
Ezequiel Victorero
4c4d6fd425
PublicDashboards: collect stats for public dashboards (#50553)
* PublicDashboards: collect stats for public dashboards
2022-06-23 12:02:57 -03:00
Andrej Ocenas
d20afa2a39
Prometheus: Use contextual middleware for req headers and simplify client creation (#51061)
* Use contextual middleware and simplify client creation

* Fix tests

* Add test for the header propagation

* Fix tests and lint

* Update pkg/tsdb/prometheus/prometheus.go

Co-authored-by: ismail simsek <ismailsimsek09@gmail.com>

Co-authored-by: ismail simsek <ismailsimsek09@gmail.com>
2022-06-23 14:48:16 +02:00
Marcus Efraimsson
a8eb29f1d7
Plugins: Use a Grafana specific SDK logger implementation for core plugins (#51229)
Upgrade grafana-aws-sdk to v0.10.6
2022-06-23 14:34:25 +02:00
Sofia Papagiannaki
84e2e1ec8e
Log: Fix text logging for unsupported types (#51306)
* Fix text log for unsupported types

* Apply suggestions from code review

Co-authored-by: Emil Tullstedt <emil.tullstedt@grafana.com>
2022-06-23 13:24:26 +02:00
Karl Persson
b9bb0513e3
Remove version property from fixed roles (#51298) 2022-06-23 12:09:03 +02:00
Selene
ecc15a2f71
KVStore: Extend kvstore to retrieve all items (#50848)
* Extend kvstore to retrieve all items

* Fix comment

* Fix tests

* Change test order

* Move test outside to avoid order conditions

* Update Items to GetAll function and return a map

* Add explanation of map result

* Add description comment

Co-authored-by: Tania B <yalyna.ts@gmail.com>
2022-06-23 11:12:07 +02:00
owensmallwood
1802cc8aca
Add correct table definition for migrations for old dashboard_public schema (#51292)
Co-authored-by: Jesse Weaver <jesse.weaver@grafana.com>
2022-06-22 15:35:33 -08:00
Jeff Levin
d076bedb5e
public dashboards: finalize db schema & v1 feature complete (#50467)
This PR completes public dashboards v1 functionality and simplifies public dashboard conventions. It exists as a large PR so that we are not making constant changes to the database schema.

models.PublicDashboardConfig model replaced with models.PublicDashboard directly
dashboard_public_config table renamed to dashboard_public
models.Dashboard.IsPublic removed from the dashboard and replaced with models.PublicDashboard.isEnabled
Routing now uses a uuid v4 as an access token for viewing a public dashboard anonymously, PublicDashboard.Uid only used as database identifier
Frontend utilizes uuid for auth'd operations and access token for anonymous access
Default to time range defined on dashboard when viewing public dashboard
Add audit fields to public dashboard

Co-authored-by: Owen Smallwood <owen.smallwood@grafana.com>, Ezequiel Victorero <ezequiel.victorero@grafana.com>, Jesse Weaver <jesse.weaver@grafana.com>
2022-06-22 13:58:52 -08:00
Yuriy Tseretyan
ba00d12c0f
fix test TestRuleGroupSequence to work in Enterprise environment (#51284) 2022-06-22 15:54:58 -04:00
Yuriy Tseretyan
ee5bcf2b96
make test more stable (#51268) 2022-06-22 12:53:16 -04:00
gotjosh
90646e7f41
Alerting: Don't stop the migration when alert rule tags are invalid (#51253)
* Alerting: Don't stop the migration when alert rule tags are invalid

As we migrate we expect the `alertRuleTags` on a dashboard alert to be a JSON object. However, it seems this is not really validated by Grafana and an user can change the format to something else that the JSON parser is not able to marshal into a `map[string]string`.

Let's do a bit better by "attempting" to parse the tags and if we can't we'll simple return an empty map. The data is still there so if the user wishes they can go back, fix the data and attemp the migration again.
2022-06-22 17:39:17 +01:00
Yuriy Tseretyan
4b42cd3c1d
Alerting: State manager to use clock (#51219)
* manager to use clock, to be able to mock real time
2022-06-22 12:18:42 -04:00
Tania
405df77e3e
Add a feature toggle for custom branding (#51168) 2022-06-22 17:05:52 +02:00
Yuriy Tseretyan
4d02f73e5f
Alerting: Persist rule position in the group (#50051)
Migrations:
* add a new column alert_group_idx to alert_rule table
* add a new column alert_group_idx to alert_rule_version table
* re-index existing rules during migration

API:
* set group index on update. Use the natural order of items in  the array as group index
* sort rules in the group on GET
* update the version of all rules of all affected groups. This will make optimistic lock work in the case of multiple concurrent request touching the same groups.

UI:
* update UI to keep the order of alerts in a group
2022-06-22 10:52:46 -04:00
Jguer
d2ab3556fa
OAuth: Restore debug log behavior (#51244) 2022-06-22 15:27:46 +02:00
Alexander Emelin
cef81a6478
Search: Update bluge version (#50377) 2022-06-22 15:49:26 +03:00
Eric Leijonmarck
421f7a999a
Auth: Case insensitive ids duplicate usagestats (#50724)
* WIP

* update for prometheus

* usagestats: tests pass for user duplicate entries

* metrics: added duplicate user entries

* usagestats: adds metrics gauge for duplicate users

* usagestats: skip test for mysql

* sql in oneplace

* only use prometheus register to not panic

* usagestats: RegisterMetricsFunc with loginstats

* fix: remove unused commited code

* refactor: move test to authinfoservice

* Update pkg/models/stats.go

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

* removed prometheus metrics, due to sql cpu requirement

* Added: has_duplicate_user_entries and fix tests

* remove unused test

* fix: empty else statement removal

* missing argument to authinfoservice

Co-authored-by: Emil Tullstedt <emil.tullstedt@grafana.com>
2022-06-22 14:16:28 +02:00
Alexander Emelin
54e9408cfd
Search: Build indexes on start for all orgs (#50762) 2022-06-22 13:12:07 +03:00
George Robinson
6e44b36a30
Alerting: Add support for images in Kafka alerts (#50758) 2022-06-22 11:03:08 +01:00
Alexander Emelin
1ca2e2b6c2
Search: Sync state on read for HA consistency (#50152) 2022-06-22 12:21:43 +03:00
George Robinson
99516360c9
Alerting: Add support for images in VictorOps alerts (#50759) 2022-06-22 10:00:50 +01:00
Karl Persson
2698e37291
RBAC: Add access control metadata to folder dtos (#51158)
* RBAC: Add access control metadata to Folder dto

* Add access control metadata to folder dto response

* Add test to verify that access control metadata is attached

* Attach access control metadata to multiple folders

* Add access control metadata to frontend folder dto
2022-06-22 10:29:26 +02:00
sam boyer
e6d91235a7
codegen: Correctly gen TS without defaults (#51155) 2022-06-22 03:55:37 +02:00
Yuriy Tseretyan
157c12211d
Alerting: State manager to use tick time to determine stale states (#50991)
* use correct stale timestamp
* calculate stale using tick time instead of time.now

* remove unused dependency on sql store
2022-06-22 00:16:53 +02:00
Yuriy Tseretyan
53d03aec78
Alerting: Add api client to integration tests (#50970) 2022-06-21 11:39:22 -04:00
Ivana Huckova
62e55d530d
Query history: Fix default value when no config (#51129)
* Query history: Fix default value in setting.go

* Update for frontend

* Remove frontend update
2022-06-21 14:57:44 +02:00
Josh Hunt
dcf786f3a9
I18n: Add default locale server config option (#51035)
* I18n: Set default locale in server config and expose in grafanaBootData

* put default locale behind feature flag

* update tests now that default locale is behind feature flag

* little bit of PR feedback

* update sample.ini
2022-06-21 11:12:49 +01:00
George Robinson
c8466d285c
Alerting: Add support for image annotation in Alertmanager alerts (#50686) 2022-06-21 09:06:00 +01:00
Daniel Underwood
6f2c0d467f
Alerting: notifiers/discord: Fix group mention documentation (#51071)
This change updates the UI to document the correct Group Mention format for Discord Contact Points.

The Discord API documentation (https://discord.com/developers/docs/reference#message-formatting) uses `<@&ID>` for Group Mentions, not the bare `@` shown in the alerting UI. Testing on 8.5 shows that bare `@` isn't working there.
2022-06-21 05:34:49 +00:00
Leon Sorokin
f4f31b40fd
HeatmapNG: consolidate frame types & fix color ranging (#51089)
* rename yZeroDisplay -> yMinDisplay
* remove heatmap-cells-sparse frame type
* parse x bucket size to millis
* take into account hideLE & hideGE filters to auto-range color scale
* extract cell value range scanning to heatmapData
2022-06-20 15:38:13 -05:00
George Robinson
67046c5e79
Alerting: Add support for images in Threema alerts (#50734) 2022-06-20 15:45:35 +01:00
Torkel Ödegaard
3c3293df78
TopNav: Adds new feature toggle for upcoming nav~ (#51115) 2022-06-20 16:25:43 +02:00
George Robinson
7235480be5
Alerting: Use ErrImagesDone in Discord and SensuGo (#51106) 2022-06-20 14:39:27 +01:00
George Robinson
18c3456d13
Alerting: Support up to N fake images (#51111) 2022-06-20 14:34:53 +01:00
Gilles De Mey
81a5436c1e
Alerting: Adds Mimir to Alertmanager data source implementation (#50943) 2022-06-20 12:56:38 +02:00
Andreas Christou
ecaa1dcbfd
AzureMonitor: Migrate to backend checkHealth API (#50448)
* Add check health functions for each datasource and generic checkHealth function

* Log backend errors

* Update testDatasource function

- Remove unused testDatasource functions from pseudo datasources

* Switch datasource to extend DataSourceWithBackend

* Improve errors and responses from health endpoint

* Fix backend lint issues

* Remove unneeded frontend tests

* Remove unused/unnecessary datasource methods

* Update types

* Improve message construction

* Stubbing out checkHealth tests

* Update tests

- Remove comments
- Simplify structure

* Update log analytics health check to query data rather than retrieve workspace metadata

* Fix lint issue

* Fix frontend lint issues

* Update pkg/tsdb/azuremonitor/azuremonitor.go

Co-authored-by: Andres Martinez Gotor <andres.martinez@grafana.com>

* Updates based on PR comments

- Don't use deprecated default workspace field
- Handle situation if no workspace is found by notifying user
- Correctly handle health responses

* Remove debug line

* Make use of defined api versions

* Remove field validation functions

* Expose errors in frontend

* Update errors and tests

* Remove instanceSettings

* Update error handling

* Improve error handling and presentation

* Update tests and correctly check error type

* Refactor AzureHealthCheckError and update tests

* Fix lint errors

Co-authored-by: Andres Martinez Gotor <andres.martinez@grafana.com>
2022-06-20 11:33:13 +01:00
George Robinson
62c2b1ec78
Alerting: Add ErrImagesDone to return from withStoredImages (#51098) 2022-06-20 10:56:28 +01:00
George Robinson
2dbaf259a7
Alerting: Update test funcs for notifications (#51013) 2022-06-20 09:05:21 +01:00
asymness
1f5f40b2da
Enforce password length check on reset request (#51005) 2022-06-20 09:16:42 +02:00
SLAMA
81b5ecac34
Opentsdb: Add tag values into the opentsdb response (#48672)
Adds tags to the opentsdb response. This means the tags propagate to alert messages to quickly understand the source of the alert.

Fixes: https://github.com/grafana/grafana/issues/47092

Co-authored-by: SLAMA <36870081+xy-man@users.noreply.github.com>
2022-06-20 10:12:43 +08:00
Yuriy Tseretyan
81089b956a
Alerting: Update authorization rules for RouteGetNamespaceRulesConfig (#50965)
* use authorizeAccessToRuleGroup
* use toGettableRuleGroupConfig in get by namespace
* add comments for controller methods
2022-06-17 13:55:31 -04:00
Matthew Jacobson
5dee2ed24c
Alerting: Add first Grafana reserved label grafana_folder (#50262)
* Alerting: Add first Grafana reserved label g_label

g_label holds the title of the folder container the alert. The intention of this label
is to use it as part of the new default notification policy groupBy.

* Add nil check on updateRule labels map

* Disable gocyclo lint on schedule.ruleRoutine

will remove later in a separate refactoring PR to reduce complexity.

* Address doc suggestions

* Update g_folder for rules in folder when folder title changes

* Remove global bus in FolderService

* Modify tests to fit new common g_folder label

* Add changelog entry

* Fix merge conflicts

* Switch GrafanaReservedLabelPrefix from `g_` to `grafana_`
2022-06-17 13:10:49 -04:00
Artur Wierzbicki
40b152e813
Search: fix anonymous user access (#51045) 2022-06-17 20:36:10 +04:00
Alexander Weaver
9bbfeedadf
Alerting: Create algorithm to process receiver changes and keep them consistent internally (#50738)
* Algorithm to fix up receivers

* Extract for tests

* Add tests, fix bug

* Add test which demonstrates how it fixes up broken groups

* Fix package prefix
2022-06-17 10:19:22 -05:00
Andrej Ocenas
677b2a43b5
Prometheus: Add test for resource call header handling (#51036)
* Add test

* Remove unused test
2022-06-17 16:48:32 +02:00
Artur Wierzbicki
644503f5e6
Previews: use ETag header (#51008)
* use etag header for previews

* use unix millis rather than tz-dependant string
2022-06-17 18:02:03 +04:00
Kristin Laemmert
72f934de01
backend/dashboardsnapshot service: move models (#50898)
* backend/dashboard snapshots: refactor leftover models and mocks
* Move all dashboard snapshot-related models into the dashboardsnapshotservice package
* Remove leftover dashboard-related mocks from the mockstore
2022-06-17 09:09:01 -04:00
Torkel Ödegaard
c6ab87008a
Dashboard: Remove super old prop that has not been used in years (#50826) 2022-06-17 14:55:35 +02:00
Gábor Farkas
fd63ed540f
loki: fix bug in labels framing (#51015) 2022-06-17 12:50:10 +02:00
Gábor Farkas
109bc7e940
loki: add type=instant tests (#51007) 2022-06-17 09:47:49 +02:00
Gábor Farkas
ccc587dc0f
Loki: Handle data source configs with path in the url (#50971)
* loki: fixed param-name

* loki: handle datasource configs with path in the url

* lint fix
2022-06-17 07:47:31 +02:00
Michael Mandrus
c043a8818a
Secrets: add better error handling for secret plugin failures when updating datasources (#50542)
* Add protobuf config and generated code, and client wrapper

* wire up loading of secretsmanager plugin, using renderer plugin as a model

* update kvstore provider to check if we should use the grpc plugin. return false always in OSS

* add OSS remote plugin check

* refactor wire gen file

* log which secrets manager is being used

* Fix argument types for remote checker

* Turns out if err != nil, then the result is always nil. Return empty values if there is an error.

* remove duplicate import

* ensure atomicity by adding secret management as a step to sql operations and rolling back if necessary

* Update pkg/services/secrets/kvstore/kvstore.go

Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>

* Update pkg/services/secrets/kvstore/kvstore.go

Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>

* refactor RemotePluginCheck interface to just return the Plugin client directly

* rename struct to something less silly

* add special error handling for remote secrets management

* switch to errors.as instead of type inference

* remove unnecessary rollback call

* just declare error once

* refactor .proto file according to prior PR suggestions

* re-generate protobuf files and fix compilation errors

* only wrap (ergo display in the front end) errors that are user friendly from the plugin

* rename error type to suggest user friendly only

* rename plugin functions to be more descriptive

* change delete message name

* Revert "change delete message name"

This reverts commit 8ca978301e.

* Revert "rename plugin functions to be more descriptive"

This reverts commit 4355c9b9ff.

* fix pointer to pointer problem

* change plugin user error to just hold a string

* fix sequencing problem with datasource updates

* clean up some return statements

* need to wrap multiple transactions with the InTransaction() func in order to keep the lock

* make linter happy

* revert input var name

Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
2022-06-16 12:26:57 -04:00
Alexander Zobnin
c6ca1b607c
Service accounts: hide API keys only if all keys migrated (#50925) 2022-06-16 16:03:00 +02:00
Alexander Zobnin
859148942e
Service accounts: refactor errors (#50917) 2022-06-16 16:02:03 +02:00
Alexander Zobnin
c4f0be7c8d
Service accounts: Migrate expired API keys (#50883) 2022-06-16 16:01:50 +02:00
Dave Henderson
096330c53b
datasource metrics: Correct help text for histograms (#50942)
In #50420 a few summary metrics were converted to histograms,
but the Help text in a couple of them still referred to summaries.
This fixes that help text.

Signed-off-by: Dave Henderson <dave.henderson@grafana.com>
2022-06-16 14:18:09 +02:00
idafurjes
8ab8ce609b
Bug: Fix delete dashboard snapshot for deleted dashboards (#50919)
* Bug: Fix delete dashboard snapshot for deleted dashboards

* Fix lint and make it work for all the errors

* Fix lint
2022-06-16 13:13:58 +02:00
Jguer
f3e3828279
ServiceAccounts: Fix errors returning API key and simplify conditions (#50885)
* ServiceAccounts: Fix naming API key->Service account token

* simplify redundant elses

* Apply suggestions from code review

Co-authored-by: Eric Leijonmarck <eric.leijonmarck@gmail.com>
Co-authored-by: Alexander Zobnin <alexanderzobnin@gmail.com>

Co-authored-by: Eric Leijonmarck <eric.leijonmarck@gmail.com>
Co-authored-by: Alexander Zobnin <alexanderzobnin@gmail.com>
2022-06-16 12:11:22 +02:00
Ashley Harrison
d0fa326798
Chore: Remove newNavigation feature toggle and old navbar code (#50872)
* Remove newNavigation feature toggle + old code

* fix unit tests

* remove buildCreateNavLinks
2022-06-16 10:48:38 +01:00
Yuriy Tseretyan
c1550d1f07
Alerting: Rule api to fail update if provisioned rules are affected (#50835)
* add function that checks whether changes mention provisioned rules
* update API that updates group of rules to fail if check does not pass
2022-06-15 16:01:14 -04:00
Andrej Ocenas
07be95a001
Prometheus: Fix body not being included in resource calls if they are POST (#50833)
* Pass on request body

* Fix GETs and add tests

* Fix err handling

* Add comments

* Close response body

* Fix lint maybe

* Fix test
2022-06-15 16:46:21 +02:00
sam boyer
4c4aa95d38
coremodels: Automatically generate coremodel registries (#50057)
* coremodel: Generate static registry

* Actually make codegen work

Also, remove the per-coremodel assignability test from generator set.

* Make wire gen depend on cue gen

This is necessary now that we're generating a wire set as part of
coremodel registry generation.

* Add wire inject bits to http server

* s/staticregistry/registry/

* move to static and dynamic wording

* Move registry type into registry package

* Use static registry in http handler

* Oi comments
2022-06-15 15:47:04 +02:00
Emil Tullstedt
f1834163ec
ShortURL: Use new Error type (#50859) 2022-06-15 15:11:36 +02:00
Alexander Zobnin
f82264c2b1
ServiceAccounts: API keys migration (#50002)
* ServiceAccounts: able to get upgrade status

* Banner with API keys migration info

* Show API keys migration info on Service accounts page

* Migrate individual API keys

* Use transaction for key migration

* Migrate all api keys to service accounts

* Hide api keys after migration

* Migrate API keys separately for each org

* Revert API key

* Revert key API method

* Rename migration actions and reducers

* Fix linter errors

* Tests for migrating single API key

* Tests for migrating all api keys

* More tests

* Fix reverting tokens

* API: rename convert to migrate

* Add api route descriptions to methods

* rearrange methods in api.go

* Refactor: rename and move some methods

* Prevent assigning tokens to non-existing service accounts

* Refactor: ID TO Id

* Refactor: fix error message

* Delete service account if migration failed

* Fix linter errors
2022-06-15 14:59:40 +02:00
Marcus Efraimsson
b47ec36d0d
CLI: Allow relative symlinks in zip archives when installing plugins (#50537)
Earlier we only allowed symlinks in plugins starting with grafana- in zip archives when 
installing plugins using the grafana-cli. This changes so that symlinks in zip archives 
containing relative links to files in the zip archive are always allowed when installing 
plugins. The reasoning behind this is that Grafana per default doesn't load a plugin 
that has an invalid plugin signature meaning that any symlink must be included in 
the plugin signature manifest.

Co-authored-by: Will Browne <will.browne@grafana.com>
Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
2022-06-15 14:38:59 +02:00
Ben Kochie
68691d7775
Convert some metrics to Histograms (#50420)
Because Summary metrics can not be aggreated, convert them to histograms
so that users with HA deployments can use these metrics.
* Convert metrics registration to promauto.
* Improve help text style.

Signed-off-by: SuperQ <superq@gmail.com>
2022-06-15 13:19:43 +02:00
Serge Zaitsev
ae9491c3a7
Chore: Make test tracer noop and return no errors (#50797) 2022-06-15 12:40:41 +02:00
George Robinson
87f3bb3156
Alerting: Add support for images in SensuGo alerts (#50718) 2022-06-15 10:15:16 +01:00
Artur Wierzbicki
cc4473faf3
Storage: validation and sanitization stubs (#50523)
* add `IsPathValidationError` util to fs api

* refactor storage.Upload method

* remove unused struct

* extract `RootUpload` constant

* move file validation outside of the service

* Make UploadErrorToStatusCode exported

* validation/sanitization

* refactor pathValidationError check

* refactor, rename sanitize to transform

* add a todo

* refactor

* transform -> sanitize

* lint fix

* #50608: fix jpg/jpeg

Co-authored-by: Tania B <yalyna.ts@gmail.com>
Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
2022-06-15 12:32:29 +04:00
Alexander Weaver
d61d439b11
Handle bsd vs gnu sed (#50641) 2022-06-14 15:35:23 -05:00
Kristin Laemmert
a33a023629
backend: add PlaylistUIDs to Playlist; remove playlist IDs from API (#49609)
* backend/api: refactor PlaylistId to PlaylistUid
* Add org_id to Get and Update playlist functions
Fix migration - no longer pad the uid; fix mysql syntax

The relevant tests are passing using postgres, mysql and the default sqllite backends, but there are a number of other failing tests when using postgres and myself so I'm not entirely confident with those results.

* fix bad query in GetPlaylistItem and add a test that would have caught the mistake in the first place. Reverted the playlist_uid column addition in playlist_item; it became unnecessary after this PR.

Added default value to the new UID column based on PR feedback.

* break this PRs migration into its own function

* Playlists: Update UI to use the updated API

Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>
2022-06-14 15:32:52 -04:00
Kristin Laemmert
08c7a54c47
backend/sqlstore split: move dashboard snapshot funcs to dashboardsnapshotservice (#50727)
* backend/sqlstore split: move dashboard snapshot funcs to dashboardsnapshotservice

This commit moves the dashboard snapshot related sql functions in the dashboardsnapshots service. I split the dashboards package up so the interfaces live in dashboarsnapshots and the store and service implementations are in their own packages. This took some minor refactoring, but none of the actual underlying code has changed, just where it lives.
2022-06-14 13:41:29 -04:00
Michael Mandrus
d886141d69
Plugins: Refactor secrets plugin .proto file (#50722)
* refactor .proto file according to prior PR suggestions

* re-generate protobuf files and fix compilation errors

* rename proto functions to be more descriptive
2022-06-14 11:53:04 -04:00
Serge Zaitsev
0b55c41d05
Chore: Remove global bus variable (#50765)
* Chore: Remove global bus variable

* fix bus in tests
2022-06-14 16:07:41 +02:00
Alexander Emelin
c581f6d945
rm debug log when publishing live message (#50774) 2022-06-14 15:15:57 +03:00
Josh Hunt
3cebd87bbb
I18n: Add locale to user preference (#49425)
* Add __debug_bin file to gitignore

* Add locale user preference

* undo defaulting to existing JSONData in preferences save
2022-06-14 12:53:51 +01:00
Sofia Papagiannaki
7418a80264
API: Make Swagger specification more consistent (#50576)
* Fix swagger generation targer using mac

Validate using the swagger binarry instead of the docker container

* API: Make swagger specification more consistent

Fix operation parameter ordering
2022-06-14 12:35:22 +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
Sergey Kostrukov
2d3cc26aa8
Prometheus: Remove Azure code from datasource service (#50737)
Ref #35857
2022-06-14 10:47:06 +02:00
Karl Persson
44ffbfd6aa
RBAC: Refactor GetUserPermissions to use []accesscontrol.Permission (#50683)
* Return slice of permissions instead of slice of pointers for permissions
2022-06-14 10:17:48 +02:00
Kevin Lewin
5aab95885f
Alertmanager: Adding SigV4 Authentication to Alertmanager Datasource (#49718)
* adding sigv4 alertmanager

* adding sigv4 alertmanager

* ConfigEditor: Adding Render Prop
2022-06-14 10:15:21 +02:00
Ryan McKinley
c5547fde59
Open Heatmap: update plugin snapshot testdata (#50747) 2022-06-14 00:35:20 -07:00
Carl Bergquist
b8b6d0e1a1
Instrumentation: Define handlers for requests that are not handled with named handlers (#50613)
Signed-off-by: bergquist <carl.bergquist@gmail.com>

Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>
2022-06-14 07:58:20 +02:00
owensmallwood
1bb2d2599c
Public Dashboards: Pubdash panels get data from pubdash api (#50556)
* Public dashboard query API

* Create new API on service for building metric request

* Flesh out testing, implement BuildPublicDashboardMetricRequest

* Test for errors and missing panels

* WIP: Test for multiple datasources

* Refactor tests, add supporting code for multiple datasources

* Gets the panel data from the pubdash query api

* Adds tests to make sure we get the correct api url from retrieving panel data

* Public dashboard query API

* Create new API on service for building metric request

* Flesh out testing, implement BuildPublicDashboardMetricRequest

* Test for errors and missing panels

* WIP: Test for multiple datasources

* Refactor tests, add supporting code for multiple datasources

* Handle queries from multiple datasources

* Replace dashboard time range with pubdash time range settings

* Fix comments from review, build failure

* removes changes to DataSourceWithBackend.ts regarding getting the pubdash panel query url. Going to do this in a new class, PublicDashboardDataSource.ts

* Include pubdash Uid in dashboard meta

* Creates new PublicDashboardDataSource.ts and adds test

* Passes pubdash uid down to PanelQueryRunner.ts to a PublicDashboardDatasource can be chosen when were looking at a public dashboard

* removes comment

* checks for error when unmarshalling json

* Only replace dashboard time settings with pubdash time settings when pubdash time settings exist

* formatting and added comment

Co-authored-by: Jesse Weaver <jesse.weaver@grafana.com>
Co-authored-by: Jeff Levin <jeff@levinology.com>
2022-06-13 18:03:43 -06:00
Jesse Weaver
0371884cdd
Start of dashboard query API (#49547)
This PR adds endpoints for public dashboards to retrieve data from the backend (trusted) query engine. It works by executing queries defined on the backend without any user input and does not support template variables.

* Public dashboard query API
* Create new API on service for building metric request
* Flesh out testing, implement BuildPublicDashboardMetricRequest
* Test for errors and missing panels
* Refactor tests, add supporting code for multiple datasources
* Handle queries from multiple datasources
* Explicitly pass no user for querying public dashboard

Co-authored-by: Jeff Levin <jeff@levinology.com>
2022-06-13 15:23:56 -08:00
Alexander Weaver
17e76b06ff
Alerting: Fix rendering issues in OpenAPI docs (#50630)
* Clean up status codes

* Missing consumes tag

* Regenerate

* Fix incorrect documented responses and missing UI elements

* Fix response docs

* Fix wrong response copy paste

* Regenerate

* Temporarily revert
2022-06-13 12:51:07 -05:00
Artur Wierzbicki
9779f684d1
Storage: refactor - decouple the Upload method from HTTP concepts (#50378)
* add `IsPathValidationError` util to fs api

* refactor storage.Upload method

* remove unused struct

* extract `RootUpload` constant

* move file validation outside of the service

* Make UploadErrorToStatusCode exported

* refactor pathValidationError check

* if -> switch

Co-authored-by: Tania B <yalyna.ts@gmail.com>
2022-06-13 21:21:50 +04:00
Yuriy Tseretyan
c314ce48c7
Alerting: Support for optimistic locking for alert rules (#50274)
* add support for optimistic locking for alert_rule table
* return 409 in the case of opitimistic lock
2022-06-13 12:15:28 -04:00
Jean-Philippe Quéméner
1ed7280363
Alerting: add right provenance when creating mute timings (#50707) 2022-06-13 18:05:41 +02:00
Ashley Harrison
759e3ec4fa
Never set gridPos to null (#50400) 2022-06-13 16:43:42 +01:00
Joan López de la Franca Beltran
97baa6911d
Metrics: Expose functions to initialize counters at zero (#50122) 2022-06-13 17:35:10 +02:00
Jean-Philippe Quéméner
ed6a887737
Alerting: remove unused function in alert rule store (#50696) 2022-06-13 11:24:29 -04:00
Karl Persson
95a4c4a4d6
OAuth: Redirect to login if no oauth module is found or if module is not configured (#50661)
* OAuth: Redirect to login if no oauth module is found or if module is not
configured

* OAuth: Update test to check for location header
2022-06-13 16:59:15 +02:00
Josh Hunt
b115e73ede
LibraryPanels: Require only viewer permissions to use a Library Panel (#50241)
* rename function to requireEditPermissionsOnFolder

* Require only viewer permissions on a folder when connecting a library panel from it

* update tests

* require edit permissions on the dashboard

* revert my change to the tests - these tests test something different

* revert changes to a test file???
2022-06-13 14:26:17 +01:00
Will Browne
8da9b4f2b5
add missing return (#50667) 2022-06-13 13:56:24 +02:00
Gábor Farkas
a2eb4e85e5
elasticsearch: always use fixed_interval (#50297) 2022-06-13 10:28:29 +02:00
Ivana Huckova
0ddb3b7521
Query history: Add swagger definitions (#50498)
* Query history: Add swagger definitions

* Update

* Remove changes in generated files

* Generate api files

* Add query history into api docs

* Add examples for commands

* Add missing parameters

* Generate api-spec and api-merged

* Fix linting

* Fix showing of example of queries

* Revert "Fix showing of example of queries"

This reverts commit b1eb073fbe.

* Update

* Update
2022-06-13 09:47:40 +02:00
Gábor Farkas
8fd9cb4854
loki: add feature-toggle check to live-mode (#49012) 2022-06-13 08:33:46 +02:00
Ryan McKinley
ae8dd73770
Graph Panel: Add feature toggle that will allow automatic migration to timeseries panel (#50631) 2022-06-10 17:12:56 -07:00
Ryan McKinley
b6f97e8101
SearchV2: move search parameters to a nested object (#50561) 2022-06-10 11:06:41 -07:00
Kat Yang
bd35e6917a
Chore: Exclude integration tests from running on test-backend step (#50359)
* Chore: Exclude integration tests from running on test-backend step

* Remove -v from go test command

* Add check to skip integration tests before each integration test

* Try to restart pipeline

* Retrying to make pipeline run
2022-06-10 11:46:21 -04:00
Gabriel MABILLE
307a0d4538
RBAC: Inheritance permission migration should handle empty managed roles (#50611)
* Make inheritance permission migration more robust

* Better fix

* Add more tests to the migration

* Add removed test case

* Add test case for empty role in empty org

* Handling the role.ID 0 case with a log

Co-authored-by: Jguer <joao.guerreiro@grafana.com>

Co-authored-by: Jguer <joao.guerreiro@grafana.com>
2022-06-10 16:44:13 +02:00
Yuriy Tseretyan
b0ae4d460e
Alerting: Make ticker to tick at predictable time (#50197) 2022-06-10 10:27:17 -04:00
Jean-Philippe Quéméner
862f51216b
Alerting: improve provisioning docs (#50347)
* Alerting: improve provisioning docs

* add new provisioning page

* add api docs

* fix formatting and add better descriptions

* fix typo
2022-06-10 16:25:15 +02:00
Karl Persson
b4559b41c2
RBAC: fix access control check in both new navivation and new search view (#50596)
* check access control permissions for new navigation

* check access control actions in new search view
2022-06-10 15:26:00 +02:00
Todd Treece
99db588919
Data Sources: Add QueryData OAuth & cookie forwarding middleware (#50466) 2022-06-10 08:41:29 -04:00
idafurjes
5a9b622708
Add xorm tag to dashboard version id (#50599) 2022-06-10 14:33:12 +02:00
Josh Hunt
9a62849dc3
Add i18n feature flag (#50590) 2022-06-10 13:02:52 +02:00
Levente Balogh
9a85a2e441
Data Connections: Create a new top-level page (#50018)
* Feature Flags: introduce a flag for enabling the Data Connections page

* Feature Flags: generate schemas

* Navigation: add navigation weight for the Data Connections page

* NavLink: add a comment pointing out where icon names can be looked up

* NavTree: add a new page called Data Connections

* fix(Api): prefix the navigation IDs with the parent ("data-connections")

* feat(Frontend): add a basic page with four tabs

* feat(Plugins): add a hook for importing an app plugin

* feat(Plugins): add a component for loading app plugins anywhere

* feat(Data Connections): load the cloud-onboarding app under the "Cloud onboarding" tab

* feat(Data Connections): generate a proper nav model to highlight active tabs

* test(Data Connections): add tests

* refactor(Data Connections): update temporary text content

This is only used as a placeholder until the tabs are under development.

* refactor(Data Cnnnections): move /pages to /tabs

* refactor(Data Connections): remove the `types.ts` file as it is not referenced by any module

* feat(Data Connections): only register routes if feature is enabled
2022-06-10 12:13:31 +02:00
Carl Bergquist
2d6e69226b
Instrumentation: Add feature toggle for logging requests instrumented as unknown (#50566)
Signed-off-by: bergquist <carl.bergquist@gmail.com>
2022-06-10 10:56:55 +02:00
George Robinson
bda47df4ad
Alerting: Invalid setting of enabled for unified alerting should return error (#49876) 2022-06-10 08:59:58 +01:00
idafurjes
be7518c97b
Bug: Fix List dashboard version (#50544)
* Fix List dashboard version

* Fix

* Roll back tag for dahboard version id
2022-06-09 21:17:03 +02:00
Adam Simpson
5df694b924
AzureMonitor: changes to azureMonitorExperimentalUI after feedback (#50455)
* AzureMonitor: tweak experimental-ui after UX discussions.
- move metrics up to resource row
- allow resources field to take an inlineField prop and a labelWidth prop. Eventually once the feature toggle is removed
the inlineField prop will be the only code branch in Field.tsx.

* AzureMonitor: remove devmode req for azureMonitorExperimentalUI flag

* refactor: consolidate logic branch for inline Field
2022-06-09 18:24:48 +00:00
Michael Mandrus
f376c33903
WIP: Add private Secret Manager Plugins support to plugin platform (#49544)
* Add protobuf config and generated code, and client wrapper

* wire up loading of secretsmanager plugin, using renderer plugin as a model

* update kvstore provider to check if we should use the grpc plugin. return false always in OSS

* add OSS remote plugin check

* refactor wire gen file

* log which secrets manager is being used

* Fix argument types for remote checker

* Turns out if err != nil, then the result is always nil. Return empty values if there is an error.

* remove duplicate import

* Update pkg/services/secrets/kvstore/kvstore.go

Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>

* Update pkg/services/secrets/kvstore/kvstore.go

Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>

* refactor RemotePluginCheck interface to just return the Plugin client directly

* rename struct to something less silly

* Update pkg/plugins/backendplugin/secretsmanagerplugin/secretsmanager.proto

Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>

Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
2022-06-09 13:19:27 -04:00
Artur Wierzbicki
ef401f5d62
Storage: improve path validation, add tests (#50441)
* improve path validation

* add test case
2022-06-09 21:09:06 +04:00
Joey Tawadrous
4ed7ff2ed1
Traces: APM table (#48654)
* APM table

* Remove unnecessary changes in Explore.tsx

* Enhancements

* Show empty table if filter returns no results for table

* Error checking

* Combine extra filter options

* Convert service map query to apm query for apm requests

* Simplify links

* Better query building

* Extract method and clean up

* Upgrade filter

* Self review

* Export method

* Update test

* Switch area-chart to lcd-gauge

* Remove AreaChartCell

* Colors, units and other UI upgrades

* Remove 2 queries and reuse existing queries

* Nested observables

* rate/error rate/duration links: open new pane with range query and exemplars turned on

* Align error rate values to rate values col according to span_name

* Rearrange code

* Several improvements

* Filter by span_name

* align the table col values to the same row name (rateName) across the table

* On click tempo link filter by span_name

* Filtering updates

* Ensure serviceQuery null is ok

* Update link expr

* Update duration p90 unit

* Tempo links case

* Update tests

* Self review

* Tests

* Empty state

* Remove some code

* Test: should build expr correctly

* Test: should build link expr correctly

* Test: should get rate aligned values correctly

* Test: should make apm request correctly

* Test: should make tempo link correctly

* Move apm table tests to its own describe

* Feature toggle

* Added to docs for APM table

* Add screenshot to APM table section in docs

* Add feature toggle to test

* Split queries and make method names clearer

* Doc changes

* Add back in config import removed by merge

* Update tempo link and tests

* Update filter

* Set field filterable: false

* Updated doc

* Remove @end from queries

* Add back in tempo link
2022-06-09 17:56:15 +01:00
Kevin Yu
6151320020
Cloud Monitoring: add feature toggle for experimental UI (#50460)
* Cloud Monitoring: add feature toggle for experimental UI

* remove RequiresDevMode
2022-06-09 15:56:32 +02:00
Gabriel MABILLE
840a442796
RBAC: Rename alerting roles to match naming convention (#50504) 2022-06-09 14:29:27 +02:00
Karl Persson
7fad8d6171
RBAC: Move datasource access check to middleware (#50430)
* Add datasource scopes to auth middleware

* Remove filter call from handlers, permission check is done by auth
middleware
2022-06-09 13:56:24 +02:00
Karl Persson
80a030605f
change to debug logs to match non access control guardian (#50477) 2022-06-09 13:51:56 +02:00