* Unify how the version is shown in the UI
* use versionString in dashboard help bundles
* fix lint
* remove comment
* fix test types
* make test less flakey
* Add function to get the namespaced id
* Add function to resolve an identity through authn.Service from org and namespace id
* Switch to resolve identity for re-authenticate in another org
* bug: fix migration to account for duplicate entries
* refactoring to create test folder for user migrations
* fix migration log
* added the migration
* additional tests
* added extSrv tests
* Folders: Allow listing folders with write permission
* Check for subfolder access if parent does not have
* Add test
* GetFolders: fix ordering
* Apply suggestion from code review
* ExtSvcAccounts: Fix External Service Accounts Login check
Co-authored-by: Karl Persson <kalle.persson@grafana.com>
* Remove service accounts assignments and permissions on delete
* Fix first set of tests
* Fix second batch of tests
* Fix third batch of tests
---------
Co-authored-by: Karl Persson <kalle.persson@grafana.com>
Removes legacy alerting, so long and thanks for all the fish! 🐟
---------
Co-authored-by: Matthew Jacobson <matthew.jacobson@grafana.com>
Co-authored-by: Sonia Aguilar <soniaAguilarPeiron@users.noreply.github.com>
Co-authored-by: Armand Grillet <armandgrillet@users.noreply.github.com>
Co-authored-by: William Wernert <rwwiv@users.noreply.github.com>
Co-authored-by: Yuri Tseretyan <yuriy.tseretyan@grafana.com>
* Update template names
* Add verifier that we can use to start verify process
* Use userVerifier when verifying email on update
* Add tests
---------
Co-authored-by: Ieva <ieva.vasiljeva@grafana.com>
* Wip
* Wip
* Adapt to load external module
* build: remove cloudmonitoring from built_in_plugins, clean up webpack output
* chore(plugins): remove decoupled plugins from package.json deps
* chore(codeowners): update file for nx.json
* revert(webpack): put back path in config
* build(frontend): use nx to run prod builds of decoupled plugins with yarn build
* style(prometheus): run prettier-write to fix tsconfig.json
* style(backend): remove unused subFile.isDistDir
* revert(locales): remove formatting changes adding new line at end of files
* chore(webpack): clean up dev output
* build(nx): make grafana an nx project, bump lerna and nx
* build(plugin-configs): move cache directory to node_modules
* style(datasource-plugins): add eslint ignore for .gen.ts files
* chore(codeowners): add frontend-ops as owner of project.json
* build(webpack): add getDecoupledPlugins to automatically ignore when watching
* ci(drone): skip nx cache when building frontend packages
* style(ci): fix missing trailing comma
* Revert "style(ci): fix missing trailing comma"
This reverts commit 7520d41576.
* Revert "ci(drone): skip nx cache when building frontend packages"
This reverts commit 46938883ac.
* feat(zipkin): remove from grafana core bundle
* chore(npm): bump nx package to latest 18.0.8
* docs(dev-guide): add a note about what yarn start now builds
---------
Co-authored-by: Andres Martinez <andres.martinez@grafana.com>
* WIP - proof of concept
* Update pkg/tsdb/elasticsearch/client/client.go
Co-authored-by: Sven Grossmann <sven.grossmann@grafana.com>
* update and add test
* lint
* Fix lint
* Bring back logging when creating client
---------
Co-authored-by: Sven Grossmann <sven.grossmann@grafana.com>
* fix mergeSettings() in case the db contains empty strings
* use correct github urls in test
* overwrite only urls
* update comment for mergeSettings()
* add strategy and tests
* use settings provider service and remove multiple providers strategy
* update codeowners file
* reload from settings provider
* Implement keep last state for state transitions
* Respect For duration when keeping state
* Only keep transition from recording an annotation
* Add keep last state option for nodata/error in UI
* poc
* add logger, skip hook when user is not assigned to default org
* Add tests, move to hook folder
* docs
* Skip for OrgId < 1
* Address feedback
* Update docs/sources/setup-grafana/configure-grafana/_index.md
* lint
* Move the hook to org_sync.go
* Update pkg/services/authn/authnimpl/sync/org_sync.go
* Handle the case when GetUserOrgList returns error
---------
Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>
Co-authored-by: Karl Persson <kalle.persson@grafana.com>
* export Evaluation
* Export Evaluation
* Export RuleVersionAndPauseStatus
* export Eval, create interface
* Export update and add to interface
* Export Stop and Run and add to interface
* Registry and scheduler use rule by interface and not concrete type
* Update factory to use interface, update tests to work over public API rather than writing to channels directly
* Rename map in registry
* Rename getOrCreateInfo to not reference a specific implementation
* Genericize alertRuleInfoRegistry into ruleRegistry
* Rename alertRuleInfo to alertRule
* Comments on interface
* Update pkg/services/ngalert/schedule/schedule.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>
* Move files to prometheus-library
* refactor core prometheus to use prometheus-library
* modify client transport options
* mock
* have a type
* import aliases
* rename
* call the right method
* remove unrelated test from the library
* update codeowners
* go work sync
* update go.work.sum
* make swagger-clean && make openapi3-gen
* add promlib to makefile
* remove clilogger
* Export the function
* update unit test
* add prometheus_test.go
* fix mock type
* use mapUtil from grafana-plugin-sdk-go
* separate context and threads for usage stats
* use constants
* ignore original context
* fix runMetricsFunc
* fix collector registration
Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com>
* change background ctx
* fix test randomness
* Add traces to support bundle collector
* Remove unecessay span
* Add trace to usagestats api
* Close spans
* Mv trace to bundle
* Change span name
* use parent context
* fix runtime declare of stats
* Fix pointer dereference problem on usage stat func
Co-authored-by: Karl Persson <kalle.persson@grafana.com>
Co-authored-by: jguer <joao.guerreiro@grafana.com>
* fix broken support bundle tests by tracer
---------
Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com>
Co-authored-by: gamab <gabriel.mabille@grafana.com>
Co-authored-by: Karl Persson <kalle.persson@grafana.com>
* Remove jenny_ts_resources and use jenny_ts_types for all cases
* Unify TS generated files into one jenny
* Add missing imports to versioned files
* Update Parca plugin
* Fix loki
* Use LokiQuery
* Fix pyroscope tests
* Fix prettier
* 😒 fix default pyroscope value name
* Set the LokiQuery
* Update Elasticsearch and TestData
* Missed files from testdata
* Order imports
* hard disable for legacy alerting
* remove alerting section from configuration file
* update documentation to not refer to deleted section
* remove AlertingEnabled from usage in UA setting parsing
* Remove kinds verification for kind-registry
* Read plugin's json information with json library instead of use thema binding
* Remove grafanaplugin unification
* Don't use kindsys for extract the slot name
* Fix IsGroup
* Remove all plugindef generation
* Refactor schema interfaces
* Pushed this change from a different branch by mistake...
* Create small plugin definition structure adding additional information for plugins registration
* Add some validation checks
* Delete unused code
* Fix imports lint
* Swagger: Re-generate the enterprise specification if enterprise is cloned successfully
* API change to trigger the swagger CI step execution
* Swagger: Silence logs
* add drawer for auth settings
* add StrongPasswordField component
* Add style to different behaviours
* update style for component
* add componenet to ChangePasswordForm
* pass the event handlers to the child component
* add style for label container
* expose strong password policy config option to front end
* enforce password validation with config option
* Regenerate openapidocs at 1.21.8 to match ci
* Adjust trigger to work on the actual outputted files
* Also put go.mod and go.sum in the triggers
* manually fix
* Make an arbitrary change rather than touching the trigger to force a run
* Drop all triggers - run all the time
* Print diff - taken from @papagian's PR
* Manual fixes to swagger doc
---------
Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
* Alerting: Use Alertmanager types extracted into grafana/alerting
We're in the process of exporting all Alertmanager types into grafana/alerting so that they can be imported in the Mimir Alertmanager, without a neeed to import Grafana directly.
This change introduces type aliasing for all Alertmanager types based on their 1:1 copy that now live in grafana/alerting.
Signed-off-by: gotjosh <josue.abreu@gmail.com>
---------
Signed-off-by: gotjosh <josue.abreu@gmail.com>
* create rule factory for more complicated dep injection into rules
* Rules get direct access to metrics, logs, traces utilities, use factory in tests
* Use clock internal to rule
* Use sender, statemanager, evalfactory directly
* evalApplied and stopApplied
* use schedulableAlertRules behind interface
* loaded metrics reader
* 3 relevant config options
* Drop unused scheduler parameter
* Rename ruleRoutine to run
* Update READMED
* Handle long parameter lists
* remove dead branch
* remove custom scroll bars from Page component
* make flagged scroller the actual scrolling element,
* enable feature flag by default
* re-enable the scroll props in Page
* rename feature toggle
* fix css
* only update when deleted
* set .scrollbar-view on our scrolling wrapper
---------
Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
* add a middleware that appens headers for IP range AC to data source proxy requests
* update code
* add tests
* fix a mistake
* add logging
* refactor to reuse code
* small cleanup
* skip the plugins middleware if the header is already set
* skip the plugins middleware if the header is already set
* initial naive implementation
* Update pkg/services/store/entity/sqlstash/sql_storage_server.go
Co-authored-by: Igor Suleymanov <radiohead@users.noreply.github.com>
* tidy up
* add action column, batch watch events
* initial implementation of broadcast-based watcher
* fix up watch init
* remove batching, it just adds needless complexity
* use StreamWatcher
* make broadcaster generic
* add circular buffer to replay recent events to new watchers
* loop within poll until all events are read
* add index on entity_history.resource_version to support poller
* increment r.Since when we send events to consumer
* switch broadcaster and cache to use channels instead of mutexes
* cleanup
---------
Co-authored-by: Igor Suleymanov <radiohead@users.noreply.github.com>
Updates Grafana Alertmanager to work with new interface from grafana/alerting#161. This change stops passing user-defined templates to the Grafana Alertmanager by persisting them to disk and instead passes them by string.
* Access control: Extend GetUserPermissions() to query permissions in specific org
* Use db query to fetch permissions in org
* refactor
* refactor
* use conditional join
* minor refactor
* Add test cases
* Search permissions correctly in OSS vs Enterprise
* Get permissions from memory
* Refactor
* remove unused func
* Add tests for GetUserPermissionsInOrg
* fix linter
This commit fixes a bug in the screenshot service where
[alerting].concurrent_render_limit was used instead of
[rendering].concurrent_render_request_limit, as in the
docs.
* Introduce environment.local_filesystem_available
* Only show TLS client cert, client key, client ca when local_filesystem_available is true
* Rename LocalFSAvailable to LocalFileSystemAvailable
* Add FolderUID in missing places for libraryelements
* Add migration for FolderUID in library elements table
* Add Folder UIDs tolibrary panels
* Adjust dashboard import with folder uid
* Fix lint
* Rename back FolderUID to UID
* Remove default
* Check if folderUID is nil
* Add unique indes on org_id,folder_uid,name and kind
* Update pkg/services/libraryelements/database.go
Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>
* Fix folder integration test, with unique index on library elements
* Make folder uids nullable and rewrite migration query
* Use dashboard uid instead of folder_uid
* Adjust test
---------
Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>
* fix LDAP users authenticated via auth proxy not being able to use ldap sync
* simplify id resolution at the cost of no fallthrough
* remove unused services
* remove unused cache key
* query OAuth info from a new instance
* add `hd` validation flag
* add `disable_hd_validation` to settings map
* update documentation
---------
Co-authored-by: Jo <joao.guerreiro@grafana.com>
* ValidateInterval doesn't need the entire config
* Validation no longer depends on entire folder now that we've dropped foldertitle from api
* Don't depend on entire config struct
* Export validate group
* Alerting: feat: support deleting rule groups in the provisioning API
Adds support for DELETE to the provisioning API's alert rule groups route, which allows deleting the rule group with a
single API call. Previously, groups were deleted by deleting rules one-by-one.
Fixes#81860
This change doesn't add any new paths to the API, only new methods.
---------
Co-authored-by: Yuri Tseretyan <yuriy.tseretyan@grafana.com>
* Chore: Replace response status with const var
* Apply suggestions from code review
Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>
* Add net/http import
---------
Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>
* RBAC: Remove team permissions on delete
* Remove unecessary deletes from store function
* Nit on mock
* Add test to the database
* Nit on comment
* Add another test to check that other permissions remain
* introduce new config section [unified_alerting.state_history.annotations] and deprecate settings in [alerting]
Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>
* AuthN: Remove embedded oauth server
* Restore main
* go mod tidy
* Fix problem
* Remove permission intersection
* Fix test and lint
* Fix TestData test
* Revert to origin/main
* Update go.mod
* Update go.mod
* Update go.sum
This commit adds basic support for time_intervals, as mute_time_intervals
is deprecated in Alertmanager and scheduled to be removed before 1.0.
It does not add support for time_intervals in API or file provisioning,
nor does it support exporting time intervals. This will be added in
later commits to keep the changes as simple as possible.
* fix: sign in using auth_proxy with role a -> b -> a would end up with role b
* Update pkg/services/authn/clients/proxy.go
Co-authored-by: Karl Persson <kalle.persson92@gmail.com>
* Update pkg/services/authn/clients/proxy.go
Co-authored-by: Karl Persson <kalle.persson92@gmail.com>
* use split scopes instead of substr in search v1
* tests, of course
* yet, some test helpers dont use split scopes
* another test helper to fix
* add permission.identifier to group by
* check if attribute is uid
* fix tests
* use SplitScope()
* fix more tests
Previously receivers were only validated before saving the alertmanager
configuration. This is a suboptimal experience for those upgrading with preview
as the failed channel upgrade will return an API error instead of being
summarized in the table.