Commit Graph

370 Commits

Author SHA1 Message Date
Arve Knudsen
07582a8e85
Chore: Fix various spelling errors in back-end code (#25241)
* Chore: Fix various spelling errors in back-end code
Co-authored-by: Sofia Papagiannaki <papagian@users.noreply.github.com>
Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>>
2020-06-01 17:11:25 +02:00
Mario Trangoni
5116420e9a
Fix misspell issues (#23905)
* Fix misspell issues

See,
$ golangci-lint run --timeout 10m --disable-all -E misspell ./...

Signed-off-by: Mario Trangoni <mjtrangoni@gmail.com>

* Fix codespell issues

See,
$ codespell -S './.git*' -L 'uint,thru,pres,unknwon,serie,referer,uptodate,durationm'

Signed-off-by: Mario Trangoni <mjtrangoni@gmail.com>

* ci please?

* non-empty commit - ci?

* Trigger build

Co-authored-by: bergquist <carl.bergquist@gmail.com>
Co-authored-by: Kyle Brandt <kyle@grafana.com>
2020-04-29 21:37:21 +02:00
Andrej Ocenas
e5dd7efdee
Provisioning: Allows specifying uid for datasource and use that in derived fields (#23585)
* Add uid to datasource

* Fix uid passing when provisioning

* Better error handling and Uid column type change

* Fix test and strict null error counts

* Add backend tests

* Add tests

* Fix strict null checks

* Update test

* Improve tests

* Update pkg/services/sqlstore/datasource.go

Co-Authored-By: Arve Knudsen <arve.knudsen@gmail.com>

* Variable rename

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-04-20 15:48:38 +02:00
Carl Bergquist
754dfdfa87
Lower log level for some startup logs statements (#23517) 2020-04-14 12:18:45 +02:00
Arve Knudsen
5645d74cbc
Server: Exit with 0 if no error (#23312)
Make grafana-server exit with 0 if no error occurred.
2020-04-03 11:34:18 +02:00
Carl Bergquist
766d8a5888
avoid aliased import in cli (#22566) 2020-03-04 13:18:13 +01:00
Arve Knudsen
eb98d9c15b
grafana-cli: Upgrade to urfave/cli v2 (#22402)
* grafana-cli: Upgrade to urfave/cli v2
2020-02-26 12:27:31 +01:00
Marcus Efraimsson
79c0fa4ca5
CLI: Return error and aborts when plugin file extraction fails (#20849)
Return error and aborts when plugin file extraction fails.
If file is in use, a somewhat user-friendly message is returned.

Fixes #20841
2019-12-04 12:48:40 +01:00
Sofia Papagiannaki
b16cb92b32 Chore: Improve grafana-server profiling and tracing (#20593)
Profiling and tracing can now be enabled/disabled separately.
Adds argument for trace file path.
Support overriding profiling and tracing argument using 
environment variables.
Update docs.

Fixes #20576
2019-11-25 09:40:10 +01:00
Arve Knudsen
82f4fc2783
Fail when server is unable to bind port (#20409)
* Server: Return error when unable to bind port
* Server: Exit if a service fails
* Build: Remove graceful kill from Bra config
2019-11-18 09:49:08 +01:00
Olivier Lemasle
b4712ec4b9 CLI: Reduce memory usage for plugin installation (#19639)
* grafana-cli: use tmp file when downloading plugin install file
2019-11-06 13:42:58 +01:00
Arve Knudsen
35e0e078b7
pkg/util: Check errors (#19832)
* pkg/util: Check errors
* pkg/services: DRY up code
2019-10-23 10:40:12 +02:00
Arve Knudsen
573e78feeb
pkg/cmd: Check errors (#19700)
* pkg/cmd: Check errors
* pkg/cmd: Make sure server waits on services, even in case of error
* pkg/cmd: Inform of error to show help
* pkg/cmd: Only warn on failure to send systemd notification
* pkg/cmd: Don't log errors stemming from context cancelation
* pkg/cmd: Don't fail if unable to write to systemd
2019-10-15 16:44:15 +02:00
Marcus Olsson
428ca600c0
Chore: Refactor grafana-server (#19796)
* Rename GrafanaServerImpl to Server

* Make flag dependencies explicit

* Extract method for building service graph

* Document and clarify methods

* Rename HttpServer to HTTPServer
2019-10-14 14:18:22 +02:00
Andrej Ocenas
3866814ea9
CLI: Fix version selection for plugin install (#19498) 2019-09-30 15:34:09 +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
2acffbeb10
CLI: Fix installing plugins on windows (#19061)
Fixes #19022
2019-09-13 18:12:52 +02:00
Leonard Gram
c675449aa2
cli: fix for recognizing when in dev mode. (#18334) 2019-08-02 09:38:41 +02:00
Andrej Ocenas
8c49d27705
CLI: Allow installing custom binary plugins (#17551)
Make sure all data is sent to API to be able to select correct archive version.
2019-07-29 10:44:58 +02:00
Marcus Efraimsson
6a3a2f5f94
CLI: Fix encrypt-datasource-passwords fails with sql error (#18014)
Now handles secure_json_data stored as null in database when
running the encrypt-datasource-passwords migration.

Fixes #17948
2019-07-10 12:28:40 +02:00
Ryan McKinley
81ff856568
grafana-cli: allow installing plugins from a local zip file (#18021) 2019-07-10 00:40:33 -07:00
gotjosh
2fb45eeec8
Grafana-CLI: Wrapper for grafana-cli within RPM/DEB packages and config/homepath are now global flags (#17695)
* Feature: Introduce a grafana-cli wrapper

When our users install the *nix packed version of grafana, tendency is to use the services and scripts installed as part of the package for grafana-server. These leverage the default configuration options by specifying the several default paths.

This introduces a similar approach for the grafana-cli binary. We exposed it through a wrapper to ensure a proper configuration is in place. To enable that, we add the .real suffix to the original binary (grafana-cli.real) and then use a bash script named grafana-cli as the wrapper.

* Make the config and homepath flags global

* Introduce `configOverrides` as a global flag

This flag allows us to pass configuration overrides as a string.

The string follows the convention of configuration arguments separated by a space e.g. "cfg:default.paths.data=/dev/nullX cfg:default.paths.logs=/dev/nullX"

Also, it is backwards compatible with similar the previous configuration method through tailing arguments. Tailing arguments take presedence over the configuration options string.

* Only log configuration information in debug mode

* Move the grafana-cli binary to $GRAFANA_HOME/bin

As part of the package install process, we copy all the release files and
directories into the grafana home directory. This includes the /bin folder
from where we copied the binaries into their respective destinations.
After that, the /bin folder gets deleted as we don't want to keep
duplicates of the binaries around.

As part of this commit, we moved the re-creation of /bin within
grafana-home and the copy of the original binary (again) after the
folder gets deleted.
2019-06-24 20:20:21 +01:00
gotjosh
7d68d6ede2
grafana-cli: Fix receiving flags via command line (#17617)
`grafana-cli` uses the third-party library to define the flags and not
the standard library. Using `flag.Parse` conflicts with the defined
flags from our third-party library.

In the case where `flag.Parse` is used, the CLI assumes that definitions
provided are not needed and will not define them; producing errors of
the kind `flag provided but not defined --example-flag`.

Using the context to read any arguments (including flags) is the
recommended approach by the third-party library.
2019-06-18 10:25:37 +01:00
gotjosh
6fbca90269
cli: grafana-cli should receive flags from the command line (#17606)
grafana-cli should allow configuration overrides to be received from the command line. e.g.

```
grafana-cli admin reset-password cfg:default.paths.logs=custom/log/directory/
```

Seems like we missed the inclusion of `flag.Parse` as we run the command,  to be able to consume them.

Additionally, it'll be useful for the user to know whenever these are being overriden or not - hence the addition of logging the configuration to be used as we run the command.
2019-06-17 11:27:26 +01:00
Marcus Efraimsson
e1df51109e
Fix so that correct cache is provided to di registry (#17566)
This fix prevents Grafana from crashing after being logged in.

Ref #17519
2019-06-13 12:15:52 +02:00
Carl Bergquist
6809d2bb29
codestyle: moves cache to infra (#17519) 2019-06-13 10:55:38 +02:00
Mario Trangoni
87760d4fde Codestyle: Fix govet issues (#17178)
ref #10381

Signed-off-by: Mario Trangoni <mjtrangoni@gmail.com>
2019-06-04 22:00:05 +02:00
Andrej Ocenas
151b24b95f CLI: Add command to migrate all datasources to use encrypted password fields (#17118)
closes: #17107
2019-05-27 10:47:21 +02:00
Oleg Gaidarenko
be66ed9dab
Chore: explore possibilities of using makefile (#17039)
* Chore: explore possibilities of using makefile

This is an exploratory commit - I wanted to see how
revive/gosec linters could be integrated with makefile and our build scripts.

Looks better then I expected :)

* Chore: make revive happy

Revive execution was not supplied with path, if you restore there is couple
errors that were popping up - so I fixed them

* Chore: make revive happy
2019-05-16 00:29:26 +03:00
Andrej Ocenas
fd10aa902d
Chore: Use executable dir instead of pwd in CLI for isDev check (#16974)
* Use executable dir for the dev check

* Handle executable in bin and platform dirs

* Remove commented code

* Rename variable
2019-05-14 14:13:41 +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
Carl Bergquist
a86b8c8a04
http: remove dualstack since its deprecated (#16940)
Deprecated: Fast Fallback is enabled by default. To
disable, set FallbackDelay to a negative value.

https://golang.org/src/net/dial.go
2019-05-08 10:37:48 +02:00
Oleg Gaidarenko
c1289b308f Chore: revise some of the gosec rules (#16713) 2019-05-01 11:36:02 +02:00
Andrej Ocenas
e4f649e2c8
Chore: Small improvements to grafana-cli (#16670)
* Small improvements

* Better error handling
2019-04-23 12:34:34 +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
Oleg Gaidarenko
04b3afcd15
Chore: Implement revive (#16200)
Since we do not like some of the default golint rules,
this commit proposes to use https://github.com/mgechev/revive.

And potential revive speed-up should't hurt :).

Right now, presented config (./conf/revive.toml) is permissive,
we might improve it over time however. Fixes for found revive
issues in the code are very limited so it wouldn't be large to review.

Also in this commit:

* Add annotations for makefile commands and declare phony targets

* Rename "gometalinter" script and CI command to "lint"
  since we are doing there a bit more then using gometalinter package

* Add Makefile rules to .editorconfig

* Documentation which mentioned "golint" replaced with revive

Fixes #16109
Ref #16160
2019-03-27 17:53:49 +01:00
bergquist
7e7427637c renames distcache -> remotecache 2019-03-11 10:49:55 +01:00
bergquist
daa3b17951 code layouts and comments 2019-03-11 10:49:42 +01:00
Leonard Gram
36788183d8 service: fix for disabled internal metrics.
Update of the internal metrics for Grafana was
disabled by mistake when refactoring the code.

Fixes #15651
2019-02-26 11:41:55 +01:00
Carl Bergquist
369aa2d5dd
Merge pull request #15628 from bergquist/move_tracing_infra
moves tracing packge into /infra
2019-02-25 16:16:45 +01:00
bergquist
60fef31748 moves social package to /login
ref #14679
2019-02-25 15:30:40 +01:00
bergquist
0c67194b45 moves tracing packge into /infra 2019-02-25 15:29:25 +01:00
bergquist
8a3a3cccc3 moves metric package to /infra
ref #14679
2019-02-24 21:12:51 +01:00
Daniel Lee
56c965e5df cli: chmod 755 for backend plugin binaries
Fixes #15500. Does a simple filename check if the binary names ends
with _linux_amd64 or _darwin_amd64 then sets the file mode to 755.
2019-02-18 15:05:34 +01:00
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
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
8ae066ab5d
move authtoken package into auth package 2019-02-06 17:02:57 +01:00
bergquist
ff136b6ba8 initial verison of server lock 2018-12-17 16:36:57 +01:00
Marcus Efraimsson
a6a1362ad1
temporary fix for starting grafana not running systemd 2018-11-21 18:15:28 +01:00
Carl Bergquist
acf8d43682
Merge pull request #14056 from mjtrangoni/fix-errcheck-issues
Fix errcheck issues
2018-11-21 17:23:56 +01:00