Commit Graph

957 Commits

Author SHA1 Message Date
Jeet Parekh
c73a0007c7
CloudWatch: updated namespaces - Athena, DocDB, and Route53Resolver (#22604) 2020-03-06 10:41:29 +02:00
Daniel Lee
f95c8b785c
Stackdriver: Migrate GCE default project (#22593)
* Ensure default project

* Remove debug logging

* Fix broken test

* Update snapshot
2020-03-05 17:53:41 +01:00
Erik Sundell
0f8cfca4e6
surround CloudWatch dimension names with double quotes (#22222) 2020-03-05 14:15:45 +01:00
Erik Sundell
934a8f08ae
Stackdriver: Project selector (#22447)
* clean PR #17366

* udpate vendor

* [WIP] Implement projects management for stackdriver

* [WIP] Implement projects management for stackdriver

* [WIP] Implement projects management for stackdriver

* Implement projects management for stackdriver

* [WIP][Tests] Fix errors

* clean anonymous struct

* remove await

* don't store project list

* Add default project on query editor

* gofmt

* Fix tests

* Move test data source to backend

* Use segment instead of dropdown. remove ensure default project since it's not being used anymore.

* Fix broken annotation editor

* Load gceDefaultAccount only once when in the config page

* Reset error message on auth type change

* Add metric find query for projects

* Remove debug code

* Fix broken tests

* Fix typings

* Fix lint error

* Slightly different approach - now having a distiction between config page default project, and project that is selectable from the dropdown in the query editor.

* Fix broken tests

* Attempt to fix strict ts errors

* Prevent state from being set multiple times

* Remove noOptionsMessage since it seems to be obosolete in react select

* One more attempt to solve ts strict error

* Interpolate project template variable. Make sure its loaded correctly when opening variable query editor first time

* Implicit any fix

* fix: typescript strict null check fixes

* Return empty array in case project endpoint fails

* Rename project to projectName to prevent clashing with legacy query prop

* Fix broken test

* fix: Stackdriver - template replace on filter label

should have a regex format as that escapes the dots
in the label name which is not valid.

Co-authored-by: Labesse Kévin <kevin@labesse.me>
Co-authored-by: Elias Cédric Laouiti <elias@abtasty.com>
Co-authored-by: Daniel Lee <dan.limerick@gmail.com>
2020-03-02 09:31:09 -05:00
Martin Passing
90541d3084
add CloudWatch Usage Metrics (#22179)
https://docs.amazonaws.cn/en_us/AmazonCloudWatch/latest/monitoring/CloudWatch-Usage-Metrics.html
2020-02-16 18:07:28 +01:00
Erik Sundell
685c9043a8
CloudWatch: Auto period snap to next higher period (#21659)
* Snap to next higher period instead of closest

* Adjust period calc
2020-01-22 13:43:36 +01:00
kenju
935d447c6a CloudWatch: Add DynamoDB Accelerator (DAX) metrics & dimensions (#21644)
Closes #10494
2020-01-21 15:19:39 +01:00
Ryan McKinley
5f14d62c0d
TestData: allow negative values for random_walk parameters (#21627) 2020-01-20 10:50:42 -08:00
Erik Sundell
a1733bb412
CloudWatch: Expand dimension value in alias correctly (#21626)
* Make sure dimension value is being returned, and not just label

* Fix typo
2020-01-20 18:51:32 +01:00
Torkel Ödegaard
2732aca05c
TestData: Adds important new features to the random walk scenario (#21613)
* test data refactor

* new random walk options

* fixed test

* Added automatic names
2020-01-20 12:42:42 +01:00
Marcus Efraimsson
59469e14cf
CloudWatch: Fix ordering of map to resolve flaky test take 2 (#21577) 2020-01-17 16:30:42 +01:00
Marcus Efraimsson
303bbb9900
CloudWatch: Fix ordering of map to resolve flaky test (#21572) 2020-01-17 15:27:03 +01:00
Erik Sundell
8616f1beac Chore: Fix go vet problem (#21568) 2020-01-17 13:48:09 +01:00
Erik Sundell
d40b66f1c1
CloudWatch: Calculate period based on time range (#21471)
* Calculate min period based on time range and no of queries

* Use hardcoded array of periods if period is not defined actively by the user

* Fix broken tests

* Use a smaller max period for auto interval

* Fix broken tests

* Test period calculation

* Test min retention period

* Fix broken test
2020-01-17 13:22:43 +01:00
Erik Sundell
b398bc592b
CloudWatch: Multi-valued template variable dimension alias fix (#21541)
* Match dimension value with label substring

* Add unit tests
2020-01-17 12:47:40 +01:00
Erik Sundell
260239d98b
Stackdriver: Support meta labels (#21373)
* Rewrite angular segments for filter and group by in react

* wip: refactoring

* Update metric find queries

* Remove old maps used to create labels - use one map for all types instead

* Use value as label (again) for filters ang groupby

* Remove old filter

* Remove not used code

* Fixes after pr feedback

* Fix broken tests and add new metadata tests

* Add index file to make imports cleaner

* Cleanup. Remove old angular filter code

* Fix broken tests

* Use type switching instead of if statements

* Use globals for regex

* Updates after pr feedback

* Make sure it's possible to filter using the same key multiple times

* Replace metric select with segment component

* Pass template vars as props

* Refactor meta labels code

* Reorder template variables

* Fix broken tests

* Reset metric value when changing service

* Fix lint issue.

* Make tests independant of element order

* Include kubernetes.io in regex

* Add instruction in help section
2020-01-17 12:25:47 +01:00
Erik Sundell
20aac7f04b
CloudWatch: Display partial result in graph when max DP/call limit is reached (#21533)
* Return data and warning in case dp limit is reached

* Change warning text
2020-01-17 11:18:28 +01:00
Erik Sundell
a35b2ac463
CloudWatch: Annotation Editor rewrite (#20765)
* wip: react rewrite

* Cleanup

* Break out non annontations specific fields

* Cleanup. Make annontations editor a functional component

* Remove redundant classnames

* Add paneldata to props

* Cleanup

* Fix rebase merge problem

* Updates after pr feedback

* Fix conflict with master
2020-01-15 16:38:15 +01:00
Marcus Efraimsson
baba1634b8 Plugins: Use grafana-plugin-sdk-go v0.5.0 (#21116)
* fix dispense

* plugin loading refactor

Moves common functionality of registering, starting,
stopping and restarting backend plugins to
backendplugin package.

* simplify plugin descriptors

* target sdk v0.5.0

Co-authored-by: Kyle Brandt <kyle@kbrandt.com>
2020-01-08 11:43:28 -05:00
Erik Sundell
cf2dd51827
CloudWatch: dimension_values templating fix (#21401)
* Handle dimension value if passed as array

* Break out dimension value loading into its own func
2020-01-08 12:24:10 +01:00
Brian Curtich
cef328d1d6 Cloudwatch ECS Container Insights Support (#21125) 2019-12-17 09:58:24 +02:00
Jerry Ylilammi
e27ab89aed Postgres/MySQL/MSSQL: Adds support for region annotations (#20752)
Adds support for region annotations in Postgres, MySQL and 
MSSQL data sources by adding a column named timeend to 
annotation query.

Co-Authored-By: Diana Payton <52059945+oddlittlebird@users.noreply.github.com>

Closes #20918
Ref #10589
2019-12-13 17:25:36 +01:00
Erik Sundell
a533e00622
Remove escaping of \ ( ) characters (#20915) 2019-12-06 09:59:33 +01:00
Kyle Brandt
4afd40018b
transform: update to use sdk with frame.labels moved to frame.[]field.labels (#20670)
sdk v0.4.0
2019-11-26 13:28:16 -05:00
Marcus Efraimsson
3fc5f4552a CloudWatch: Fix high CPU load (#20579)
* Cache decrypted securejsondata
* Models: Add datasource cache tests
2019-11-22 14:21:23 +01:00
Erik Sundell
359416b89f
Cloudwatch: Fix LaunchTime attribute tag bug (#20237)
* Cast tags of type Time to string

* Fig go lint issue
2019-11-21 09:20:44 +01:00
Erik Sundell
ec18e2bfc3
CloudWatch: Remove HighResolution toggle since it's not being used (#20440)
* Remove highres flag since it's not being used

* Remove not used code. Init id field correctly

* Fix broken tests

* Remove GMS related calculations

* Rename period field

* Add breaking changes to changelog. Also update upgrading docs

* Update snapshot

* Update docs after feedback

* Changes after feedback
2019-11-20 13:34:44 +01:00
Mitsuhiro Tanda
af35e081c2 handle PartialData status (#20459) 2019-11-19 13:36:32 +01:00
Kyle Brandt
c9309edbb0
transform: changes to support sdk v0.2.0 (#20426)
and update vendor
2019-11-18 11:40:40 -05:00
Sofia Papagiannaki
2ca1cc5645
MySql: Fix password regression in MySQL datasource (#20376) 2019-11-14 12:16:38 +02:00
Erik Sundell
00bef917ee
CloudWatch: Datasource improvements (#20268)
* CloudWatch: Datasource improvements

* Add statistic as template variale

* Add wildcard to list of values

* Template variable intercept dimension key

* Return row specific errors when transformation error occured

* Add meta feedback

* Make it possible to retrieve values without known metrics

* Add curated dashboard for EC2

* Fix broken tests

* Use correct dashboard name

* Display alert in case multi template var is being used for some certain props in the cloudwatch query

* Minor fixes after feedback

* Update dashboard json

* Update snapshot test

* Make sure region default is intercepted in cloudwatch link

* Update dashboards

* Include ec2 dashboard in ds

* Do not include ec2 dashboard in beta1

* Display actual region
2019-11-14 10:59:41 +01:00
Sofia Papagiannaki
19dbd27c5c
mysql: fix encoding in connection string (#20192) 2019-11-06 10:54:53 +02:00
Ryan McKinley
92ab4d80f0
Error Handling: support errors and data in a response (#20169) 2019-11-05 15:20:04 -08:00
Borna Skukan
26f377c433 fix: modifying AWS Kafka dimension names to correct ones (#19986) 2019-11-04 09:33:31 +01:00
Sofia Papagiannaki
fc08c26025 WIP: Spawn backend plugins v2 (#19835)
* WIP: Spawn backend plugins v2

* Add test for plugin version

* Fix support for SDK plugins

Co-authored-by: Kyle Brandt <kyle@kbrandt.com>
Co-authored-by: Marcus Olsson <olsson.e.marcus@gmail.com>
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>

* WIP: Draft PR for fork of V2 sdk / bi-directional support (#19890)

* temporary use export-datasource-plugin branch of grafana-plugin-sdk

* fix failing test

* remove debug (spew) lines

* misc cleanup

* add expressions feature toggle

* use latest grafana-plugin-sdk-go
2019-10-24 17:15:27 +02:00
Arve Knudsen
bb50fc5965
pkg/tsdb: Check errors (#19837)
Check errors in pkg/tsdb.
2019-10-22 16:16:53 +02:00
Nils Diefenbach
7a8f2cd75d Cloudwatch: Lowercase Redshift Dimension entry for service class and stage (#19897)
fixes #19761
2019-10-22 10:33:58 +02:00
Weeco
8cd93f0b88 Datasource: Add custom headers on alerting queries (#19508)
* Add custom headers on alerting queries

Reference issue #15381

Signed-off-by: Martin Schneppenheim <martin.schneppenheim@rewe-digital.com>

* Fix datasource transport tests

* Migrate decrypting header test to models pkg

* Check correct header

* Add HTTP transport test

Fixes #15381
2019-10-11 14:28:52 +02:00
Arve Knudsen
b858a5f496
Don't truncate IPv6 addresses (#19573)
* Bugfix: Fix parsing of IPv6 addresses

Make sure that IPv6 addresses aren't truncated when parsing. Fixes #18924
* util: Change network address parsing funcs to return error
* pkg/api: Return NetworkAddress instead of host/port
2019-10-09 08:58:45 +02:00
Anthony Templeton
6c0b5163dd CloudWatch: Changes incorrect dimension wmlid to wlmid (#19679)
Fixes #19476
2019-10-07 23:47:07 +02:00
Chad Nedzlek
20faef8de5 AzureMonitor: Alerting for Azure Application Insights (#19381)
* Convert Azure Application Insights datasource to Go

Allows for alerting of Application Insights data source

Closes: #15153

* Fix timeGrainReset

* Default time interval for querys for alerts

* Fix a few rename related bugs

* Update readme to indicate App Insights alerting

* Fix typo and add tests to ensure migration is happening

* Address code review feedback (mostly typos and unintended changes)
2019-10-07 14:18:14 +02:00
Sriramajeyam
50acb37a17 Azure Monitor : Query more than 10 dimensions ( Fixes #17230 ) (#18693)
* Fixes #17230

* Resovled comments

* Resolved comments

* spell fix
2019-10-03 16:53:11 +02:00
Arve Knudsen
39d8e73412
Chore: Upgrade to Go 1.13 (#19502)
* Chore: Upgrade to Go 1.13

Fixes: #18878

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

* Chore: Upgrade lint tools in order to work with Go 1.13

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

* Chore: Fix Go linting issues

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2019-10-02 13:59:05 +02:00
Sean Nessworthy
404bf2e0dd CloudWatch: Add ap-east-1 to hard-coded region lists (#19523)
* CloudWatch: Add ap-east-1 to hard-coded region lists (#17448)

* CloudWatch: Fix handleGetRegion tests
2019-10-01 14:23:43 +02:00
Marcus Efraimsson
00e7c7c4b7
Testdata: Rename package to circumvent convention in go (#19409)
Before this change the tests for test datasource was not run.
2019-09-27 16:18:24 +02:00
Marcus Efraimsson
3de693af49
MySQL: Limit datasource error details returned from the backend (#19373)
Only return certain mysql errors from backend.
The following errors is returned as is from backend:
error code 1064 (parse error)
error code 1054 (bad column/field selected)
error code 1146 (table not exists)
Any other errors is logged and returned as a generic
error.
Restrict use of certain functions:
Do not allow usage of the following in query:
system_user()
session_user()
current_user() or current_user
user()
show grants

Fixes #19360
2019-09-24 20:50:49 +02:00
Erik Sundell
4dbedb8405 Azure Monitor: Revert support for cross resource queries (#19115)" (#19346)
This reverts commit 88051258e9.
2019-09-24 12:01:12 +02:00
Marcus Efraimsson
19f3ec4891
MySQL, Postgres, MSSQL: Only debug log when in development (#19239)
Found some additional debug statements in relation to #19049 that 
can cause memory issues.

Ref #19049
2019-09-20 15:00:28 +02:00
Franco Papalardo
b8334c14f8 CloudWatch: ContainerInsights metrics support (#18971)
* CloudWatch ContainerInsights support
2019-09-20 12:05:58 +03:00
Kevin Printz
79f8433675 Cloudwatch: Fix autocomplete for Gamelift dimensions (#19145) (#19146) 2019-09-19 08:27:15 +02:00
Marcus Efraimsson
0f524fc947
MSSQL: Revert usage of new connectionstring format (#19203)
This reverts commit 2514209 from #18384. Reason is that it doesn't 
work due to xorm 0.7.1 which doesn't support this new connectionstring 
format.

Fixes #19189
Ref #18384
Ref #17665
2019-09-18 19:30:35 +02:00
Erik Sundell
88051258e9
Azure Monitor: Add support for cross resource queries (#19115)
* Add new query mode picker with different states for each query. Also really simple migration script

* Populate cross resource dropdowns

* Cleanup. Handle change events

* Add multi select picker for subscriptions

* Fix markup issue

* Prepare for new query mode

* More cleanup

* Handle multiple queries both in ds and backend

* Refactoring

* Improve migration

* Add support for multiselect display name

* Use multiselect also for locations and resources

* Add more typings

* Fix migrations

* Custom multiselect built for array of options instead of variables

* Add url builder test

* fix datasource tests

* UI fixes

* Improve query editor init

* Fix brokens tests

* Cleanup

* Fix tslint issue

* Change query mode display name

* Make sure alerting works for single queries

* Friendly error for multi resources

* Add temporary typings
2019-09-17 11:35:40 +02:00
Erik Sundell
4c8f417f18 Stackdriver: Add extra alignment period options (#18909)
* Add more alignment period options

* Remove unnecessary alignment period limit
2019-09-13 10:45:59 +02:00
Brian Gann
9eafc693b2
MSSQL: Fix memory leak when debug enabled (#19049)
* fix for #19049
2019-09-12 18:44:31 +02:00
Kyle Brandt
e5bf3027fc
Refactor: Move sql_engine to sub package of tsdb (#18991)
this way importing the tsdb package does not come with xorm dependencies
2019-09-10 15:50:04 -04:00
Ryan McKinley
e6fbf358c8
TestData: attach labels to series results (#18653) 2019-08-21 07:50:13 -07:00
Elykov Alexandr
2514209083 MSSQL: Change connectionstring to URL format to fix using passwords with semicolon (#18384)
Fixes #17665
2019-08-05 18:40:33 +02:00
Alexander Berger
4e1e220962 CloudWatch: Fix alerting for queries with Id (using GetMetricData) (#17899)
This commit addresses half of #13749 by making sure GetMetricData 
works for alerting. Math Expressions (compound metrics) will still not 
work for alerting, this would require a bigger refactoring of Grafana's 
alerting service. However, with this commit at least alerting for basic 
metrics with non empty query Id will work.

Fixes half of #13749
2019-08-05 17:28:09 +02:00
Raphael Couto
bc0da1bbfc Plugin: AzureMonitor - Reapply MetricNamespace support (#17282)
* Reapply MetricNamespace support

* Fixing tests

* refactor: move metricnamespace param to backend

* refactor: remove unused function

* azuremonitor: migration for new metric namespace field

* azuremonitor: add template query for metric namespace with a sub

* docs: template queries for azure monitor

Adds new lines for the metricnamespace template function and fixes
some messed up lines
2019-07-20 01:43:52 +02:00
Kyle Brandt
7cac393ddc
datasource: testdata - add predicatable csv wave scenario (#18183) 2019-07-18 13:36:22 -04:00
Kyle Brandt
ed099d5ca0
datasource: testdata - add predictable pulse scenario (#18142)
Adds pulse waveform. Is predictable in the sense that the start of the waveform is aligned to epoch time (instead of the start of the query time). This makes a useful signal for manual testing of alerting in the devenv.
2019-07-17 15:48:08 -04:00
Oleg Gaidarenko
75fa1f0207 Metrics: use consistent naming for exported variables (#18134)
* Metrics: remove unused metrics

Metric `M_Grafana_Version` is not used anywhere, nor the mentioned
`M_Grafana_Build_Version`. Seems to be an artefact?

* Metrics: make the naming consistent

* Metrics: add comments to exported vars

* Metrics: use proper naming

Fixes #18110
2019-07-16 16:58:46 +02:00
Daniel Lee
7e95ded164
AzureMonitor: remove duplicate query logic on the frontend (#17198)
* feat: AzureMonitor implements legend key on backend

To be able to remove the duplicated query logic on the
frontend, the backend code needs to implement alias
patterns for legend keys as well as allowing the default
list of allowed time grains to be overridden. Some metrics
do not support all the time grains and the auto timegrain
calculation can be incorrect if the list is not overridden.

* feat: AzureMonitor - removes duplicate query logic on frontend

* AzureMonitor small refactoring

Extracted method and tidied up the auto time grain
code.

* azuremonitor: support for auto time grains for alerting

Converts allowed timegrains into ms and saves in dashboard json.
This makes queries for alerting with an auto time grain work in
the same way as the frontend.

* chore: typings -> implicitAny count down to 3413

* azuremonitor: add more typings
2019-07-04 22:47:24 +02:00
Oleg Gaidarenko
caa1314f44
Build: use golangci-lint as a make command (#17739)
* Build: use golangci-lint as a make command

* Since gometalinter was deprecated in favor of golangci-lint so it was
  replaced by it. Responsibilities held by the gometalinter was moved to
  golangci-lint

* There was some changes in implementation (that was also mentioned in
  the code comment) between the tools, which uncovered couple errors
  in the code. Those issues were either solved or disabled by
  the inline comments

* Introduce the golangci-lint config, to make their
  configuration more manageable

* Build: replace backend-lint.sh script with make
2019-07-02 16:06:59 +03:00
Marcus Efraimsson
5713048f48
Alerting: Improve alert rule testing (#16286)
* tsdb: add support for setting debug flag of tsdb query

* alerting: adds debug flag in eval context

Debug flag is set when testing an alert rule and this debug
flag is used to return more debug information in test aler rule
response. This debug flag is also provided to tsdb queries so
datasources can optionally add support for returning additional
debug data

* alerting: improve test alert rule ui

Adds buttons for expand/collapse json and copy json to clipboard,
very similar to how the query inspector works.

* elasticsearch: implement support for tsdb query debug flag

* elasticsearch: embedding client response in struct

* alerting: return proper query model when testing rule
2019-06-25 08:52:17 +02:00
Oleg Kovalov
6a76a92aff Prometheus: Preallocate data for Prometheus backend response parsing (#17490) 2019-06-10 08:12:46 +02:00
Utkarsh Bhatnagar
a9da7b5f1f Cloudwatch: Add AWS DocDB metrics (#17241)
Closes #16535
2019-06-05 08:49:48 +02:00
Bernard Duggan
a0bb01103e MySQL/Postgres/MSSQL: Add parsing for day, weeks and year intervals in macros (#13086)
closes #11431
2019-05-30 09:58:29 +02:00
Daniel Lee
fa9ffe38d2
Azuremonitor: multiple subscription support for alerting (#17195)
* fix: azuremonitor adds multi-sub support to alerting

* fix: AzureMonitor missing parameter in metadata func

getMetricMetadata function when called in the query ctrl
was missing a parameter for Subscription Id.

Also, made some tweaks to what happens when a chained
dropdown is changed to not reset all the fields that
are dependent on it.
2019-05-21 12:28:30 +02:00
Marcus Efraimsson
3b008d06b4
testdata: logs scenario (#17182)
Adds logs scenario which is quite basic and not that smart 
to begin with. This will hopefully ease development of 
Explore and support for logs in Grafana.
2019-05-21 09:21:59 +02:00
zhulongcheng
2fff8f77dc move log package to /infra (#17023)
ref #14679

Signed-off-by: zhulongcheng <zhulongcheng.me@gmail.com>
2019-05-13 08:45:54 +02:00
Marcus Efraimsson
32a45077e7
Elasticsearch: Fix pre-v7.0 and alerting error (#16904)
This fixes a regression introduced in #16646 where using Elasticsearch 
pre-v7.0 and alerting resulted in an error when trying to deserialize the 
response of total number of hits.
Total number of hits is not in use by the backend so we're removing it 
for now to make ES 6 and 7 being able to deserialize search responses 
without errors.

Closes #15622
2019-05-06 15:12:18 +02:00
Mark Goodwin
44e6da6b41 build: fix integer overflow in pkg/tsdb tests on 32bit platforms (#16818)
Several pkg/tsdb tests fail to compile on 32bit platforms due to
integer overflow.
2019-05-06 09:27:45 +02:00
Stephen SORRIAUX
3866839b19 Datasources: add support for POST HTTP verb for InfluxDB (#16690)
A new parameter `queryMode` is added to the InfluxDB datasource to provide a way to use POST instead of GET when querying the database. This prevents to get any error when querying the database with a heavy request.
Default configuration is kept to GET for backward compatibility. Tests and documentation have been added for this new behaviour.
2019-05-02 15:30:37 +02:00
Ryan McKinley
470634e2d6
Streaming: support streaming and a javascript test datasource (#16729) 2019-04-25 14:01:02 -04:00
Alcides Viamontes E
cff2be0d66 elasticsearch: add 7.x version support (#16646)
Adds a new version option 7.0+ (70 internally).
Version 7.0+ doesn't include document types in index mappings 
so support for handling this have been added.
Version 7.0+ returns number of hits in a different way so 
support for handling this have been added.
Version 7.0+ doesn't support sending 
max_concurrent_shard_requests in multisearch header so 
support for sending this in query string have been added.
Update elastic6 docker block and dashboards (devenv) to use 
6.7.1 images, filebeat index name is now filebeat-YYYY.MM.DD 
and dashboard include correct tags and links.
Add elastic7 docker block and provisioning (devenv).
Updates documentation regarding new version.

Closes #15622
2019-04-25 09:41:13 +02:00
Utkarsh Bhatnagar
89a01a680c CloudWatch: Use default alias if there is no alias for metrics (#16732)
Fixes #16605
2019-04-24 10:00:02 +02:00
Oleg Gaidarenko
54c1bf0cc9
Chore: a bit of spring cleaning (#16710)
* Chore: use early return technic everywhere

And enable "indent-error-flow" revive rule

* Chore: remove if-return rule from revive config

* Chore: improve error messages

And enable "error-strings" revive rule

* Chore: enable "error-naming" revive rule

* Chore: make linter happy

* Chore: do not duplicate gofmt execution

* Chore: make linter happy

* Chore: address the pull review comments
2019-04-23 11:24:47 +03:00
Carl Bergquist
e4eb0817e4 Cloudwatch: fix for flaky tests (#16649)
The iteration order over maps is not specified and is not guaranteed
to be the same from one iteration to the next. If a map entry that
has not yet been reached is removed during iteration, the corresponding
iteration value will not be produced. If a map entry is created during
iteration, that entry may be produced during the iteration or may be skipped.
The choice may vary for each entry created and from one iteration to
the next. If the map is nil, the number of iterations is 0.

https://golang.org/ref/spec#For_range
2019-04-17 19:06:32 +02:00
Carl Bergquist
3f136e0da9
tech: replace bmizerany/assert with stretchr/testify (#16625)
bmizerany is old and unsupported. so we are replacing it
with stretchr which is an drop in replacement and something
we want to use more in Grafana.
2019-04-17 10:25:58 +02:00
Mitsuhiro Tanda
864a6262fe CloudWatch: GetMetricData refactoring & fix label handling (#16383)
* fix label handling

* SEARCH() results could have multiple namespace, remove from legend

* divide GetMetricStatistics related code

* divide GetMetricData related code

* divide parseGetMetricDataResponse()

* divide parseGetMetricDataQuery()

* divide test code

* add test for GetMetricData

* add test for GetMetricData parse response

* fix bug of terminating gap

* fix gofmt
2019-04-15 17:55:07 +02:00
Andrej Ocenas
66f6e16916
Security: Store datasource passwords encrypted in secureJsonData (#16175)
* Store passwords in secureJsonData

* Revert unnecessary refactors

* Fix for nil jsonSecureData value

* Remove copied encryption code from migration

* Fix wrong field reference

* Remove migration and provisioning changes

* Use password getters in datasource proxy

* Refactor password handling in datasource configs

* Add provisioning warnings

* Update documentation

* Remove migration command, moved to separate PR

* Remove unused code

* Set the upgrade version

* Remove unused code

* Remove double reference
2019-04-15 11:11:17 +02:00
Andrej Ocenas
08ce7f6c93
Chore: Add task to find FocusConvey tests (#16381) 2019-04-04 14:48:11 +02:00
The Rock Guy
335aa7c9f2 CloudWatch: Update AWS/IoT metric and dimensions (#16337)
Closes #16334
2019-04-04 12:54:20 +02:00
Floyd May
33d1d427bc InfluxDB: Fix tag names with periods in alerting (#16255)
Updates regex to match tag names with periods when generating
series names in alerting evaluation (backend).

Fixes #9148
2019-03-27 23:13:12 +07:00
Marcus Efraimsson
6b8e3122f8
chore(influx): no point of reading response when bad status (#16212)
There's no point in reading the body response without using
the result so removing it.

Fixes #9199
Ref #16207
2019-03-26 12:10:24 +07:00
Ramon Carvalho Maciel
d791a6211d fix(InfluxDB): Reads body and close request body even for error status codes (#16207) 2019-03-25 17:42:26 +01:00
Mitsuhiro Tanda
4d8eb76dca update cloudwatch metrics/dimensions list 2019-03-22 00:08:17 +09:00
Mitsuhiro Tanda
56251ca546 Update CloudWatch metrics/dimension list (#16102)
update cloudWatch metrics/dimension list
2019-03-21 11:13:06 +01:00
ryan
bd811b4a95 dont test exists in the test... it will fail if not found 2019-03-15 12:36:55 -07:00
ryan
24ead3a4a4 add random_walk_table scenario 2019-03-15 12:33:45 -07:00
ryan
2b5ac6bafa add test file 2019-03-15 11:07:20 -07:00
ryan
e787176bca add startAt to random walk scenario 2019-03-15 11:02:41 -07:00
Andrej Ocenas
09b9b595b2 Add check for Env before log 2019-03-15 11:53:30 +01:00
bergquist
f13263eb54 reduce loglevel to debug 2019-03-13 09:01:45 +01:00
Torkel Ödegaard
90a3bc2203
Merge pull request #15892 from sandlis/14706-es-weekly-pattern-fix
Fix: #14706 Incorrect index pattern padding in alerting queries
2019-03-11 11:01:22 +01:00
Torkel Ödegaard
3f574d3e57
Merge pull request #15685 from utkarshcmu/fix-#15562
Fixed alias in Cloudwatch Expressions
2019-03-11 10:49:30 +01:00
Bryan T. Richardson
ae23773db3 Added MaximumUsedTransactionIDs metric to list of AWS RDS metrics. 2019-03-04 07:38:36 -07:00
sandeep
e04218e550 Fix: #14706 Incorrect index pattern padding in alerting queries
When weekly index pattern is used, indices names contain single digit week number for week 1-9
This fix makes sure indice names always contain 2 digit week number for weekly pattern
2019-03-03 18:10:38 +05:30
utkarshcmu
37033080b7 Removed commented code 2019-02-27 00:33:40 -08:00
utkarshcmu
8ef3aebc29 Fixed alias in Cloudwatch Expressions 2019-02-27 00:20:29 -08:00
Carl Bergquist
0aa61c8e12
Merge pull request #15629 from bergquist/moves_metrics_to_infra
moves metric package to /infra
2019-02-25 02:44:09 +01:00
bergquist
8a3a3cccc3 moves metric package to /infra
ref #14679
2019-02-24 21:12:51 +01:00
Daniel Lee
d1e249a803 stackdriver: fix for float64 bounds for distribution metrics
Adds support for explicit distribution metrics and float64 bounds

Fixes #14509
2019-02-24 17:37:26 +01:00
z0029c4
13974cdd28 added support for influxdb non_negative_difference function in tsdb 2019-02-13 18:12:35 +05:30
z0029c4
8cb1e5b918 added support for influxdb non_negative_difference function in tsdb for alerting 2019-02-13 17:55:31 +05:30
Daniel Lee
1c364b57b5
Merge pull request #15353 from grafana/14623-azure-monitor-alerting
Adds alerting for the Azure Monitor API in the Azure Monitor datasource
2019-02-11 15:16:32 +01:00
Daniel Lee
ac345312a4 azuremonitor: don't use make for maps and array 2019-02-11 14:42:12 +01:00
Daniel Lee
0b74860f55 azuremonitor: fix auto interval calculation on backend
Not needed for alerting (as the query intervalms will always be 0) but needed
later when being called from the frontend)
2019-02-11 13:27:08 +01:00
Daniel Lee
a54484638d interval: make the FormatDuration function public
A useful function that was ported from kbn.ts and can be used
to convert milliseconds into a kbn unit
2019-02-11 11:25:51 +01:00
Marcus Efraimsson
75f89ecf1f
Merge pull request #14888 from bugficks/8570-mysql-ssl-datasource
MySQL SSL CA in datasource connector
2019-02-11 09:00:18 +01:00
Daniel Lee
d6904ba9b4 azuremonitor: small refactoring 2019-02-11 01:22:15 +01:00
Daniel Lee
60327953a2 azuremonitor: handles timegrain set to auto on backend 2019-02-11 01:17:37 +01:00
Daniel Lee
452c4f5b9b azuremonitor: add test for dimension filter 2019-02-10 01:47:38 +01:00
Daniel Lee
b94de101cd azuremonitor: refactor azure monitor api code into own file 2019-02-10 01:18:16 +01:00
Daniel Lee
b816f35c41 azuremonitor: handle multi-dimensions on backend 2019-02-10 00:23:12 +01:00
Daniel Lee
a5e5db20e1 azuremonitor: add support for aggregations on backend 2019-02-09 21:52:44 +01:00
Connor Patterson
d2aed7e075 Fix formatting 2019-02-09 14:13:15 -05:00
Connor Patterson
2987a47a9b Add aws ec2 api metrics for cloudwatch 2019-02-09 13:47:08 -05:00
Daniel Lee
10194df112 azuremonitor: simple alerting for Azure Monitor API
Lots of edge cases and functionality left to implement but
a simple query works for alerting now.
2019-02-08 18:15:17 +01:00
Marcus Efraimsson
1bc2a0af70
use unique datasource id when registering mysql tls config 2019-02-08 18:08:07 +01:00
Daniel Lee
0e228d582d azuremonitor: builds a query and sends it to Azure on the backend
Lots of edge cases not covered and the response is not parsed. It only
handles one service and will have to be refactored to handle multiple
2019-02-08 17:20:31 +01:00
Marcus Efraimsson
e87ff5a06d
Merge pull request #15265 from larsjoergensen/cloudwatch/add-rds-aurora-serverlessdatabasecapacity-metrics
Added ServerlessDatabaseCapacity metric to list of AWS RDS metrics.
2019-02-05 21:56:11 +01:00
Lars Jørgensen
749320002b Added ServerlessDatabaseCapacity metric to list of AWS RDS metrics. 2019-02-05 20:57:51 +01:00
jeroenvollenbrock
28aafcd789 cloudwatch: Add tests for resource_arn template query 2019-02-05 18:37:05 +01:00
jeroenvollenbrock
fa977ce090 cloudwatch: Add resource_arns template query function
Implements feature request #8207
2019-02-05 18:37:04 +01:00
Marcus Efraimsson
d433ca7d40
fix util for splitting host and port
Now you can provide both a default host and a default port
2019-02-04 13:10:32 +01:00
Connor Patterson
48c8ff8899 Add AWS/Neptune to metricsMap and dimensionsMap 2019-02-03 16:29:35 -05:00
Daniel Lee
782c4eae98
Merge pull request #15127 from challengerdeep/fix-stackdriver-aggparams-reducer
Change primaryAggregation to crossSeriesReducer in Stackdriver
2019-01-30 00:45:22 +01:00
Torkel Ödegaard
416562bd90
Merge pull request #15102 from mjtrangoni/fix-golint-issues
Fix golint issues
2019-01-29 21:12:34 +01:00
Robert Edström
9b6746d808 Change primaryAggregation to crossSeriesReducer in Stackdriver 2019-01-29 19:11:54 +01:00
Mario Trangoni
8261613b51 pkg/util/{ip.go,url.go}: Fix some golint issues
See,
$ gometalinter --vendor --deadline 10m --disable-all --enable=golint  ./...
ip.go:8:6⚠️ func SplitIpPort should be SplitIPPort (golint)
url.go:14:6⚠️ func NewUrlQueryReader should be NewURLQueryReader (golint)
url.go:9:6⚠️ type UrlQueryReader should be URLQueryReader (golint)
url.go:37:6⚠️ func JoinUrlFragments should be JoinURLFragments (golint)
2019-01-28 22:29:20 +01:00
Marcus Efraimsson
7023c957d7
Merge branch 'master' into nanosecond-postgresql 2019-01-28 20:04:46 +01:00
Marcus Efraimsson
f157c19e16
extract parsing of datasource tls config to method 2019-01-28 19:38:56 +01:00
Vlad Ellis
c208186f26 Parse database host correctly when using IPv6 2019-01-25 21:56:19 +00:00
bugficks
f31fe495e9 fix go fmt 2019-01-15 13:54:25 +01:00
bugficks
7db848f153 [Feature request] MySQL SSL CA in datasource connector
https://github.com/grafana/grafana/issues/8570
2019-01-15 13:29:56 +01:00
Marcus Efraimsson
130e4aa666
Merge pull request #14608 from marefr/es_bucket_script
Fix support bucket script pipeline aggregations
2019-01-14 15:58:42 +01:00
jaken551
64163f0198 14722 - removing unnecessary arn check that breaks assume role feature in other AWS partitions 2019-01-06 15:21:58 -05:00
Ander Arguiñano
089d85af63 Added macros to mysql 2019-01-03 22:29:57 +01:00
Ander Arguiñano
3801a75131 FIxed syntaxis mistake unixEpochNanoFrom and unixEpochNanoTo 2019-01-03 22:25:10 +01:00
Ander Arguiñano
ed6782402b Merge remote-tracking branch 'upstream/master' into nanosecond-postgresql 2019-01-03 21:48:10 +01:00
Ander Arguiñano
b4eac406d5 Added previous macros to mssql 2019-01-03 21:43:08 +01:00
Ander Arguiñano
9105625f24 Added unixEpochNanoTo and unixEpochNanoFrom macros to postgresql 2019-01-03 21:31:47 +01:00
Ander Arguiñano
4d8d2a9690 Renamed unixEpochFilterNano to unixEpochNanoFilter 2019-01-03 20:40:17 +01:00
Sven Klemm
4c51e8df20 Don't cut off subsecond precision for postgres macros
Change time format to RFC3339Nano for $__timeFilter, $__timeFrom and
$__timeTo macros
2019-01-02 23:38:09 +01:00
Ander Arguiñano
1a67a8db80 Nanosecond timestamp support postgresql 2019-01-02 23:00:21 +01:00
Clément MATHIEU
c29c9d1664 Add support for InfluxDB's time zone clause (backend) 2018-12-21 16:49:01 +01:00
Marcus Efraimsson
b45f72a140
elasticsearch: support bucket script pipeline aggregations 2018-12-20 01:24:36 +01:00
Marcus Efraimsson
c46d01dc83
Merge pull request #14090 from marefr/8843_pipeline_doc_count
Fix pipeline aggregations on doc count
2018-12-12 13:21:13 +01:00
Scott Glajch
62a5cd27ba Add the AWS/SES Cloudwatch metrics of BounceRate and ComplaintRate. Pull request #14399 2018-12-07 16:42:29 -05:00
Carl Bergquist
3c330c8e4c
Merge pull request #14317 from mjtrangoni/fix-misspell-issues
pkg/*: Fix misspelling issues using locale US
2018-12-05 10:34:28 +01:00
Mario Trangoni
fadd816d89 pkg/*: Fix misspell issues
See,
$ find . -type f | xargs misspell -locale US | grep -vi -e vendor -e devenv -e Unknwon -e Destory | grep pkg
./pkg/services/sqlstore/org_test.go:190:15: "frome" is a misspelling of "from"
./pkg/tsdb/elasticsearch/response_parser.go:544:24: "Unkown" is a misspelling of "Unknown"
./pkg/tsdb/opentsdb/opentsdb.go:87:20: "marshalling" is a misspelling of "marshaling"
./pkg/components/dynmap/dynmap_test.go:2:7: "Licence" is a misspelling of "License"
./pkg/components/dynmap/dynmap.go:2:7: "Licence" is a misspelling of "License"
2018-12-04 23:29:34 +01:00
Tom Nitti
1e53c12921 added support for influxdb cumulative_sum function in tsdb 2018-12-04 12:46:50 -06:00
Marcus Efraimsson
acb45867f8
Merge pull request #14179 from mattiarossi/master
Add support for offset in date histogram aggregation
2018-12-03 05:43:42 -08:00
Marcus Efraimsson
624e5e5b3d
let each sql datasource handle timeFrom and timeTo macros 2018-11-30 14:30:02 +01:00
Matthew Coltman
bbd0ec3a8b Add AWS/CodeBuild namespace for CloudWatch datasource 2018-11-29 21:02:44 +01:00
Mattia Rossi
ce74b1ddc2 Requested Backend changes, removed link in popover description for the offset field 2018-11-27 03:42:20 -05:00
Mattia Rossi
f6fc7f7b64 Requested Backend changes, added details to popover description for the offset field 2018-11-26 08:58:25 -05:00
Marcus Efraimsson
a022284cb0
fix handle of elasticsearch 6.0+ version 2018-11-23 15:24:16 +01:00
Marcus Efraimsson
3534762f49
cloudwatch: handle invalid time ranges 2018-11-21 17:51:02 +01:00
Marcus Efraimsson
879aed7d06
cloudwatch: recover/handle panics when executing queries 2018-11-21 17:49:17 +01:00
Javier
0900470dda Add Cloudwatch/CloudHSM Metrics and dimensionMaps 2018-11-19 18:10:34 +01:00
Marcus Efraimsson
9a8ad70013
fix pipeline aggregations on doc count 2018-11-15 19:06:47 +01:00
Mario Trangoni
e351e6e211 pkg/tsdb/influxdb/influxdb.go: Fix surrounding loop is unconditionally terminated.
See,
$ gometalinter --vendor --deadline 6m --disable-all --enable=megacheck ./...
pkg/tsdb/influxdb/influxdb.go:106:3⚠️ the surrounding loop is unconditionally terminated (SA4004) (megacheck)
2018-11-09 19:40:07 +01:00
Torkel Ödegaard
dcb5015022
Merge pull request #13951 from marefr/11977_6x_terms
Fix terms agg order deprecation warning on es 6+
2018-11-07 20:47:41 +01:00
Zac Coffy
9cce0f553a Adding Cloudwatch AWS/Connect metrics and dimensions 2018-11-05 13:15:03 -05:00
Marcus Efraimsson
5803bfd2c7
fix terms agg order deprecation warning on es 6+ 2018-11-02 17:53:47 +01:00
Marcus Efraimsson
6052257515
Merge pull request #13820 from grafana/13769_mysql_time_filter
mysql: fix timeFilter macro should respect local time zone
2018-10-26 09:02:59 +02:00
Mitsuhiro Tanda
220c4f4ab4 add test 2018-10-26 03:13:02 +09:00
Mitsuhiro Tanda
3447b8b299 cache region result 2018-10-26 01:23:44 +09:00
Mitsuhiro Tanda
c40baa1a23 use default region to call DescribeRegions 2018-10-26 01:23:44 +09:00
Torkel Ödegaard
d505d83ee1
Merge pull request #13679 from mjtrangoni/fix-megacheck-issues
Fix megacheck issues
2018-10-25 16:31:53 +02:00
Marcus Efraimsson
97b22aa5a9
mysql: fix timeFilter macro should respect local time zone 2018-10-25 10:29:40 +02:00
Erik Sundell
c5af0bf1c5 Resource type filter (#13784)
* stackdriver: add resource type to filter and group bys

* stackdriver: remove not used param

* stackdriver: refactor filter and group by code

* stackdriver: remove resource type if its already in filter list

* stackdriver: remove debug logging

* stackdriver: remove more debug logging

* stackdriver: append resource type to legend name if there are more than one type present in the response

* stackdriver: only make new request if filter has real value

* stackdriver: format legend support for resource type

* stackdriver: add resource type to documentation

* stackdriver: not returning promise from query function

* stackdriver: fix refactoring bug

* stackdriver: remove not used import
2018-10-24 11:18:49 +02:00
Mario Trangoni
91447dcbf9 pkg/tsdb/stackdriver/stackdriver.go: Fix regular expression does not contain any meta characters.
See,
$ gometalinter --vendor --deadline 10m --disable-all --enable=megacheck ./...
pkg/tsdb/stackdriver/stackdriver.go:171:26⚠️ regular expression does not contain any meta characters (SA6004) (megacheck)
2018-10-23 17:26:47 +02:00
Mario Trangoni
bb12a1bc99 pkg/tsdb/graphite/graphite.go: Fix regular expression does not contain any meta characters.
I found this article benchmarking Replace vs Regexp,
https://medium.com/codezillas/golang-replace-vs-regexp-de4e48482f53

See,
$ gometalinter --vendor --deadline 10m --disable-all --enable=megacheck ./...
pkg/tsdb/graphite/graphite.go:167:28⚠️ regular expression does not contain any meta characters (SA6004) (megacheck)
pkg/tsdb/graphite/graphite.go:172:28⚠️ regular expression does not contain any meta characters (SA6004) (megacheck)
2018-10-23 17:26:46 +02:00
Erik Sundell
6abbf5b3b8 stackdriver: refactoring request builder 2018-10-22 16:12:55 +02:00
Erik Sundell
1756e82d8b stackdriver: remove not used struct 2018-10-22 16:12:55 +02:00
Erik Sundell
5b04a8b6c2 stackdriver: remove not used query file 2018-10-22 16:11:17 +02:00
Erik Sundell
1a329e4e47 stackdriver: remove test datasource query. use ensuredefaultproject instead 2018-10-22 16:11:17 +02:00
Erik Sundell
b02a8127ff stackdriver: remove debug comments 2018-10-22 16:11:17 +02:00
Erik Sundell
b2c6c743ce stackdriver: add debug logging 2018-10-22 16:11:17 +02:00
Erik Sundell
3999578300 stackdriver: fix broken braces 2018-10-22 16:11:17 +02:00
Erik Sundell
3935f9d24c stackdriver: use constant instead of variable 2018-10-22 16:11:17 +02:00
Erik Sundell
8b4fff8b87 stackdriver: use gce variable 2018-10-22 16:11:17 +02:00
Erik Sundell
4a51d05477 stackdriver: add variable for gce authentication type 2018-10-22 16:11:17 +02:00
Erik Sundell
b9cb4649bb stackdriver: get default project from backend. also ensure default project could be retrieved when authentication type is gce 2018-10-22 16:11:17 +02:00
Erik Sundell
cd7b454e25 stackdriver: add default value for authentication type 2018-10-22 16:03:14 +02:00
Erik Sundell
823838a839 stackdriver: wip - remove debug code 2018-10-22 16:03:14 +02:00
Erik Sundell
0b82fda49c stackdriver: only get default token from metadata server when applying route 2018-10-22 16:03:14 +02:00
Erik Sundell
dd9e9ed419 stackdriver: make backend query a pure test datasource function 2018-10-22 16:03:13 +02:00
Erik Sundell
9c7022be86 stackdriver: add status code 2018-10-22 16:03:13 +02:00
Erik Sundell
412a1f6d99 stackdriver: wip - return metric descriptors in the format of tablew 2018-10-22 16:03:13 +02:00
Erik Sundell
ff5f281508 stackdriver: wip - get metric descriptors in the backend 2018-10-22 16:03:13 +02:00
Erik Sundell
60617d0bf7 stackdriver: wip - add logic for retrieving token from gce metadata server in the auth provider 2018-10-22 16:03:13 +02:00
Erik Sundell
102f531c1e stackdriver: break out project name resolving into its own function in the stackdriver.go file 2018-10-22 16:03:12 +02:00
Erik Sundell
df215d9d09 stackdriver: WIP - test retrieving project id from gce metadata 2018-10-22 16:03:12 +02:00
Marcus Efraimsson
77f23018a5
Merge pull request #13684 from mtanda/cw_concurrent_map
fix concurrent map writes
2018-10-18 13:41:39 +02:00
Marcus Efraimsson
1d0dee189c
Merge pull request #13705 from Yukinoshita-Yukino/master
Add socket support for mysql data source
2018-10-18 09:45:50 +02:00