* Pass role to Grafana using auth proxy
By default, the role will be applied to the default org of the user.
If the request uses the standard header "X-Grafana-Org-Id", the role will be applied to the specified org
Tested in both unit test and manually E2E
* Address comment: only allow the user role to be applied to the default org
Co-authored-by: Leonard Gram <leo@xlson.com>
* pick changes from PR 33811, use UID in dashboard navlinks
* use proper spelling for UID
* add uid to the plugin schema
* Update docs/sources/developers/plugins/plugin.schema.json
Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>
Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>
* Use backend SDK for influxdb
* Remove BasicAuth condition, some comments
* Remove not used fields from datasource info
* Register InfluxDBService
* Fix casting and make HTTPClientProvider exported
* Remove unused function
* Remove empty line
* Update pkg/tsdb/influxdb/flux/query_models.go
Co-authored-by: Gábor Farkas <gabor.farkas@gmail.com>
* Read interval from TimeRange instead of Interval
* Change pkg name from datasource->models, minor changes
* Use testify instead of convey
* Add new calculator logic and fix pointer semantic for dsInfo
* Initialise parsers, use tsdb interval pkg
Co-authored-by: Gábor Farkas <gabor.farkas@gmail.com>
* Make validate-schema CLI command work vs. disk
Previously, `grafana-cli cue validate-schema` would only validate the
CUE files that had been included at compile time. Now, the command
requires passing a grafana checkout root path, and will actually check
against live files on disk.
* Exempt validateScuemata from sec linter
* Nit: validateScuemata is a simpler, better name
* Try to fix validate-scuemata build step
* Alerting: deactivate an Alertmanager configuration
Implement DELETE /api/alertmanager/grafana/config/api/v1/alerts
by storing the default configuration which stops existing cnfiguration
from being in use.
* Apply suggestions from code review
* Add test for devenv resources
* Refactor validation tests for grokkability
* Devenv dashboards error-tracking script
* Refactor to use cueerrors.Details()
* Further test refinement
* Close major elements of dashboard schema
* Centralize dashboard validation tests
General dashboard validation testing belongs in the load package.
* Better names for error context on glue CUE code
* Fixup validate-resource
Do only one of base or dist, and fix copied docs.
* Skip the devenv test
* Remove test for validateResources
* Fix shellcheck
* Backend linter
Co-authored-by: sam boyer <sdboyer@grafana.com>
* Migrate Elasticsearch to backend plugin SDK
* Fix linting
* Move away from Convey!
* Rebase commit
* Small logger fix
* Fixes according to reviewer's comments
* Fixes according to reviewer's comments
* Fixes according to reviewer's comments
* More cleanup
* Move things around - small refactoring
* Fix typo
* Update calculator - add tests
* Fixes according to reviewer's comments
* Revert "Revert "Elasticsearch: add frozen indices search support (#27472)" (#27726)"
This reverts commit 4c7131425b.
* Make label width a bit more consistent
* Add documentation for X-Pack & Frozen Indices support in Elasticsearch
* Change UI & docs casing
* create default empty dataframe
* Remove backticks and simplify regex
* small doc improvement
If DispatchCtx is called and there's a handler registered using
AddHandler we now allow that and not return a handler not
found error. In addition we log a warning message helping
the developers know that AddHandlerCtx should be used
instead.
If Dispatch is called and there's a handler registered
using AddHandlerCtx we log a warning message helping
the developers know that DispatchCtx should be used instead.
Make sure that default timeout settings are based on configuration
parameters. This now applies for core data sources using old TSDB
contracts and new SDK contracts. Before it was only applied for old TSDB
contracts.
Also moves global setting variables to non-global (setting.Cfg).
* Expand the value of math and reduce expressions in annotations and labels
This commit makes it possible to use the values of reduce and math
expressions in annotations and labels via their RefIDs. It uses the
Stringer interface to ensure that "{{ $values.A }}" still prints the
value in decimal format while also making the labels for each RefID
available with "{{ $values.A.Labels }}" and the float64 value with
"{{ $values.A.Value }}"
Name of time field changed in v8 for time series queries from Time to the name of the selected
time column, i.e. time or time_sec. These changes should make sure that the name of time field
is always returned as Time for time series queries.
Fixes#36059
Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
* initial steps for config from data
* Moving to core and separate transforms
* Progress
* Rows to fields are starting to work
* Config from query transform working
* UI progress
* More scenarios working
* Update public/app/core/components/TransformersUI/rowsToFields/rowsToFields.ts
Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
* transform all
* Refactor
* UI starting to work
* Add matcher UI to transform
* Apply to self
* Adding a reducer option
* Value mapping via new all values reducer
* value mappings workg add -A
* Minor changes
* Improving UI and adding test dashboards
* RowsToFieldsTransformerEditor tests
* Added tests for FieldToConfigMapping Editor
* Added test for ConfigFromQueryTransformerEditor
* Minor UI tweaks
* Added missing test
* Added label extraction
* unified mapping
* Progress refactoring
* Updates
* UI tweaks
* Rename
* Updates
Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
* Replace analytics service with Echo backend
* Add Rudderstack integration and general pageview and interaction Echo events
* Update conf/defaults.ini
Co-authored-by: Dan Cech <dcech@grafana.com>
* Update packages/grafana-runtime/src/types/analytics.ts
Co-authored-by: Dan Cech <dcech@grafana.com>
* Update conf/defaults.ini
Co-authored-by: Dan Cech <dcech@grafana.com>
* Update tests
* Force cla check
Co-authored-by: Dan Cech <dcech@grafana.com>
* moved the plugins admin to core and used the plugins toggle to decide which version to use.
* reverted change.
* changed so the library tab is the default one.
* fixing navigation.
#
* fixed so we have the proper header.
* including the core plugins
* fixed so we display logos for local plugins.
* fixed so we have a working version of plugin catalog.
* removed console logs.
* reverted changes.
* fixing failed test.
* add macaron code to the code base
* remove unused secure cookies support from macaron
* clean up modules
* remove com dependency
* fix silly typos
* little cleanup, remove recovery middleware
* remove logger middleware
* remove static handler and remove unused context methods
* bring inject into macaron codebase
* remove unused applicator
* add back macaron license
* more cleanups in macaron code
* remove unused injector Set method
* remove unused context methods: param to int conversion, body helper type, cookie helpers
* remove action from context
* remove complex environment handling, we only use Env variable
* restore ReplaceAllParams to fix the tests
* Use Dataframes and extract tags from response
* Fix timestamp conversion
* Add tests for data frame conversion
* Add missing RefID and simplify returning an error
* draft dataframe/sdk convertion for graphite
* intermedia
* modify init because registration failed
* Allocate memory for each data point value
* Remove redundant memory aliasing
* Remove redundant new line
* Sort imports
* Simplify returning nil values
* fix lint
* remove unused jsondata
* add checks on query length
* remove basic auth from request
Co-authored-by: Piotr Jamróz <pm.jamroz@gmail.com>
* Add alertmanager notifications tab
* Link to silences page from am alert
* Include summary for alertmanager group
* Fix colors for am state
* Add horizontal dividing line
* PR feedback
* Add basic unit test for alert notificaitons
* Rename Notificaitons component file
* Polling interval to groups
* Add alertmanager notifications tab
* Link to silences page from am alert
* Include summary for alertmanager group
* PR feedback
* Add basic unit test for alert notificaitons
* Rename Notificaitons component file
* Alerting: make alertmanager notifications view responsive (#36067)
* refac DynamicTableWithGuidelines
* more responsiveness fixes
* Add more to tests
* Add loading and alert state for notifications
Co-authored-by: Domas <domas.lapinskas@grafana.com>
* Alerting: Refactor state manager as a dependency
Within the scheduler, the state manager was being passed around a
certain number of functions. I've introduced it as a dependency to keep
the "service" interfaces as clean and homogeneous as possible.
This is relevant, because I'm going to introduce live reload of these
components as part of my next PR and it is better if dependencies are
self-contained.
* remove unused functions
* Fix a few more tests
* Make sure the `stateManager` is declared before the schedule
* Introduce dataproxy_max_idle_connections config var
* Fix according to reviewer's comments
* Fix according to reviewer's comments - round 2
* Remove unused const
* Bring back MaxIdleConnsPerHost
* Fixes according to reviewer's comments
* add fixed role for datasource read operations
* Add action for datasource explore
* add authorize middleware to explore index route
* add fgac support for explore navlink
* update hasAccessToExplore to check if accesscontrol is enable and evalute action if it is
* add getExploreRoles to evalute roles based onaccesscontrol, viewersCanEdit and default
* create function to evaluate permissions or using fallback if accesscontrol is disabled
* change hasAccess to prop and derive the value in mapStateToProps
* add test case to ensure buttons is not rendered when user does not have access
* Only hide return with changes button
* remove internal links if user does not have access to explorer
Co-authored-by: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com>
Added group mapping to support team sync in the Generic OAuth provider.
Co-authored-by: Leonard Gram <leo@xlson.com>
Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>
Co-authored-by: Dan Cech <dan@aussiedan.com>
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
* Add IsFolder field into models.GetDashboardQuery
* Reverted folderId - return dummy success when calling get folder with id 0
* Moved condition to upper level - add test
* Refactor OpenTSDB using backend SDK
* Adjust tests to the SDK refactor
* Remove openTSDB from service
* Rename OpenTASDB service to Service, use AuthPassword from DecryptedSecureJson
* Devenv: Add opentsdb v2.3 data source and dashboard
* Letting http client provider to set basic auth,
renaming,
casting datasource direclty to pointer
* Update pkg/tsdb/opentsdb/opentsdb.go
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
* Update pkg/tsdb/opentsdb/opentsdb.go
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
* Format struct
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
* Elasticsearch: add first version of rate aggregation
* Add test for rate aggreation settings editor
* Fix unit
* Add default value for mode for rate agg
* Add todo
* Revert "Add default value for mode for rate agg"
This reverts commit a44c985d8b.
* Fix width when select is empty
* Add rate aggregation to elasticsearch models
* Remove rate aggregation from extended stats
* Move elastic2 docker block & add elastic (latest)
* Add versionRange to rate aggregation
* add 7.10 elasticsearch version option
* Set supportsInlineScript to true for rate aggregation
* Remove fixed width from select
* Change seconds label for rate aggregation unit options dropdown
Co-authored-by: Piotr Jamróz <pm.jamroz@gmail.com>
Co-authored-by: Elfo404 <me@giordanoricci.com>
Co-authored-by: Piotr Jamróz <pm.jamroz@gmail.com>
* Alerting: Allow __value__ label in notifications
was being removed by removePrivateItems
discoverd in #36020, but issue is not about that specifically
* __value__ label to __value_string__ annotation
and .ValueString extended property for notifications
* Rebase (broken tests)
* Removed tables - refactored processAggregationDocs func
* Tests cleanup
* Nit - add space in percentile legend titles
* Fix labels naming - use metricAggType map
* Fix bug which appended same fields over and over again
* Replace test with dataframes
* Fix tests
* Add nolint:gocyclo - will need refactoring
* Move frames tags assignment
* Add failing test fo when ES server is booting up
* Revert "Add failing test fo when ES server is booting up"
This reverts commit fd14a1fd5e.
Co-authored-by: Elfo404 <me@giordanoricci.com>
* rename strategy
* Update pkg/tsdb/sqleng/sql_engine.go
Co-authored-by: Torkel Ödegaard <torkel@grafana.org>
* more strict constraints
* Fixed so that it works on multi series results
* only apply the logic when original query returns 3 fields
* removed part of comment
* Update mysql test
Co-authored-by: Torkel Ödegaard <torkel@grafana.org>
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
* Fix deleting labels and annotations
* Add test
* Keep no data and error start if not provided
* Allow setting interval and for to zero during rule updates
* Alerting: Implement /status for the notification system
Implements the necessary plumbing to have a /status endpoint on the
notification system.
* Add API examples
* Update API specs
* Update prometheus/common dependency
Co-authored-by: Sofia Papagiannaki <sofia@grafana.com>
* add accesscontrol action for stats read
* use accesscontrol middleware for stats route
* add fixed role with permissions to read sever stats
* add accesscontrol action for settings read
* use accesscontrol middleware for settings route
* add fixed role with permissions to read settings
* add accesscontrol tests for AdminGetSettings and AdminGetStats
* add ability to scope settings
* add tests for AdminGetSettings
* Add new accesscontrol action for ldap config reload
* Update ldapAdminEditRole with new ldap config reload permission
* wrap /ldap/reload with accesscontrol authorize middleware
* document new action and update fixed:ldap:admin:edit with said action
* add fake accesscontrol implementation for tests
* Add accesscontrol tests for ldap handlers
Co-authored-by: Ursula Kallio <73951760+osg-grafana@users.noreply.github.com>
Fixes panic/fatal error concurrent map writes in SQL data sources when multiple
queries are executed concurrently and you interpolate SQL query before executing it.
Fixes#35469
* only recurse a symbolic link if it is a directory
* added test for detecting valid plugins using lib dirs with symbolic links in them (like oracle)
* fix linting errors
* added extra checks as per code-review
* draft pr convert opentsdb response to dataframes
* Add test for parse response and fix go lint
* Add test case for create request
* Use go-cmp in test
* Remove comment
Co-authored-by: Ida Furjesova <ida.furjesova@grafana.com>
#31871 introduced support for configuring timeout in seconds
for HTTP data sources. That had a bug where backend expected
a numeric timeout value where it was actually stored as a
string. This should resolve this by requiring input to be
numbers, storing input as numeric and falling back to string
value if there's no numeric value.
Ref #31871
* fix sql annotation parsing for empty responses
* fix backend when no data returned
* add back frontend changes
Co-authored-by: Ying WANG <ying.wang@grafana.com>
* Fix dashboard alert and nootifier migration for MySQL
* Fix POSTing Alertmanager configuration if no current configuration exists
in case the default configuration has not be stored yet
or has failed to get stored
* Change CreatedAt field type
* Alerting: Expand `{{$labels.xyz}}` template in labels and annotations
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
* Fix annotation not updating for same alert
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
* Alerting: Do not hard fail on templating errors in channels
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
* Fix review
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
* add verbose version flag to list dependencies as well as the version
* Fix typo in the println message
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
Move QueryData method into backend plugin manager which HandleRequest uses to
query data from plugin SDK supported data sources. This allowed us to remove a lot
of code no longer needed.
Ref #21510
Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
When using mulit-dimensional Grafana managed alerts (e.g. SSE math) extract refIds values and labels so they can be shown in the notification and dashboards.
* Security: Update default content_security_policy_template
- Add 'strict-dynamic' back to script-src
- Add ws(s)://$ROOT_PATH to connect-src
- Change onEvent to on-event in angular templates to fix CSP issues in firefox.
- Add blob: to style-src
Threema Gateway supports two types of IDs: Basic IDs (where the
encryption is managed by the API server) and End-to-End IDs (where the
keys are managed by the user).
This plugin currently does not support End-to-End IDs (since it's much
more complex to implement, because the encryption needs to happen
locally). Add a few clarifications to the UI.
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
this should help Live to be enabled by default but still
do not affect setups with lots of simultenious users. To
properly handle many WS connections Grafana administrators
should tune infrastructure a bit - for example increase a
number of open files for a process. Will be in more details
in documentation.
* click out to gcom when config enabled
* set to false
* fix styling for uninstall
* remove advertising config + simplify callout URL
* add entry to configuration.md
* update config name
* update lingo
* Usage Stats: Rename service to use a more idiomatic name
* Usage Stats: Update MetricsFunc definition and implementations
* Revert "Usage Stats: Rename service to use a more idiomatic name"
This reverts commit 910ecce3e8.
* Usage Stats: Update MetricsFunc definition and implementations