Commit Graph

6668 Commits

Author SHA1 Message Date
Serge Zaitsev
d15cbe4b4e
Macaron cleanup (#37795)
* simplify some dependency injection in macaron
* remove unused internal server error handler from macaron
* remove internal server error handler from the router
* remove unused combo router api
* remove unused parts of the macaron router
2021-08-30 11:48:34 +02:00
knuzhdin
3df001db93
ImageRendering: fix leakage of the rendering inflight counter (#34607) 2021-08-28 09:05:03 +02:00
Ikko Ashimine
202f295e51
Chore: Fix typo in nodes.go (#38636)
commmon -> common
2021-08-27 14:57:41 +02:00
Alexander Emelin
a95a40d87d
Live: allow connections with request host matching origin host (#38538) 2021-08-27 13:26:28 +03:00
Andres Martinez Gotor
b25eb0aa74
AzureMonitor: Fix wrong merge (#38623) 2021-08-27 11:31:17 +02:00
idafurjes
568549e810
Bug: Return empty plugins.DataTimeSeriesSlice when the frame field vector is epmty (#38587)
* Add check if the vector is empty

* Use Rows() instead of Len() on field

* Remove redundant condition
2021-08-26 16:39:50 +02:00
Stephanie Hingtgen
785072086c
Add event after datasource create (#38467)
* Add event after datasource create
2021-08-26 08:50:05 -05:00
Kevin Minehart
1ced2bc6df
move main.go logic out of commands (#38555)
* move main.go logic out of commands
2021-08-26 15:42:22 +02:00
Marcus Efraimsson
2f07af1b54
Chore: Skip test TestDevenvDashboardValidity for now (#38577)
Skipping TestDevenvDashboardValidity test for now to resolve broken 
test-backend step in main/branches. Did also run scripts/stripnulls.sh 
hence the devenv dashboard changes.
2021-08-26 11:45:57 +02:00
Marcus Efraimsson
ec88295a0b
Testdata: Fix proper initialization (#38576)
Fixes #38566
2021-08-26 11:39:04 +02:00
Dimitris Sotirakis
12320dda3c
Elasticsearch: Fix metric names for alert queries (#38546)
* Export fieldName to var

* Add empty string as frame name
2021-08-26 09:20:38 +02:00
idafurjes
7faea40674
API: Add short url validation (#38436)
* Add short url validation
Path should not contain string ../

* Update pkg/api/short_url.go

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

Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
2021-08-26 09:07:27 +02:00
Arve Knudsen
78596a6756
Migrate to Wire for dependency injection (#32289)
Fixes #30144

Co-authored-by: dsotirakis <sotirakis.dim@gmail.com>
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
Co-authored-by: Ida Furjesova <ida.furjesova@grafana.com>
Co-authored-by: Jack Westbrook <jack.westbrook@gmail.com>
Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
Co-authored-by: Leon Sorokin <leeoniya@gmail.com>
Co-authored-by: Andrej Ocenas <mr.ocenas@gmail.com>
Co-authored-by: spinillos <selenepinillos@gmail.com>
Co-authored-by: Karl Persson <kalle.persson@grafana.com>
Co-authored-by: Leonard Gram <leo@xlson.com>
2021-08-25 15:11:22 +02:00
sam boyer
e61bc33163
Move dashboard scuemata to grafana-schema (#38470)
* Relocate dashboard scuemata to grafana-schema

* Update assorted tests, vars with dashboard path

* Remove crufty commented var

* Not sure...why that failed

* Remove prefix from base dashboard path var

* Move cue/ui remnants into grafana-schema

* Update import paths in plugin models

* Remove mudball, add package statements

* Remove cuegen.sh

Wooooo we ain't got no codegen

* Revert "Remove mudball, add package statements"

This reverts commit 9bed3098f1.

* Tidy up all the cue files

* Move dashboard scuemata into scuemata/ subdir

Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
2021-08-25 06:55:04 -04:00
Witek Bedyk
65501cbad3
Licensing: Provide correct URL for AGPL license (#36917)
* Provide correct link for AGPL license

* Change LicenseURL to point go Grafana OSS page

* Keep utm_source query parameter

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

Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
2021-08-25 10:43:43 +02:00
Will Browne
1618d5ad6f
use most appropriate func for registering core plugins (#38497) 2021-08-25 10:08:48 +02:00
Domas
2e8a7c1161
set basic auth for prometheus backend ds requests (#38496) 2021-08-25 10:05:17 +03:00
Gabriel MABILLE
f9273d0d37
AccessControl: Add a mock (#38515) 2021-08-24 20:12:48 +02:00
gotjosh
14a0519338
Alerting: Remove Multiorg alertmangaer from the top-level services (#38506)
Removes the registration of the multi-org alertmanager, it is started as a subservice of ngalerting.
2021-08-24 19:11:28 +02:00
gotjosh
2f27a5240b
Alerting: Fix flake on test receiver tests (#38511)
* Alerting: Fix flake on test receiver tests

* Make the actual result from the API be sorted

* Use the correct letters
2021-08-24 17:22:11 +01:00
Alex Khomenko
6e639f3c72
Admin: Update stats page UI (#38014)
* Add StatCard

* Style cards

* Update types

* Add tests

* Move stats tab into licencing

* Prevent UI jumps when loading stats

* Fix merge conflicts

* Revert docs format
2021-08-24 19:13:48 +03:00
David Parrott
7fbeefc090
Alerting: create wrapper for Alertmanager to enable org level isolation (#37320)
Introduces org-level isolation for the Alertmanager and its components.

Silences, Alerts and Contact points are not separated by org and are not shared between them.

Co-authored with @davidmparrott and @papagian
2021-08-24 11:28:09 +01:00
Karl Persson
7ebf4027a7
Access Control: refactor permission evaluator to be more flexible (#35996)
* add a more flexible way to create permissions

* update interface for accesscontrol to use new eval interface

* use new eval interface

* update middleware to use new eval interface

* remove evaluator function and move metrics to service

* add tests for accesscontrol middleware

* Remove failed function from interface and update inejct to create a new
evaluator

* Change name

* Support Several sopes for a permission


* use evaluator and update fakeAccessControl

* Implement String that will return string representation of permissions
for an evaluator

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

Co-authored-by: Emil Tullstedt <emil.tullstedt@grafana.com>
2021-08-24 11:36:28 +02:00
idafurjes
ccab9611cb
API: Add theme validation (#38432)
* Add theme validation

* Fix lint for const
2021-08-24 08:41:15 +02:00
Ivana Huckova
74fef637af
Prometheus: Use default POST method if no httpMethod provided (#38446)
* Prometheus: If no httpMethod, use default POST method

* Use http.MethodPost
2021-08-23 15:25:40 +02:00
idafurjes
769b7a5865
Bug: Register OpenTSDB with correct service name (#37581)
* Bug: Register OpenTSDB with correct service name

* USe Register instead of RegisterAndStart
2021-08-23 14:56:53 +02:00
Jeremy Price
9a71cec1f0
Access Control: Make the evaluator prefix match only (#38025)
* Make the evaluator prefix match only

* Handle empty scopes

* Bump version of settings read role

Co-authored-by: Karl Persson <kalle.persson@grafana.com>
2021-08-23 14:03:20 +02:00
idafurjes
b9a538aff0
Bug: Add check before delete org (#38056)
* Add check before delete org

* Fix comment

* Simpify check if signed in user belongs to the org

* Add check on login if user has and existing org
change error code to 400, when org can not be deleted

* Roll back last commit, regarding an different issue
2021-08-23 08:58:35 +02:00
Travis Patterson
32e11434da
Fire event after datasource delete (#38090) 2021-08-20 14:51:31 -06:00
Jason Stangroome
28784935b8
Sort notification channels alphabetically (#37426)
Even without the ability to control the sort order or to filter, this notably improves usability for long lists of notification channels.

Partially fixes #20067.
2021-08-19 22:49:14 +02:00
Nathan Rodman
df791ae2af
Alerting: Add custom grouping for alert groups (#37378)
* Group alertmangaer alerts by custom grouping

* Filter am groups

* Style filter components

* Style filter bar and add clear functionality

* rename components to alert group

* use query params for group filters

* filter style improvements

* add tests for group by

* Add grouping banner to better highlight groupings

* clean up hook logic
2021-08-19 09:22:52 -07:00
Piotr Jamróz
f7501ff77f
Graphite: Convert tag values returned as numbers to strings (#37882)
* Convert tag values returned as numbers to string

This is a bug in Graphite <= 1.1.7. Since 1.1.8 all values are converted to strings.

* Simplify type conversions

* Fix linting errors
2021-08-19 08:40:13 -07:00
billabongrob
2fe62af685
Admin: Obfuscate azure_blob Account Key
Obfuscate azure_blob Account Key #37970
2021-08-19 11:41:26 +02:00
Chip Wolf ‮
fe09879ff5
Alerting: correct property names for Slack bot icons (#33376) 2021-08-18 21:06:05 +03:00
Andrej Ocenas
60a0c5da05
CloudWatch/Logs: Don't group dataframes for non time series queries (#37998)
* Don't split response when there is no time field

* Refactor grouping to separate function

* Add test
2021-08-18 15:05:06 +02:00
Victor Cinaglia
0819d15942
profiling: Support binding pprof server to custom network interfaces (#36580)
Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>
2021-08-18 13:28:39 +02:00
Sergey Kostrukov
c6356c5bba
Fix scopes mutation by cloning original array (#37981) 2021-08-18 10:05:14 +02:00
Dimitris Sotirakis
050dc7bc8f
Cloudwatch: Unwrap errors - throw error from upstream (#36334)
* Unwrap errors - throw error from upstream

* Fixes according to reviewer's comments

* Fix linting

* Remove unused code
2021-08-18 10:37:13 +03:00
Domas
cb9912ec0a
Alerting: button to test contact point (#37475) 2021-08-18 10:16:35 +03:00
cyhone
6aa2a0dc8a
refactor: simplify serverlock code (#37451) 2021-08-17 15:34:03 +02:00
George Robinson
3ca00f90b5
Contact point testing (#37308)
This commit adds contact point testing to ngalerts via a new API
endpoint. This endpoint accepts JSON containing a list of
receiver configurations which are validated and then tested
with a notification for a test alert. The endpoint returns JSON
for each receiver with a status and error message. It accepts
a configurable timeout via the Request-Timeout header (in seconds)
up to a maximum of 30 seconds.
2021-08-17 13:49:05 +01:00
sam boyer
6aba592741
Schema: get all devenv dashboards passing validation (#37857)
* Strip nulls (again)

* Add stripnulls script

* Add transformations field

* Close FieldConfig struct; proper plugin validating

* s/graph/viz/ field in histogram dashboard

* Use ui.GraphFieldConfig in histogram model

* Add models for stat, gauge, barguage panel plugins

Also toss necessary shared types into cue/ui/gen.cue, with TODOs to move
them appropriately later.

* Add required license headers

* Heap of updates to cue UI components

* Fix barchart types and one old devenv input

* Use the GraphFieldConfig directly for timeseries

* Add models.cue for a few panel plugins

Barchart, state-timeline, and status-history

* Enable the test validating all devenv dashboards!!

* Fix effects of not checking after making comments

* Update packages/grafana-ui/src/options/models.gen.ts

Co-authored-by: Ryan McKinley <ryantxu@gmail.com>

* Realign and unalign cue with ts types

* Update devenv test to sniff for null errors

Best option we have right now for helping people to know they need to
strip nulls from devenv dashboards.

* Add speculative default for barchart stacking

* Fixup some dated devenv dashboards

timeline-modes needed to be regenerated with the appropriate tooltip
values included, per typing requirements, and timeline-demo needed to
have the `mode` field removed, as it is not intended to be persisted.

* Add necessary missing options for various panels

* Regenerate devenv dashboards

Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
2021-08-17 07:11:57 -04:00
Will Browne
697ac937c6
fix with global config state (#37293) 2021-08-17 12:16:34 +02:00
Evan Sosenko
5d74c47cf8
Add missing AWS/Cognito metrics (#37768)
* Add missing AWS/Cognito metrics

https://docs.aws.amazon.com/cognito/latest/developerguide/metrics-for-cognito-user-pools.html

* Add missing Cognito dimensions

* Remove Cognito usage metrics
2021-08-16 20:44:32 +02:00
Olof Bourghardt
d26f3cdd03
Loki: add support for resolution (#36710)
* Add input to specify min step

* Add stepInterval to as input to component

* Add onBlur to Input component

* Loki: add functionality for min step

* Loki: change name on props to step to make it more clear

* Loki: add resolution as a query option

* Loki: Add min,max,exact as step options

* Loki: add functionality for different step modes

* Loki: fix bug where step function isn't working

* Loki: fix bug where exact step isn't working

* Loki: change width of step input field

* Loki: add tests for adjustInterval function

* Loki: add check for max step oprio to make sure it's not below the safe interval

* Loki: fix bug with some tests

* Loki: fix bug with tests

* Explore: add tooltip to loki step function

* Loki: remove resolution as a logs option

* Loki: update snapshots

* Fix failing tests

* Loki: add select component for choosing resolution

* Loki: add functionality for calculating correct interval with resolution applied

* Loki: remove functionality for step mode

* Loki: remove tests for step mode

* Loki: add tooltip to line limit and resolution

* Loki: add backend support for resolution

* Loki: fixed backend bug where resolution was undefined

* Loki: add check for resolution
2021-08-16 14:02:13 +02:00
Dimitris Sotirakis
1aeafa34d1
Elasticsearch: Fix metric names for alert queries (#37871)
* Use props names as metrics names

* Make aliases work
2021-08-16 14:45:20 +03:00
Sherwin Daganato
118c811c61
CloudWatch: Add AWS/EC2 MetadataNoToken metric (#37427) 2021-08-16 10:04:21 +02:00
Gábor Farkas
668f397a8e
Prometheus/Alerting: handle datasource.timeRange is nil case (#37888) 2021-08-16 09:20:58 +02:00
Stephanie Hingtgen
db2e0d46b7
Update http error code when datasource health check fails (#37895)
Since the datasource settings are configured by the user, the health check error could be a client error. A 506 error may be sufficient as well.
2021-08-16 09:49:34 +03:00
sam boyer
6d08be157f
Don't reuse plugin action for cue subcommands (#37858) 2021-08-13 17:01:12 -04:00
Travis Patterson
00709ec1db
Add prometheus remote client (#37755) 2021-08-13 10:44:56 -06:00
shuotli
6ecf401cd1
AzureMonitor: Add data links to deep link to Azure Portal Azure Resource Graph (#35591)
* Add deep link in ARG

* add soverigh clouds

* add query to Azure portal link

* move deep link to backend

* cloud specific to ARG

* Add unit test

* fix lint

* fix escape issue

* use constant & fix test

* fix constant & use pathEscape

* use cmp.Equal for test
2021-08-13 16:21:24 +01:00
Sergey Kostrukov
dd0a906fb7
Fix alternative Azure cloud names (#37133) 2021-08-13 14:58:05 +01:00
Sofia Papagiannaki
7a01fb369d
Alerting: Fix API spec generation (#37852)
* Alerting: Fix API spec generation

* Apply suggestion from code review

Co-authored-by: gotjosh <josue@grafana.com>
2021-08-13 16:15:53 +03:00
gotjosh
f3f3fcc727
Alerting: Introduces /api/v1/ngalert/alertmanagers to expose discovered and dropped Alertmanager(s) (#37632)
* Alerting: Expose discovered and dropped Alertmanagers

Exposes the API for discovered and dropped Alertmanagers.

* make admin config poll interval configurable

* update after rebase

* wordsmith

* More wordsmithing

* change name of the config

* settings package too
2021-08-13 13:14:36 +01:00
Dimitris Sotirakis
db91a55d49
Remove duplicated title from slack notification (#37834) 2021-08-13 15:13:02 +03:00
Kyle Brandt
aef67994a1
Annotations: Fix alerting annotation coloring (#37412)
Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
2021-08-12 09:37:54 -07:00
Sofia Papagiannaki
04d5dcb7c8
Alerting: modify DB table, accessors and migration to restrict org access (#37414)
* Alerting: modify table and accessors to limit org access appropriately

* Update migration to create multiple Alertmanager configs

* Apply suggestions from code review

Co-authored-by: gotjosh <josue@grafana.com>

* replace mg.ClearMigrationEntry()

mg.ClearMigrationEntry() would create a new session.
This commit introduces a new migration for clearing an entry from migration log for replacing  mg.ClearMigrationEntry() so that all dashboard alert migration operations will run inside the same transaction.
It adds also `SkipMigrationLog()` in Migrator interface for skipping adding an entry in the migration_log.

Co-authored-by: gotjosh <josue@grafana.com>
2021-08-12 16:04:09 +03:00
Andrej Ocenas
b5f7df3e62
CloudWatch/Logs: Fix crash when time column has nil values (#37708) 2021-08-12 10:36:06 +02:00
Gábor Farkas
4afa74232f
prometheus: alerting: respect datasource.scrapeInterval (#37799) 2021-08-11 20:34:51 +02:00
Serge Zaitsev
e2227c38a3
Remove debug log from gzipper (#37790) 2021-08-11 14:04:08 +02:00
SLAMA
5986d99f51
Alerting frontend : fix line notifier (#37744)
- Fixes #37425
- change `line` type string to uppercase
2021-08-10 18:59:53 +01:00
Serge Zaitsev
707d3536f0
Macaron: Strip down renderer middleware (#37627)
* strip down macaron renderer

* inline renderHTML

* remove IndentJSON parameter

* replace renderer with a html/template set

* fix failing test

* fix renderer paths in tests

* make template reloading even simpler

* unify ignored gzip path lookup

* fix csp middleware usage
2021-08-10 13:29:46 +02:00
Domas
3e124c854e
Alerting: interpolate variables when creating alert rule from dashboard panel (#37201) 2021-08-10 10:59:48 +03:00
Serge Zaitsev
0dfac9c3aa
Macaron: convert CSP middleware (#37672) 2021-08-10 09:03:22 +02:00
Serge Zaitsev
377b323faf
truncate float64 values to a lower precision to look the same on all platforms (#37677) 2021-08-10 09:03:01 +02:00
Will Browne
e0315dabe8
Plugins: Use file extension allowlist when serving plugin assets instead of checking for UNIX executable (#37688)
* explicitly check for plugin binary

* remove check completely

* resolve conflicts

* allow module + logos

* add tests

* simplify

* rework to allowlist

* add case

* remove old stuff

* simplify

* add case insensitive test
2021-08-09 16:07:54 +02:00
Dimitris Sotirakis
27c71a1f09
Prometheus: Migrate to use SDK contracts (#37358)
* Use SDK contracts (test needs fixing)

* Fix tests

* Add customQueryParametersMiddleware

* Fix merge conflicts
2021-08-09 11:11:19 +02:00
gotjosh
f83cd401e5
Alerting: Send alerts to external Alertmanager(s) (#37298)
* Alerting: Send alerts to external Alertmanager(s)

Within this PR we're adding support for registering or unregistering
sending to a set of external alertmanagers. A few of the things that are
going are:

- Introduce a new table to hold "admin" (either org or global)
  configuration we can change at runtime.
- A new periodic check that polls for this configuration and adjusts the
  "senders" accordingly.
- Introduces a new concept of "senders" that are responsible for
  shipping the alerts to the external Alertmanager(s). In a nutshell,
this is the Prometheus notifier (the one in charge of sending the alert)
mapped to a multi-tenant map.

There are a few code movements here and there but those are minor, I
tried to keep things intact as much as possible so that we could have an
easier diff.
2021-08-06 13:06:56 +01:00
Ivana Huckova
ba76877d28
Datasource: Pass access type to data source instance settings (#37577)
* Pass Access info to datasourceInstance

* Update packages/grafana-data/src/types/datasource.ts

Co-authored-by: Giordano Ricci <me@giordanoricci.com>

* Type access as direct | proxy

* Fix tests where mocking datasourceInstance, include access

* Pass access to data source instance mocks

* Update comment

* Pass access to data source instance mocks

Co-authored-by: Giordano Ricci <me@giordanoricci.com>
2021-08-06 09:24:35 +02:00
Zoltán Bedi
e0010860bd
Tempo: add ability to upload trace json (#37407)
* Tempo: upload json

* Add test for upload

* Minor changes

* Add docs

* Update docs/sources/datasources/tempo.md

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>

* Add graphframes as well to upload

* Add comments to code

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>
2021-08-05 15:13:44 +02:00
idafurjes
7ff16c47e1
Chore: Refactor tempo using SDK contracts (#37440)
* Refactor tempo using SDK contracts

* Remove commented code

* Removing simplejson use

* Unmarshal JSON
2021-08-05 11:14:17 +02:00
idafurjes
0563bc68fc
Chore: Refactor loki to use SDK contracts (#37400)
* Refactor loki to use SDK contracts

* Register with service name

* Initialize interval calculator

* Return always created result

* Use go library instead of simplejson

* Update pkg/tsdb/loki/loki.go

Co-authored-by: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com>

* Remove newline

* Merge with main

Co-authored-by: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com>
2021-08-05 10:25:31 +02:00
Ivana Huckova
1083bef030
Prometheus: Implement stepMode for alerting queries (#36796)
* Add select component for choosing step option

* Add onStepChange

* Add functionality for max step

* Rename minInterval to stepInterval to describe min, max and exact step interval

* Change select option from standard to exact

* Add new type StepType for better type safety

* Add tests for adjustInterval

* Add functionality and tests for exact step option

* Prometheus: Spell out min and max in select component

* Prometheus: Change width of step select component and add placeholder

* Prometheus: Adjust for the factor in exact step

* Prometheus: Update tooltip of step lable to include max and exact options and add padding to select component to give it some breathing room from other components

* Update snapshot for step tooltip

* Prometheus: make tooltip more informative

* Prometheus: add tooltip to interval input element

* Prometheus: extract default step option

* Prometheus: update snapshot for PromQueryEditor

* Prometheus: change step labels to uppercase

* Prometheus: define a default step option

* Prometheus: use default step option in both ui component and logic

* Prometheus: update snapshot for PromQueryEditor

* Prometheus: refactor datasource.ts for better readability

* Prometheus: change tool tip for step

* Prometheus: update snapshots

* Prometheus: add correct styling

* Prometheus: update snapshots

* Prometheus change variable name to something less superfluous

* Prometheus: refactor

* Prometheus: add new test for adjustInterval

* Docs: Update docummentation on the step parameter for prometheus

* Prometheus: make step input field smaller and change placeholder text to 15s

* Prometheus: update snapshots

* Prometheus: Make stepMode uniform in all places in the code

* Adjust step based on stepMode

* Adjust comment

* Check if we have queryInterval

* Refactor, add safe interval

* Fix merge resolutions

* Fix tests and add tests

* Update snapshot

* Update docs/sources/datasources/prometheus.md

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>

* Update docs/sources/datasources/prometheus.md

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>

* Update docs/sources/datasources/prometheus.md

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>

* Update docs/sources/datasources/prometheus.md

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>

* Update docs/sources/datasources/prometheus.md

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>

* Update docs/sources/datasources/prometheus.md

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>

* Update docs/sources/datasources/prometheus.md

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>

* Implement calculation with intervalMode in calculator.go

* Update tests, add calculate safe interval method

* Replace panic with error

* Update pkg/tsdb/interval/interval_test.go

Co-authored-by: idafurjes <36131195+idafurjes@users.noreply.github.com>

* Update pkg/tsdb/calculator_test.go

Co-authored-by: idafurjes <36131195+idafurjes@users.noreply.github.com>

* Impotrt require

* Remove lint errors

Co-authored-by: Olof Bourghardt <ob655088@gmail.com>
Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>
Co-authored-by: idafurjes <36131195+idafurjes@users.noreply.github.com>
2021-08-05 09:09:49 +02:00
ying-jeanne
fcd0dac814
Dependency: update collector to v.31.0 (#37546)
* update collector to v.31.0

* Change protobuf unmarshal function after upgrade

Co-authored-by: Zoltán Bedi <zoltan.bedi@gmail.com>
2021-08-04 17:41:07 +02:00
Jeremy Price
e8e1a0b50b
Revert "Revert "AccessControl: Implement a way to register fixed roles (#35641)" (#37397)" (#37535)
This reverts commit 55efeb0c02.
2021-08-04 14:44:37 +02:00
Jack Westbrook
cdcccfcc53
Plugins: Fix catalog permissions for org and server admins (#37504)
* simplify toggle + add link to server admin

* feat(catalog): org admins can configure plugin apps, cannot install/uninstall plugins

* fix(catalog): dont show buttons if user doesn't have install permissions

* feat(catalog): cater for accessing catalog via /plugins and /admin/plugins

* feat(catalog): use location for list links and match.url to define breadcrumb links

* test(catalog): mock isGrafanaAdmin for PluginDetails tests

* test(catalog): preserve default bootdata in PluginDetails mock

* refactor(catalog): move orgAdmin check out of state and make easier to reason with

Co-authored-by: Will Browne <will.browne@grafana.com>
2021-08-04 11:49:05 +02:00
Domas
73d36d5521
put alerting admin page under ngalert flag (#37437) 2021-08-02 10:12:01 +02:00
Alexander Emelin
31903778ae
Live: display stream rate, fix duplicate channels in list response (#37365) 2021-07-30 21:05:39 +03:00
Agnès Toulet
0757ba1c64
Renderer: delete debug.log file when Grafana is stopped (#37367) 2021-07-30 17:29:02 +02:00
Joan López de la Franca Beltran
8433def04f
Encryption: Convert functions into global variables (#37240) 2021-07-30 15:48:27 +02:00
Emil Tullstedt
55efeb0c02
Revert "AccessControl: Implement a way to register fixed roles (#35641)" (#37397)
This reverts commit 88c11f1cc0.
2021-07-30 13:58:49 +02:00
Gabriel MABILLE
88c11f1cc0
AccessControl: Implement a way to register fixed roles (#35641)
* AccessControl: Implement a way to register fixed roles

* Add context to register func

* Use FixedRoleGrantsMap instead of FixedRoleGrants

* Removed FixedRoles map to sync.map


* Wrote test for accesscontrol and provisioning

* Use mutexes+map instead of sync maps

* Create a sync map struct out of a Map and a Mutex

* Create a sync map struct for grants as well

* Validate builtin roles

* Make validation public to access control

* Handle errors consistently with what seeder does

* Keep errors consistant amongst accesscontrol impl

* Handle registration error

* Reverse the registration direction thanks to a RoleRegistrant interface

* Removed sync map in favor for simple maps since registration now happens during init

* Work on the Registrant interface

* Remove the Register Role from the interface to have services returning their registrations instead

* Adding context to RegisterRegistrantsRoles and update descriptions

* little bit of cosmetics

* Making sure provisioning is ran after role registration

* test for role registration

* Change the accesscontrol interface to use a variadic

* check if accesscontrol is enabled

* Add a new test for RegisterFixedRoles and fix assign which was buggy

* Moved RegistrationList def to roles.go

* Change provisioning role's description

* Better comment on RegisterFixedRoles

* Correct comment on ValidateFixedRole

* Simplify helper func to removeRoleHelper

* Add log to saveFixedRole and assignFixedRole

Co-authored-by: Vardan Torosyan <vardants@gmail.com>
Co-authored-by: Jeremy Price <Jeremy.price@grafana.com>
2021-07-30 09:52:09 +02:00
Kyle Brandt
aa904a5a04
NGAlert: Send resolve signal to alertmanager on alerting -> Normal (#37363) 2021-07-29 20:29:17 +02:00
Ganesh Vernekar
10f8a138ae
Alerting: Deduplicate receivers during migration (#36812)
* Alerting: Deduplicate receivers during migration

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>

* Fix review comments

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>

* Better naming of contact points

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>

* Handle some edge cases

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>

* Don't add routes which point to default contact point

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2021-07-29 15:56:19 +02:00
Will Browne
08a73a5291
Plugins: Perform plugin update check prior to uninstall (#36909)
* only uninstall if update is possible

* add .

* update lingo for clarity
2021-07-29 11:52:23 +02:00
Leonard Gram
8ebba0a93d
Auth: refactor to not use the global bus (#37345) 2021-07-29 11:47:32 +02:00
Leonard Gram
d51b2630c7
Auth: creates a hook in the user mapping flow (#37190)
* wip

* Auth Info: refactored out into it's own service

* Auth: adds extension point where users are being mapped

* Update pkg/services/login/authinfoservice/service.go

Co-authored-by: Joan López de la Franca Beltran <joanjan14@gmail.com>

* Update pkg/services/login/authinfoservice/service.go

Co-authored-by: Joan López de la Franca Beltran <joanjan14@gmail.com>

* Auth: simplified code

* moved most authinfo stuff to its own package

* added back code

* linter

* simplified

Co-authored-by: Joan López de la Franca Beltran <joanjan14@gmail.com>
2021-07-29 10:18:42 +02:00
Ilya Stoliar
b62fe58cac
CloudWatch: Add AWS LookoutMetrics (#37329) 2021-07-29 09:31:04 +02:00
idafurjes
180b1973e0
SQL: Fix SQL dataframe resampling (fill mode + time intervals) (#36937)
* Refactor resample logic

* Adjust test to have one more timestamp out of range

* adjust test + ensure filling

* revert flag flip

* Undo logic - should be timeseries only

* change data calculation based on previous interval

* fix the logics

* fix typo

* fix resample start time, to reuse what sql api returned

* calculate the start point with from truncate by interval

Co-authored-by: Will Browne <will.browne@grafana.com>
Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
Co-authored-by: Ying WANG <ying.wang@grafana.com>
2021-07-29 08:38:41 +02:00
Karl Persson
4127db3d3a
Remove Licensing as dependency of UsageStats (#37259)
* Remove Licensing as dependency

Co-authored-by: Emil Tullstedt <emil.tullstedt@grafana.com>
2021-07-27 17:19:03 +02:00
gotjosh
442a6677fc
Alerting: Refactor Run of the scheduler (#37157)
* Alerting: Refactor `Run` of the scheduler

A bit of a refactor to make the diff easier to read for supporting
external Alertmanagers.

We'll introduce another routine that checks the database for
configuration and spawns other routines accordingly.

* Block the wait.

* Fix test
2021-07-27 11:52:59 +01:00
Ganesh Vernekar
e8ac802e4f
Alerting: Remove unused fields in Pagerduty struct (#37198)
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2021-07-27 10:41:48 +05:30
David Parrott
b5f464412d
Alerting: automatically remove stale alerting states (#36767)
* initial attempt at automatic removal of stale states

* test case, need espected states

* finish unit test

* PR feedback

* still multiply by time.second

* pr feedback
2021-07-26 18:12:04 +02:00
Ganesh Vernekar
a65975cca0
Alerting: Remove the fixed wait for notification delivery (#37203)
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2021-07-26 15:15:09 +02:00
Ilya Stoliar
59c691a777
CloudWatch: Add AWS IVS metrics and dimensions (#37178) 2021-07-26 14:53:18 +02:00
Serge Zaitsev
e42a597e87
Remove unused Macaron code and interfaces (#37194) 2021-07-26 11:47:13 +02:00
Serge Zaitsev
827a5b7021
add FromContext API for macaron and reqcontext, add API for standard middleware in macaron (#37057) 2021-07-26 06:11:43 +02:00
Alexander Emelin
32b74e75a3
live: various code cleanups (#37165) 2021-07-23 19:47:08 +03:00
Sergey Kostrukov
c1963024ec
Infra: Azure authentication in HttpClientProvider (#36932)
* Azure middleware in HttpClientProxy

* Azure authentication under feature flag

* Minor fixes

* Add prefixes to not clash with JsonData

* Return error if JsonData cannot be parsed

* Return original string if URL invalid

* Tests for datasource_cache
2021-07-22 21:43:10 +01:00