Commit Graph

1560 Commits

Author SHA1 Message Date
Gábor Farkas
7b9929fffe
loki: framing_test: more infinity/nan test cases (#48855) 2022-05-09 11:47:50 +00:00
Andres Martinez Gotor
b1bde7667f
CloudMonitoring: Allow to set a custom value or disable graph_period (#48646) 2022-05-09 13:43:10 +02:00
Joe Blubaugh
53a4f3913c
Alerting: Apply Custom Headers to datasource queries. (#47860)
Unlike dashboard queries, alerting queries were not correctly applying
custom headers to datasource queries. This change mimics the dashboard
query code to apply custom headers.

Fixes #44460

Signed-off-by: Joe Blubaugh <joe.blubaugh@grafana.com>
2022-05-09 08:13:47 +00:00
Shirley
5c2dee19d5
CloudWatch: Refactor tests, remove unused parameters (#48815) 2022-05-08 09:27:03 +02:00
Szymon Szypulski
b6c5f29373
Cloudwatch: Add support for new AWS/RDS EBS* metrics (#48798)
Add support for the missing AWS/RDS metrics, EBSIOBalance% and
EBSByteBalance%. Change is based on the official AWS blog post[1]. Those
metrics work on for Nitro instances.

1. https://aws.amazon.com/blogs/compute/improving-application-performance-and-reducing-costs-with-amazon-ebs-optimized-instance-burst-capability/
2022-05-06 10:38:15 +02:00
Ivana Huckova
250b72cc1b
Elasticsearch: Remove support for versions after their end of the life (<7.10.0) (#48715)
* Elasticsearch: Remove support for versions after their EOL

* Update docs

* Remove old versions from config

* Update pkg/tsdb/elasticsearch/elasticsearch.go

Co-authored-by: Gábor Farkas <gabor.farkas@gmail.com>

* Fix tests

* Fix typecheck errors

Co-authored-by: Gábor Farkas <gabor.farkas@gmail.com>
2022-05-05 16:16:34 +02:00
Shirley
b35ca8c08d
CloudWatch: Pass label in GetMetricData API request when dynamic label feature toggle is enabled (#48574) 2022-05-05 13:59:23 +02:00
Gábor Farkas
da74dba7c8
Loki: backend: use streaming JSON parser, try2 (#48752)
* converter: remove __name__ customization because Loki does not do that

Loki does not handle __name__ in a special way.
for Prometheus, the caller can implement the formatting
by themselves

* converter: change labels-formatting

the labels.String() method does not handle strange values well

* loki: backend: use streaming-json parser

* more idiomatic code

Co-authored-by: Todd Treece <360020+toddtreece@users.noreply.github.com>

* simpler row-length check

* simpler code

* fixed converter/prom tests

Co-authored-by: Todd Treece <360020+toddtreece@users.noreply.github.com>
2022-05-05 13:09:01 +02:00
Gábor Farkas
02aa1cd1c5
loki backend mode forward-oauth (#48401)
* loki: backend: add forward oauth credentials functionality

* removed obsolete comment
2022-05-05 12:42:50 +02:00
Gábor Farkas
3cade2f669
Revert "Loki: backend: use streaming JSON parser (#47656)" (#48747)
This reverts commit 46b40b6e82.
2022-05-05 12:02:53 +02:00
Gábor Farkas
46b40b6e82
Loki: backend: use streaming JSON parser (#47656)
* converter: remove __name__ customization because Loki does not do that

Loki does not handle __name__ in a special way.
for Prometheus, the caller can implement the formatting
by themselves

* converter: change labels-formatting

the labels.String() method does not handle strange values well

* loki: backend: use streaming-json parser

* more idiomatic code

Co-authored-by: Todd Treece <360020+toddtreece@users.noreply.github.com>

* simpler row-length check

* simpler code

Co-authored-by: Todd Treece <360020+toddtreece@users.noreply.github.com>
2022-05-05 08:47:40 +02:00
Shirley
27821e0bc1
CloudWatch: Migrate alias to dynamic labels (#48555) 2022-05-03 13:41:51 +01:00
Andreas Christou
7f4b1b767e
Add new DynamoDB metrics & dimensions (#48551) 2022-05-03 13:32:09 +01:00
Gábor Farkas
7d369a1dea
Loki: backend: use json-field (#48486)
* fixed strings

* loki: backend: use json-field
2022-05-03 08:03:25 +02:00
Andreas Christou
d7c16e06d2
AzureMonitor: Add support for not equals and startsWith operators when creating Azure Metrics dimension filters. (#48077)
* Allow dimension operator selection

- Add dimension operators and function to update the operator in the query
- Add logic to ensure the same dimension cannot be selected multiple times (Azure restriction)
- Add selection component

* Update backend logic to default operation and filter to eq '*'

- This must be done as the ne and sw operators do not work with the wildcard filter

* Add tests on dimension operators

* Correct placement of 'and' when building query

* Add comment and simplify filtering logic

* Allow multiSelect for eq and ne operators

- Pass PanelData to DimensionFields component
- Add logic to retrieve labels from PanelData
- Add MultiSelect component for relevant operators
- Update frontend types to allow filter to be an array of strings
- Update backend types to allow filter to be an array of strings
- Update filter string building

* Improve setting of labels

* Update go tests

* Update frontend tests

- Add panelData mock (to be expanded later)
- Update null check in DimensionFields

* Allow custom value and set default

* Add frontend test and fix lint issues

* Improved handling of options for sw operator

* Remove changes related to multiselect

* Add check on refId to ensure dimension labels are correct for query

* Extract custom hook for setting dimension labels

* Add documentation around Azure Monitor metrics dimensions

* Update MetricQueryEditor tests

- Add missing data prop

* Correctly set field values

* Add additional expect for onQueryChange

* Correctly set operators

- Simplify onFilterInputChange

* Ensure no duplicate filters appear

* Ensure that filters are displayed correctly for saved queries

* Update dimension filter test

* Include additional test around changing dimension labels

* Pass panel data through new metrics query editor
2022-04-29 17:01:13 +01:00
Shirley
da035e823f
CloudWatch: Pass feature toggles to backend (#48547) 2022-04-29 17:47:46 +02:00
Gábor Farkas
62cd722726
Loki: minor backend-dataframe-format changes (#48320)
* loki: backend: better dataframe field names

* loki: backend: add dataframe-type to metric dataframes

* loki: backend: only add stats to the first metric dataframe
2022-04-29 09:04:37 +02:00
Gábor Farkas
ae926c2144
loki: better resource-call urls (#48250) 2022-04-28 14:28:57 +02:00
Andres Martinez Gotor
6edefe5147
AzureMonitor: Remove deprecated code (#48328) 2022-04-28 10:27:39 +02:00
Erik Sundell
f58a2d879e
Cloudwatch: Use new annotation API (#48102)
* use new annotation api

* fix bad merge
2022-04-27 12:41:48 +02:00
Sriram
7798b08b1e
fixes invalid no data alerts in influx datasource (#48295) 2022-04-27 08:20:31 +01:00
Ryan McKinley
5294a2af48
Testdata: show settings for current simulation (#48017)
Co-authored-by: An Le <an.le@grafana.com>
2022-04-26 13:45:42 -07:00
Gábor Farkas
c73b9d1818
Loki: do not use the old labels-api (#48185)
* loki: do not use old labels-api

* adjust allowed-url-list

* fixed tests
2022-04-26 11:51:26 +02:00
Kevin Yu
eef22c05e1
AzureMonitor: build azure portal deep link with resource uri (#47947)
* AzureMonitor: build azure portal deep link with resource uri

* extract resource name from the metrics api query

* extract func for getting resource name from metrics url

* add additional valid characters to regex
2022-04-26 04:30:28 +02:00
Guilherme Caulada
a367ad730c
Secrets: Implement basic unified secret store service (#45804)
* wip: Implement kvstore for secrets

* wip: Refactor kvstore for secrets

* wip: Add format key function to secrets kvstore sql

* wip: Add migration for secrets kvstore

* Remove unused Key field from secrets kvstore

* Remove secret values from debug logs

* Integrate unified secrets with datasources

* Fix minor issues and tests for kvstore

* Create test service helper for secret store

* Remove encryption tests from datasources

* Move secret operations after datasources

* Fix datasource proxy tests

* Fix legacy data tests

* Add Name to all delete data source commands

* Implement decryption cache on sql secret store

* Fix minor issue with cache and tests

* Use secret type on secret store datasource operations

* Add comments to make create and update clear

* Rename itemFound variable to isFound

* Improve secret deletion and cache management

* Add base64 encoding to sql secret store

* Move secret retrieval to decrypted values function

* Refactor decrypt secure json data functions

* Fix expr tests

* Fix datasource tests

* Fix plugin proxy tests

* Fix query tests

* Fix metrics api tests

* Remove unused fake secrets service from query tests

* Add rename function to secret store

* Add check for error renaming secret

* Remove bus from tests to fix merge conflicts

* Add background secrets migration to datasources

* Get datasource secure json fields from secrets

* Move migration to secret store

* Revert "Move migration to secret store"

This reverts commit 7c3f872072.

* Add secret service to datasource service on tests

* Fix datasource tests

* Remove merge conflict on wire

* Add ctx to data source http transport on prometheus stats collector

* Add ctx to data source http transport on stats collector test
2022-04-25 13:57:45 -03:00
Kevin Yu
9829195829
AzureMonitor: fix the encoding of the metrics query deep link to Azure Portal (#48139) 2022-04-25 05:39:34 -07:00
Gábor Farkas
d8a754c4a0
loki: send metadata requests through backend (#48063) 2022-04-25 13:16:14 +02:00
Shirley
79d328fcbc
CloudWatch: Add tests for data frame naming in formatAlias (#47899) 2022-04-21 15:11:23 +02:00
Ryan McKinley
72b5af8d9b
Testdata: add basic tank simulation (#47990) 2022-04-20 12:01:09 -07:00
Gábor Farkas
79c06fdddc
Loki: add backend-forward mode to queries, update log-row-context (#47726)
* loki: add helper function to sort dataframe by time

* loki: add direction-attribute to queries

* loki: make log-row-context code backward-compatible

* better comment

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

* fixed test

* simplified code

Co-authored-by: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com>
2022-04-20 13:52:15 +02:00
Ryan McKinley
89fa35a53f
Testdata: introduce basic simulation framework (#47863) 2022-04-20 02:42:29 +02:00
ying-jeanne
7ddae870e7
fix status code 200 (#47818) 2022-04-15 08:01:58 -04:00
Serge Zaitsev
e86b6662a1
Chore: Remove bus.Bus field (#47695)
* Chore: Remove bus.Bus field

* fix integration test
2022-04-13 15:24:13 +02:00
Shirley
4b889eb336
Change to pointer receiver in mock call (#47575) 2022-04-12 16:22:28 +02:00
Gábor Farkas
d95468a4bb
Loki: use millisecond-steps (#47572)
* loki: use millisecond-steps

* better comment

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

* better comment

Co-authored-by: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com>
2022-04-12 12:30:39 +02:00
felixdoerre
9024340487
fix: postgresql ipv6 host should not be enclosed in square brackets (#47522) 2022-04-12 11:11:11 +01:00
Gábor Farkas
68511e7712
loki: use single-dataframe format on the backend (#47069) 2022-04-12 11:58:48 +02:00
Jamie DeMichele
614fd04653
CloudWatch: Added missing MemoryDB Namespace metrics (#47290)
CloudWatch: Added missing MemoryDB metrics
2022-04-11 16:35:50 -04:00
Kristin Laemmert
8f6877e12a
chore: remove all remaining uses of golang.org/x/net/context (#47564)
* chore: remove all remaining uses of  golang.org/x/net/context

This PR finishes the work started in #47532, replacing all calls to that package with the stdlib context and using http.NewRequestWithContext to include the context where necessary.

Bonus: small formatting fixes to goimports in these files.

closes #44178

* tweak: use context.Background in favor of TODO for tests
2022-04-11 14:20:10 -04:00
Aleksandr Stepanov
c0104db72d
bugfix: fix proper type of setting maxConcurrentShardRequests (#47120) 2022-04-11 10:29:49 +02:00
Kevin Yu
ebe5f3646f
AzureMonitor: Use Resource Picker in Metrics Query Editor (#47164)
* wip: new metrics query editor

* prepend subscriptions to url path

* remove duplicated setQueryValue file

* add tests for new metrics query editor

* wip start extracting resource field into a shared component

* fix query editor test

* fix up backend tests

* move azure monitor specific getters to azure_monitor_datasource

* use existing useAsyncState hook

* extract useAsyncState into separate file

* add datahooks tests

* extract resource field component

* cleanup

* clarify variable names

* remove logs query specific resource field component

* add url_builder test

* add azure_monitor_datasources tests

* address comments

* add types

* pass resourceUri to resource field component

* add test to check we reset the query fields when changing resources
2022-04-08 08:49:46 -07:00
Josh Hunt
41642fd5f4
Modify the Server Error scenario to return frontend errors (#47157) 2022-04-07 10:59:49 +01:00
Gábor Farkas
96987ac182
loki: add test to handle __name__ (#47298) 2022-04-05 11:56:54 +02:00
Gabriel Santos
b5bacce819
CloudWatch: Handle new error codes for MetricInsights (#47033)
* CloudWatch: Handle new error codes for MetricInsights

* Changes/test to support case where only the first GetMetricDataOutput returns errors and refactoring

* Fix Potential file inclusion via variable

* Fix gosec 304 by assigning a new variable

* fix goimports issue
2022-04-04 15:44:19 +02:00
Sergey Kostrukov
5675496f6b
Migrate to Grafana Azure SDK (#47232) 2022-04-04 11:23:13 +02:00
Sergey Kostrukov
656ade9884
Shared Azure middleware between Azure Monitor and Prometheus datasources (#46002)
* Scopes in Azure middleware

* Enable Azure middleware without feature flag

* Use common Azure middleware in Azure Monitor

* Apply feature flag to JsonData configuration of Azure auth

* Enforce feature flag in Prometheus datasource

* Prometheus provider tests

* Datasource service tests

* Fix http client provider tests

* Pass sdkhttpclient.Options by reference

* Add middleware to httpclient.Options

* Remove dependency on Grafana settings

* Unit-tests updated

* Fix ds_proxy_test

* Fix service_test
2022-04-01 13:26:49 +02:00
Gábor Farkas
a246381879
loki: backend-mode: add stats support (#46526)
* loki: backend-mode: add stats support

* refactor: rename variable
2022-03-31 17:50:27 +02:00
Kevin Yu
1a4b1184bd
Azure Monitor: allow metrics call to use resource uri (#46858)
* Azure Monitor: allow metrics call to use resource uri

* test case when only resource uri is provided

* remove logs

* Rename json field name from resource to resourceUri

* Group legacy URL builder params test cases

* move comment to the correct position

* Add clarifications in comments

Co-authored-by: Sarah Zinger <sarah.zinger@grafana.com>

Co-authored-by: Sarah Zinger <sarah.zinger@grafana.com>
2022-03-31 08:20:29 -07:00
felixdoerre
f5a790e291
Fix postgresql host-v6 literals (#46876)
Ipv6 literals in postgresql hosts previously worked and were subsequently
broken. This change fixes the parsing and adds additional test cases.
2022-03-31 11:45:49 +01:00
Dirkco du Plessis
b52794601d
mssql: explicit disable encryption when its disabled (#46546) 2022-03-30 15:14:04 +01:00
Andres Martinez Gotor
48113beeeb
AzureMonitor: Fix missing top parameter when dimensions are set (#47010) 2022-03-29 16:27:09 +02:00
Tania B
8c622c1ef6
Datemath: Fix weekstart calculation (#46962)
* Update go-datemath version

* Remove unnecessary bits

* fixup! Remove unnecessary bits
2022-03-26 19:57:29 +01:00
Julien NOEL
f4b6c4019c
PostgreSQL: __unixEpochGroup to support arithmetic expression as argument (#46764)
* __unixEpochGroup to support arithmetic argument

Following call generates wrong expression : 
 
$__unixEpochGroupAlias(height+42,$__interval)

=> floor(height+42/60)*60 AS "time"

instead of

=> floor((height+42)/60)*60 AS "time"

* Update test of __unixEpochGroup related to issue #46764
2022-03-26 18:44:14 +01:00
Andres Martinez Gotor
3c5e68a349
CloudWatch: Fix metric names (#46929) 2022-03-25 09:17:15 +01:00
Santiago
a9b55f7905
Fix InfluxDB tag variables parsing (#46862)
* regex bug fixed

* remove unnecessary test
2022-03-23 21:13:17 -06:00
Ezequiel Victorero
c717320942
Adding FGAC annotations validation for creation and deletion (#46736)
Access Control: Adding FGAC annotations validation for creation and deletion
Co-authored-by: IevaVasiljeva <ieva.vasiljeva@grafana.com>
2022-03-21 14:28:39 -03:00
Ryan McKinley
1cfb9a4a19
Storage: add basic storage service (#46604) 2022-03-17 10:19:23 -07:00
Andres Martinez Gotor
727204ed5e
CloudMonitoring: Improve error message (#46599) 2022-03-16 09:37:48 +01:00
Kevin Yu
99b4dfc27d
Dashboard: Validate refId when generating id for cloudwatch query (#46182)
* Validate refId when generating id for cloudwatch query

* add test case when refId is a valid metric data id
2022-03-14 09:44:04 -07:00
Erik Sundell
6670257c5e
CloudWatch: Use default http client from aws-sdk-go (#46370)
* use default http client from aws-sdk-go

* temp comment out line and link to issue
2022-03-09 16:29:10 +01:00
Todd Treece
db5f480a8f
Prometheus: Fix timestamp truncation (#46302)
* avoid truncation to seconding by using time.Time directly

* update test coverage
2022-03-08 10:55:25 -05:00
Shirley
438512c7ef
CloudWatch: Add tests to query input region in executeLogAlertQuery (#46212) 2022-03-04 11:15:36 +01:00
Gábor Farkas
c4404982dc
loki: backend-mode: add nanosecond-timestamps (#45963) 2022-03-04 09:42:18 +01:00
Shirley
1255f8a76a
Unexport mocks, use aws-sdk-go helpers, rename test utilities file (#46107) 2022-03-03 09:42:51 +01:00
Andres Martinez Gotor
700f6863f2
AzureMonitor: Move Application Insights and Insight Analytics to a deprecated package (#45834) 2022-03-02 15:41:07 +01:00
Isabella Siu
590ea19c3f
Cloudwatch: use CheckHealth for testing datasource (#45974)
Co-authored-by: Shirley Leu <4163034+fridgepoet@users.noreply.github.com>
2022-03-02 08:48:51 -05:00
Ryan McKinley
796bc27f75
Loki: support live streaming (#42804) 2022-03-01 14:46:52 -08:00
Shachi Solanki
190757b3c6
Tempo / Trace Viewer: Support Span Links in Trace Viewer (#45632)
* Support Span Links in Trace Viewer

* Update ReferencesButton styles

* Remove datasource prop

Co-authored-by: Connor Lindsey <cblindsey3@gmail.com>
2022-02-25 11:14:13 -07:00
Shirley
a68a570e92
CloudWatch: Add test to executeStartQuery (#45888)
* CloudWatch: Add test to executeStartQuery

* Add test for absence of limit

* Restrict assertions to limit in some tests
2022-02-25 13:14:59 +00:00
Shirley
304185f682
CloudWatch: Fix running go test with count (#45892) 2022-02-25 12:20:07 +01:00
Gábor Farkas
1cad35ea67
loki: backend mode: support all query types (#45619)
* loki: backend mode: support all query types

* loki: backend: adjust vector-parsing field-names

* loki: backend: no interval for streams-dataframes

* loki: backend: enable more query types

* better variable name

* removed unnecessary code

* improve frame-processing

* more unit tests

* improved code

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

* remove unused code

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

* simplify code

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

* lint fix

Co-authored-by: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com>
2022-02-25 09:14:17 +01:00
Yaelle Chaudy
0e7b0f16b8
Adding ap-southeast-3 to cloudwatch regions (#45821) 2022-02-24 14:00:24 +01:00
matt abrams
76da017d00
MySQL: Prevent pre-epoch timestamps from breaking __timeFilter (#45345)
* add logic to change timeFilter query when FROM time is pre-EPOCH

* fix timeFilter tests where FROM time is pre-EPOCH
2022-02-22 20:06:04 +01:00
Mitsuhiro Tanda
7acb203b52
remove unused code of Cloud Monitoring distribution metrics type (#45702) 2022-02-22 11:24:52 +01:00
Mitsuhiro Tanda
0fb490c00d
Cloud Monitoring: set missing meta data for distribution type metrics (#45500)
* set missing meta data for distribution type metrics

* add test

* add test

* simplify custom set

* add test for executedQueryString

* add test data

* fix tests

* check group by
2022-02-21 11:20:34 +01:00
Joey Tawadrous
955b921c88
InfluxDB: new row value types (#44789)
* Check type and act accordingly

* Add string type

* Add bool type

* Change method name in test

* Remove comment

* Changed test var names to represent the float case

* Added string test case

* Added bool test case

* Update response in test

* Change string val

* Fix frame meta missing in tests

* Fixed test parse query

* Fixed out of bounds test

* parseFloatSeries

* parseStringSeries and parseBoolSeries

* Formatting

* Use multi frames for now

* strings.ToLower for time col check

* Move timeField out of if checks
2022-02-18 17:37:45 +00:00
Gábor Farkas
5d704fd46e
Loki: backend: use custom http code (#44643)
* Loki: backend: use custom http code

* simplfied comment

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

Co-authored-by: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com>
2022-02-18 14:35:39 +01:00
Yaelle Chaudy
530913dd37
Azure Monitor : Adding json formatting of error messages in Panel Header Corner and Inspect Error Tab (#44877)
* Trying out json formatting of azure graph err from frontend

* Added some tests wip

* Wrap text in popper tooltip

* fix conflict

* Wrap text in tooltip

* Complete tests

* Added invalid json test

* Backend changes and tests

* removed comments

* Added split of message / json and edge cases tests

* Addressed comments

* moved catch to parseErrorMessage
2022-02-18 12:09:24 +01:00
Szymon Szypulski
929d8a358f
Cloudwatch: Add support for AWS/PrivateLink* metrics and dimensions (#45515)
Add support for AWS/PrivateLink{Endpoints,Interfaces} metrics and
dimensions. Change is based on the official AWS documentation[1].

1. https://docs.aws.amazon.com/vpc/latest/privatelink/privatelink-cloudwatch-metrics.html
2022-02-18 10:21:17 +01:00
Karl Persson
cdc08105c2
Access control: Set default permissions for data sources when using access control (#45482)
* Rename interfaces and use then with wire injection

* Set default permissions when creating new data source
2022-02-17 14:03:45 +01:00
Isabella Siu
50a53ef58b
CloudWatch: replace metricFindQueries with CallResourceHandler (#41571) 2022-02-16 14:28:26 -05:00
Torkel Ödegaard
cfa24a3cfb
Prometheus: Auto legend handling (#45367)
* Legend editor is working

* It's working

* Progress on auto legend mode

* Fixes

* added unit tests

* Added go tests

* Fixing tests

* Fix issue with timing and internal state

* Update public/app/plugins/datasource/prometheus/querybuilder/components/PromQueryCodeEditor.tsx

Co-authored-by: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com>
2022-02-16 14:06:33 +01:00
Joey Tawadrous
b4dd3138ce
InfluxDB: metricFindQuery migration to backend (#44546)
* Send metricFindQuery to backend

* Added feature toggle

* Changed flag name

* metricFindQuery backend

* Added test for metricFindQuery backend parse

* Added test for show tag values

* Test for metricFindQueries

* Updated tests

* Put back comment

* Case insensitive in transformRows

* Check length ov value pair

* Sep tests

* Updated valuePair index
2022-02-16 09:16:22 +00:00
Ryan McKinley
d665306ad1
Search: add feature flag and basic service (#45112)
Co-authored-by: Artur Wierzbicki <artur@arturwierzbicki.com>
2022-02-15 10:26:03 -08:00
Torkel Ödegaard
a757a57c6e
Prometheus: Show executed query in inspector (#45362)
* Prometheus: Show executed query in inspector

* Loki: Improving test
2022-02-15 15:02:03 +01:00
Shirley
1c1a45a880
CloudWatch: Add tests to annotations query (#45337) 2022-02-15 12:45:50 +01:00
Marcus Efraimsson
6a776c78d4
Datasource: Fixes storing of secureJSONData when creating/updating datasource (#45290)
Fixes an issue introduced by #44987 where bus dispatch was replaced by calling sqlstore 
directly instead of the datasource service.

Fixes #45273
2022-02-11 15:52:14 +01:00
Shirley
89a0c0fc37
Cloudwatch: Remove unused parameters (#45237)
* Remove unused parameters

* Remove unused context

* Make plugin context first parameter
2022-02-10 17:15:11 +01:00
Gábor Farkas
96ae44ee2c
loki: alerting: do not round timestamps to seconds (#45057) 2022-02-10 12:53:46 +01:00
Shirley
5edcc2e795
Cloudwatch: Use generic null-insertion mechanism (#43507)
* Cloudwatch: Fix nil values for a period gap in metrics

* Use fields periods for intervals
2022-02-10 10:17:45 +01:00
Joey Tawadrous
10232c7857
InfluxDB: backend migration (run query in explore) (#43352)
* InfluxDB backend migration

* Multiple queries and more

* Added types

* Updated preferredVisualisationType

* Updated model parser test to include limit,slimit,orderByTime

* Added test for building query with limit, slimit

* Added test for building query with limit, slimit, orderByTime and puts them in the correct order

* Add test: Influxdb response parser should parse two responses with different refIDs

* Moved methods to responds parser

* Add test to ensure ExecutedQueryString is populated

* Move functions out of response parser class

* Test for getSelectedParams

* Merge cases

* Change to const

* Test get table columns correctly

* Removed unecessary fields

* Test get table rows correctly

* Removed getSeries function

* Added test for preferredVisualisationType

* Added test for executedQueryString

* Modified response parser

* Removed test

* Improvements

* Tests

* Review changes

* Feature flag rename and code gen
2022-02-09 18:26:16 +00:00
Gábor Farkas
d9d1f8520e
loki: backend-queries: set interval-value in dataframe (#44965)
* loki: backend-queries: set interval-value in dataframe

* fixed unit test

* added interval-specific unit test
2022-02-07 13:02:04 +01:00
Sergey Kostrukov
85ea1a5d64
Prometheus: Fix Azure authentication support (#44407)
Re-adding back Azure authentication support to Prometheus datasource 
after the datasource query logic was rewritten from plugin.json routes to 
Go backend.

Ref #35857
2022-02-03 17:06:31 +01:00
Todd Treece
c8bb4c733e
Prometheus: Set interval on time field (#44802) 2022-02-03 08:15:55 -05:00
Ryan McKinley
ac90c8d68d
Geomap: initialization fixes (#44745) 2022-02-01 22:08:07 -08:00
Ryan McKinley
3749695594
TestData: support dropping points from random walk data and send interval (#44683) 2022-02-01 17:27:52 +01:00
Gábor Farkas
3873c5e7b5
loki: alerting: better error-handling (#44700) 2022-02-01 13:34:03 +01:00
Ryan McKinley
6a72d97265
TestData: support raw results in the raw frames editor (#44609) 2022-01-31 15:40:58 -08:00
Isabella Siu
cbbf451b36
CloudWatch: small logs refactors (#44677) 2022-01-31 17:30:16 -05:00
Ivana Huckova
780591cc12
Prometheus: Fix some of the alerting queries that use reduce/math operation (#44380)
* Prometheus: Dont fill response with nulls for alerting queries

* Refactor based on reviews
2022-01-31 18:14:30 +01:00
Santiago
7ed82ac049
Check for empty URLs when creating/updating a data source (#42837)
* checks for empty URLs added

* check for TimeSeriesTypeNot to fix InfluxDB alerts

* log a warning when a data frame is ignored

* fix: add brittle Prometheus URL input selector

needs a proper aria-label or test-data-id selector

* test: add URL input aria-label

needs to use the grafana/e2e-selectors package

* test: run ci

* add URL validation for specific data sources, e2e tests

* Update pkg/api/datasource/validation.go

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

* delete duplicated logs

* delete unnecessary leading newline

Co-authored-by: gillesdemey <gilles.de.mey@gmail.com>
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
2022-01-31 12:39:55 -03:00
Gábor Farkas
6e071d030f
loki: added benchmark for metric-response processing (#44539) 2022-01-28 09:44:57 +01:00
Gábor Farkas
b42161a713
Loki: add from JSON to dataframes tests (#44375)
* Loki: add from JSON to dataframes tests

* fixed wrong content-type

* added -Inf test-case
2022-01-27 12:43:44 +01:00
Ryan McKinley
5d66194ec5
FeatureFlags: define features outside settings.Cfg (take 3) (#44443) 2022-01-26 09:44:20 -08:00
Morten Nygaard Åsnes
9e4aafa719
MSSQL: Configuration of certificate verification for TLS connection (#31865)
Fixes #24589

Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
2022-01-26 15:00:18 +01:00
Mitsuhiro Tanda
d1083b9597
Cloud Monitoring: Reduce request size when listing labels (#44365) 2022-01-26 12:02:42 +01:00
Agnès Toulet
65bdb3a899
FeatureFlags: Revert managing feature flags outside of settings.Cfg (#44382)
* Revert "FeatureToggles: register all enterprise feature toggles (#44336)"

This reverts commit f53b3fb007.

* Revert "FeatureFlags: manage feature flags outside of settings.Cfg (#43692)"

This reverts commit f94c0decbd.
2022-01-24 16:08:05 +01:00
Gábor Farkas
9161f9d2e1
prometheus: added json-loading benchmark (#44309) 2022-01-24 14:39:26 +01:00
Gábor Farkas
0f8b0dc301
prometheus: refactor test (#44358) 2022-01-24 11:08:41 +01:00
Ryan McKinley
f94c0decbd
FeatureFlags: manage feature flags outside of settings.Cfg (#43692) 2022-01-20 13:42:05 -08:00
Will Browne
7fbc7d019a
Plugins: Core plugins register via backend factory provider (#43171)
* refactoring store interface and init flow

* fix import

* fix linter

* refactor resource calling

* load with class

* re-order args

* fix tests

* fix linter

* remove old creator

* add custom config struct

* fix some tests

* cleanup

* fix

* tackle plugins

* fix linter

* refactor and fix test

* add connect failure error

* add fix for azure, cloud monitoring and test data

* restructure

* remove unused err

* add fake tracer for test

* fix grafana ds plugin
2022-01-20 18:16:22 +01:00
Isabella Siu
2c3bed1f4b
CloudWatch: remove unused "live" log code (#44185) 2022-01-20 08:58:39 -05:00
idafurjes
30aa24a183
Chore: Implement OpenTelemtry in Grafana (#42674)
* Separate Tracer interface to TracerService and Tracer

* Fix lint

* Fix:Make it possible to start spans for both opentracing and opentelemetry in ds proxy

* Add span methods, use span interface for rest of tracing

* Fix logs in tracing

* Fix tests that are related to tracing

* Fix resourcepermissions test

* Fix some tests

* Fix more tests

* Add TracingService to wire cli runner

* Remove GlobalTracer from bus

* Renaming test function

* Remove GlobalTracer from TSDB

* Replace GlobalTracer in api

* Adjust tests to the InitializeForTests func

* Remove GlobalTracer from services

* Remove GlobalTracer

* Remove bus.NewTest

* Remove Tracer interface

* Add InitializeForBus

* Simplify tests

* Clean up tests

* Rename TracerService to Tracer

* Update pkg/middleware/request_tracing.go

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

* Initialize tracer before passing it to SQLStore initialization in commands

* Remove tests for opentracing

* Set span attributes correctly, remove unnecessary trace initiliazation form test

* Add tracer instance to newSQLStore

* Fix changes due to rebase

* Add modified tracing middleware test

* Fix opentracing implementation tags

Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
2022-01-20 11:10:12 +01:00
Gabriel MABILLE
54280fc9d7
AccessControl: Resolve attribute based scopes to id based scopes (#40742)
* AccessControl: POC scope attribute resolution

Refactor based on ScopeMutators

test errors and calls to cache

Add comments to tests

Rename logger

Create keywordMutator only once

* AccessControl: Add AttributeScopeResolver registration

Co-authored-by: gamab <gabriel.mabille@grafana.com>

* AccessControl: Add AttributeScopeResolver to datasources

Co-authored-by: gamab <gabriel.mabille@grafana.com>

* Test evaluation with translation

* fix imports

* AccessControl: Test attribute resolver

* Fix trailing white space

* Make ScopeResolver public for enterprise redefine

* Handle wildcard

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

Co-authored-by: jguer <joao.guerreiro@grafana.com>
2022-01-18 17:34:35 +01:00
Andres Martinez Gotor
4e1c7e868e
Cloudwatch: use the backend HTTP client provider (#44036) 2022-01-18 09:34:12 +01:00
Piotr Jamróz
9fb8339f87
Elastic: Allow using long/int as date field for alerts (#44027)
* Use integers for time range filter

Previously it was passed as a string which is automatically converted by Elastic to a number only if the field type is "date". For other types (e.g. "long") such conversion doesn't work. In theory "date" could be passed as a formatted string but we don't use it this way and always pass it as a number so it is safe to always pass numbers, not strings.

* Fix time_series_query_test

* Retrigger build
2022-01-17 15:45:09 +01:00
Ivana Huckova
e704110f74
Prometheus: Fix interpolation of $__rate_interval variable (#44035)
* Name fields based on targets length

* Remove rounding in rate interval variable replacing

* Refactor and fix edge  case when interval and time duration would be rate interval

* Add tests

* Remove , from test

* Revert "Name fields based on targets length"

This reverts commit 5dcb34a765.
2022-01-17 15:32:23 +01:00
Gábor Farkas
bedc5cccaa
prometheus: fix auto-inserting null-timestamps at the end (#44022) 2022-01-14 09:25:15 +01:00
Gábor Farkas
4a88b8f66c
Prometheus: add tests covering the prometheus-response to dataframes conversion (#43892)
* prometheus: add tests covering prometheus_response to grafana_dataframes

* fixed variable name

* added comment

* removed not-helping function call
2022-01-13 11:52:50 +01:00
Victor Marin
f881fd1637
Postgres/MySQL/MSSQL: Cancel in-flight SQL query if user cancels query in grafana (#43890) 2022-01-12 16:24:27 +02:00
Travis Patterson
9eb82f9fff
Propagate all headers (#43812)
* Propagate all headers

* stable header order
2022-01-07 12:45:26 -07:00
Ryan McKinley
546818819b
Loki: use queryType rather than range|instant flags (#43727) 2022-01-07 10:00:11 -08:00
Emil Tullstedt
fdd196a627
Datemath: Remove unused functions (#43665) 2022-01-07 12:53:31 +01:00
Travis Patterson
20b3b2a448
Forward oauth tokens after prometheus datasource migration (#43686)
* create the prom client

* implement lru cache of prometheus clients based on auth headers

* linter
2022-01-05 13:55:55 -07:00
Ivana Huckova
d7d6c10664
Prometheus: Fill missing steps with null values (#43622)
* Prometheus: Add empty points when data points missing

* Remove newline

* Add comments

* Improve/Fix test

* Remove unused variable
2022-01-05 11:40:32 +01:00
Travis Patterson
c4c05a5b71
refactor promethueus package into sub packages (#43634) 2022-01-04 07:22:33 -07:00
Emil Tullstedt
df4e9ca12b
Datemath: Support fiscal years (#43558) 2022-01-04 13:56:34 +01:00
David Henderson
575eb68828
CloudWatch: Add Missing Elasticache Host-level metrics (#43455)
Add missing host-level Elasticache metrics from https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/CacheMetrics.HostLevel.html

Follows from https://github.com/grafana/grafana/pull/43336#issuecomment-999367311
2021-12-22 14:02:52 +01:00
idafurjes
b8852ef6a3
Chore: Remove context.TODO() (#43409)
* Remove context.TODO() from services

* Fix live test

* Remove context.TODO
2021-12-22 11:02:42 +01:00
Siavash Safi
4c4322f717
CloudWatch: Add all ElastiCache Redis Metrics (#43336)
Add all missing Redis ElastiCache metrics.
https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/CacheMetrics.Redis.html

Signed-off-by: Siavash Safi <siavash.safi@gmail.com>
2021-12-21 09:13:41 +01:00
Gábor Farkas
1879a6855e
prometheus: respect the http-method data source setting (#42753)
* prometheus: respect the http-method data source setting

* removed forgotten if-true section

* refactored json-check
2021-12-20 11:27:18 +01:00
Ilya Stoliar
9cf5623918
CloudWatch: Add Data Lifecycle Manager metrics and dimension (#43310) 2021-12-20 09:48:07 +01:00
Artur Wierzbicki
197f4f81f2
#41993: make it possible to create N random60hz channels (#43295) 2021-12-17 23:42:37 +04:00
Will Browne
e4ba5f17dd
add core plugins thru store (#43085) 2021-12-14 15:22:40 +01:00
Shirley
21656a0491
Remove reference to legacydata package (#43075)
* Remove reference to legacydata package

* Change from and to times
2021-12-14 12:58:31 +01:00
Erik Sundell
043680371f
add all new es metrics (#43034) 2021-12-14 10:12:39 +01:00
Marcus Efraimsson
d6ec6f8ad2
Backport fix to main (#42979)
* fixes

(cherry picked from commit a2c386915ce11b9422f4af8ae181eaa1a22bc5c3)
(cherry picked from commit 06706efbbe)

* fix regex

(cherry picked from commit a259213a3badc9618e969f2c8db0a0143f00faee)
(cherry picked from commit 1d7105c095)

* lint (#42970)

(cherry picked from commit afb9e8e5f3)

Co-authored-by: Will Browne <will.browne@grafana.com>
Co-authored-by: malcolmholmes <42545407+malcolmholmes@users.noreply.github.com>
2021-12-10 16:10:04 +01:00
Gábor Farkas
a4cc1f6b39
loki: alerting: handle curly-braces-style variables (#42933) 2021-12-09 15:16:01 +01:00
Ivana Huckova
2655be61b6
Prometheus: Interpolate curly brackets syntax variable (#42927) 2021-12-09 14:37:24 +01:00
Gábor Farkas
3232ae08c0
loki: removed unused variable (#42909) 2021-12-09 13:16:52 +01:00
Isabella Siu
a2ad0a0fb6
CloudMonitor: Iterate over pageToken for resources (#42546) 2021-12-07 08:54:50 -05:00
Gábor Farkas
6686f8c345
loki: rename ResponseModel to QueryModel (#42794) 2021-12-07 07:57:52 +01:00
Ivana Huckova
21fe78302b
Prometheus: Fix passing of custom params when running queries (#42728)
* Prometheus: Fix passing of custom params

* Remove prints
2021-12-03 16:28:05 +01:00
Yuriy Tseretyan
9139f61105
Alerting: Update alert rule migration to use expanded queries (#42493)
* move targetData to target

* use constants instead of literals.

* Update comments and add tests

Co-authored-by: gotjosh <josue.abreu@gmail.com>
2021-12-01 11:45:27 +00:00
Erik Sundell
bab78a9e64
CloudWatch: Add support for AWS Metric Insights (#42487)
* add support for code editor and builder

* refactor cloudwatch migration

* Add tooltip to editor field (#56)

* add tooltip

* add old tooltips

* Bug bash feedback fixes (#58)

* make ASC the default option

* update sql preview whenever sql changes

* don't allow queries without aggregation

* set default value for aggregation

* use new input field

* cleanup

* pr feedback

* prevent unnecessary rerenders

* use frame error instead of main error

* remove not used snapshot

* Use dimension filter in schema picker  (#63)

* use dimension key filter in group by and schema labels

* add dimension filter also to code editor

* add tests

* fix build error

* fix strict error

* remove debug code

* fix annotation editor (#64)

* fix annotation editor

* fix broken test

* revert annotation backend change

* PR feedback (#67)

* pr feedback

* removed dimension filter from group by

* add spacing between common fields and rest

* do not generate deep link for metric queries (#70)

* update docs (#69)

Co-authored-by: Erik Sundell <erik.sundell87@gmail.com>

* fix lint problem caused by merge conflict

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>
2021-11-30 10:53:31 +01:00
Ivan Anselmi
cf3105e5be
MSSQL: Change regex to validate Provider connection string (#40248)
* Change the regex to allow to specified other connection attribute for MSSQL connection like ApplicationIntent property

* Docs update

* docs update

* some tests added

* formatting

* Change the regex to allow to specified other connection attribute for MSSQL connection like ApplicationIntent property

* Docs update

* docs update

* some tests added

* formatting

* docs and formatting

Co-authored-by: Zoltán Bedi <zoltan.bedi@gmail.com>
2021-11-30 09:28:48 +01:00
Will Browne
e440796cb3
only load CSV when data exists (#42441) 2021-11-29 15:21:18 +01:00
Marcus Efraimsson
8927a3ca20
Chore: Query endpoint refactor (#41637)
Get rid of using legacydata.RequestHandler in HTTPServer, /api/tsdb/query and pkg/expr 
with the goal of deprecating /api/tsdb/query and remove it completely eventually. This is 
the first step of cleaning up the HTTP API query endpoint.

Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
Co-authored-by: Alexander Emelin <frvzmb@gmail.com>
2021-11-29 14:21:54 +01:00
Ivana Huckova
0b5d7067f9
Prometheus: Fix range variables interpolation for time ranges smaller than 1 second (#42242)
* Prometheus: Fix precision for queries with < 1s timeRange

* Update pkg/tsdb/prometheus/time_series_query.go

Co-authored-by: Gábor Farkas <gabor.farkas@gmail.com>

Co-authored-by: Gábor Farkas <gabor.farkas@gmail.com>
2021-11-29 12:41:23 +01:00
Sriram
70bc0b86e2
TestDataDB: Raw frame input (#42209)
* test datasource raw-frame scenario added

* typo fix in doc
2021-11-25 09:14:34 +00:00