Commit Graph

300 Commits

Author SHA1 Message Date
Leonard Gram
5d87aa2fa4
Merge pull request #13031 from bergquist/golang_1.11
upgrade to golang 1.11
2018-09-05 15:31:43 +02:00
maicon
a6aa219895 Reopen log files after receiving a SIGHUP signal (#13112)
* Reopen log files after receiving a SIGHUP signal

Implements a system signals listener in log.FileLogWriter.

After receiving a SIGHUP signal from the system, the listener will close the current log file and then open it again.

The listener will finishes after receiving a SIGINT, SIGKILL or SIGTERM signal.

Closes grafana/grafana#2497

* Move the SIGHUP handling to the main file
2018-09-04 10:31:41 +02:00
Carl Bergquist
ee1083d9b4 cli: avoid rely on response.ContentLength (#13120)
response.ContentLength might be invalid if the http response
is chunked.

fixes #13079
2018-09-03 20:33:21 +02:00
Jasper Lievisse Adriaanse
d668a922e6 Return correct path for OpenBSD in cli's returnOsDefault (#13089) 2018-08-30 11:56:52 +02:00
bergquist
12c9860882 string formating fixes 2018-08-28 22:33:38 +02:00
Torkel Ödegaard
b8724ae0c4
refactoring: enterprise build/hooks refactorings (#12478) 2018-07-02 04:33:39 -07:00
Carl Bergquist
88783d6e0a avoid calling os.Exit outside main.go (#12459)
I don't think we should call os.Exit outside main.go. Calling
os.Exit breaks the application control flow.
2018-06-29 22:48:26 -07:00
Torkel Ödegaard
7a7c6f8fab fix: log close/flush was done too early, before server shutdown log message was called, fixes #12438 2018-06-28 04:38:23 -07:00
bergquist
dbfafa1cb5 routing: allows routes to be added to existing groups
this enables services to add routing to ex /api
without causing conflicts.
2018-06-25 16:50:27 +02:00
Marcus Efraimsson
e5e1683840
Merge branch 'master' into feature/add_es_alerting 2018-05-28 18:10:34 +02:00
Torkel Ödegaard
80d694d205
Backend image rendering as plugin (#11966)
* rendering: headless chrome progress

* renderer: minor change

* grpc: version hell

* updated grpc libs

* wip: minor progess

* rendering: new image rendering plugin is starting to work

* feat: now phantomjs works as well and updated alerting to use new rendering service

* refactor: renamed renderer package and service to rendering to make renderer name less confusing (rendering is internal service that handles the renderer plugin now)

* rendering: now render key is passed and render auth is working in plugin mode

* removed unneeded lines from gitignore

* rendering: now plugin mode supports waiting for all panels to complete rendering

* fix: LastSeenAt fix for render calls, was not set which causes a lot of updates to Last Seen at during rendering, this should fix sqlite db locked issues in seen in previous releases

* change: changed render tz url parameter to use proper timezone name as chrome does not handle UTC offset TZ values

* fix: another update to tz param generation

* renderer: added http mode to renderer service, new ini setting [rendering] server_url
2018-05-24 15:26:27 +02:00
Marcus Efraimsson
1324a67cbd
Merge branch 'master' into WPH95-feature/add_es_alerting 2018-05-23 14:35:45 +02:00
Torkel Ödegaard
d0c17100cb fix: fixed some minor startup logging issues 2018-05-18 11:17:31 +02:00
Torkel Ödegaard
6c0752473a
Sqlstore refactor (#11908)
* refactor: tracing service refactoring

* refactor: sqlstore to instance service

* refactor: sqlstore & registory priority

* refactor: sqlstore refactor wip

* sqlstore: progress on getting tests to work again

* sqlstore: progress on refactoring and getting tests working

* sqlstore: connection string fix

* fix: not sure why this test is not working and required changing expires

* fix: updated grafana-cli
2018-05-18 11:10:10 +02:00
Marcus Efraimsson
d3f516f1c4
Merge branch 'master' into WPH95-feature/add_es_alerting 2018-05-12 11:33:58 +02:00
Torkel Ödegaard
27e1c67453
refactor: tracing service refactoring (#11907) 2018-05-10 16:51:55 +02:00
Marcus Efraimsson
cde347bd3d
Merge branch 'master' into WPH95-feature/add_es_alerting 2018-05-08 17:13:08 +02:00
bergquist
65352dccc0 only error log when err is not nil 2018-05-08 11:59:27 +02:00
Marcus Efraimsson
99257eb048
Merge branch 'master' of git://github.com/grafana/grafana into WPH95-feature/add_es_alerting 2018-05-03 12:03:04 +02:00
Torkel Ödegaard
c40a50829d fix: removed manully added http server from inject graph as it is now a self registered service 2018-05-02 21:30:15 +02:00
Torkel Ödegaard
b5e70d4607 fix: removed unused channel 2018-05-02 19:56:15 +02:00
Torkel Ödegaard
e3ea6c683c fix: comment spell fix 2018-05-02 19:56:15 +02:00
Torkel Ödegaard
23655315b8 fix: fixed race condition between http.Server ListenAndServe & Shutdown, now service crash during startup correctly closes http server every time 2018-05-02 19:56:15 +02:00
Torkel Ödegaard
d04ad835e2 refactoring: lots of refactoring around server shutdown flows, making sure process is terminated when background service has crashed 2018-05-02 19:56:15 +02:00
Torkel Ödegaard
053c2039bb refactor: provisioning service refactoring 2018-05-02 19:56:15 +02:00
Torkel Ödegaard
14bb7832af
Metrics package now follows new service interface & registration (#11787)
* refactoring: metrics package now follows new service interface & registration

* fix: minor fix, make sure metrics service is imported, by grafana-server
2018-05-02 19:54:07 +02:00
Torkel Ödegaard
2b93cbbf04 --amend 2018-05-01 14:18:10 +02:00
Torkel Ödegaard
13e015fe3f fix: improved handling of http server shutdown 2018-05-01 14:14:11 +02:00
Torkel Ödegaard
fa7d7ed5df
Initial Baby Step to refactoring settings from global vars to instance (#11777)
* wip: start on refactoring settings

* settings: progress on settings refactor

* refactor: progress on settings refactoring

* fix: fixed failing test

* settings: moved smtp settings from global to instance
2018-04-30 16:21:04 +02:00
Carl Bergquist
2cc855a131 Merge branch 'master' into notification-service-refactor2 2018-04-27 16:59:14 +02:00
Torkel Ödegaard
a8eed9d344 Refactoring PluginManager to be a self registering service (#11755)
* refator: refactored PluginManager to be a self registering service, a lot more work needed to fully make plugin manager use instance variables and not so many globals
2018-04-27 15:11:55 +02:00
Torkel Ödegaard
df71fe33fd refactor: refactoring notification service to use new service registry hooks 2018-04-27 14:15:17 +02:00
Carl Bergquist
28f7b6dad1 Enable Grafana extensions at build time. (#11752)
* extensions: import and build

* bus: use predefined error

* enterprise: build script for enterprise packages

* poc: auto registering services and dependency injection

(cherry picked from commit b5b1ef875f905473af41e49f8071cb9028edc845)

* poc: backend services registry progress

(cherry picked from commit 97be69725881241bfbf1e7adf0e66801d6b0af3d)

* poc: minor update

(cherry picked from commit 03d7a6888b81403f458b94305792e075568f0794)

* ioc: introduce manuel ioc

* enterprise: adds setting for enterprise

* build: test and build specific ee commit

* cleanup: test testing code

* removes example hello service
2018-04-27 13:41:58 +02:00
Mario Trangoni
15f11effa0 pkg/cmd: fix ineffassign issues 2018-04-23 19:34:55 +02:00
bergquist
03a9650c57 cli: adds os and arch headers
this makes it possible for the plugin repo
to provide the correct package if arch and os matters
2018-04-20 09:52:25 +02:00
Mario Trangoni
c1742df9ac remove unused variables detected by varcheck 2018-04-18 19:04:37 +02:00
Carl Bergquist
8367199a2d
Merge pull request #11613 from knweiss/gosimple
Code simplification (gosimple)
2018-04-17 22:40:40 +02:00
Karsten Weiss
5d95601720 Merge variable declaration with assignment (gosimple)
This fixes:
pkg/cmd/grafana-cli/commands/upgrade_all_command.go:56:3: should merge variable declaration with assignment on next line (S1021)
pkg/login/ldap.go:406:4: should merge variable declaration with assignment on next line (S1021)
pkg/services/sqlstore/migrator/dialect.go:87:2: should merge variable declaration with assignment on next line (S1021)
pkg/services/sqlstore/migrator/dialect.go:165:2: should merge variable declaration with assignment on next line (S1021)
pkg/tsdb/cloudwatch/metric_find_query_test.go:185:2: should merge variable declaration with assignment on next line (S1021)
2018-04-16 21:04:57 +02:00
Karsten Weiss
4d6386e97b Use fmt.Errorf() (gosimple)
This fixes:
pkg/cmd/grafana-cli/commands/install_command.go:36:11: should use fmt.Errorf(...) instead of errors.New(fmt.Sprintf(...)) (S1028)
pkg/models/org_user.go:53:11: should use fmt.Errorf(...) instead of errors.New(fmt.Sprintf(...)) (S1028)
pkg/services/notifications/mailer.go:138:16: should use fmt.Errorf(...) instead of errors.New(fmt.Sprintf(...)) (S1028)
2018-04-16 21:04:57 +02:00
Karsten Weiss
f61e69ce75 Simplify comparison to bool constant (gosimple)
This fixes:
build.go:553:6: should omit comparison to bool constant, can be simplified to !strings.Contains(path, ".sha256") (S1002)
pkg/cmd/grafana-cli/commands/ls_command.go:27:5: should omit comparison to bool constant, can be simplified to !pluginDirInfo.IsDir() (S1002)
pkg/components/dynmap/dynmap_test.go:24:5: should omit comparison to bool constant, can be simplified to !value (S1002)
pkg/components/dynmap/dynmap_test.go:122:14: should omit comparison to bool constant, can be simplified to b (S1002)
pkg/components/dynmap/dynmap_test.go:125:14: should omit comparison to bool constant, can be simplified to !b (S1002)
pkg/components/dynmap/dynmap_test.go:128:14: should omit comparison to bool constant, can be simplified to !b (S1002)
pkg/models/org_user.go:51:5: should omit comparison to bool constant, can be simplified to !(*r).IsValid() (S1002)
pkg/plugins/datasource/wrapper/datasource_plugin_wrapper_test.go:77:12: should omit comparison to bool constant, can be simplified to !haveBool (S1002)
pkg/services/alerting/conditions/evaluator.go:23:9: should omit comparison to bool constant, can be simplified to !reducedValue.Valid (S1002)
pkg/services/alerting/conditions/evaluator.go:48:5: should omit comparison to bool constant, can be simplified to !reducedValue.Valid (S1002)
pkg/services/alerting/conditions/evaluator.go:91:5: should omit comparison to bool constant, can be simplified to !reducedValue.Valid (S1002)
pkg/services/alerting/conditions/query.go:56:6: should omit comparison to bool constant, can be simplified to !reducedValue.Valid (S1002)
pkg/services/alerting/extractor.go:107:20: should omit comparison to bool constant, can be simplified to !enabled.MustBool() (S1002)
pkg/services/alerting/notifiers/telegram.go:222:41: should omit comparison to bool constant, can be simplified to this.UploadImage (S1002)
pkg/services/sqlstore/apikey.go:58:12: should omit comparison to bool constant, can be simplified to !has (S1002)
pkg/services/sqlstore/apikey.go:72:12: should omit comparison to bool constant, can be simplified to !has (S1002)
pkg/services/sqlstore/dashboard.go:66:33: should omit comparison to bool constant, can be simplified to !cmd.Overwrite (S1002)
pkg/services/sqlstore/dashboard.go:175:12: should omit comparison to bool constant, can be simplified to !has (S1002)
pkg/services/sqlstore/dashboard.go:311:13: should omit comparison to bool constant, can be simplified to !has (S1002)
pkg/services/sqlstore/dashboard.go:444:12: should omit comparison to bool constant, can be simplified to !exists (S1002)
pkg/services/sqlstore/dashboard.go:472:12: should omit comparison to bool constant, can be simplified to !exists (S1002)
pkg/services/sqlstore/dashboard.go:554:32: should omit comparison to bool constant, can be simplified to !cmd.Overwrite (S1002)
pkg/services/sqlstore/dashboard_snapshot.go:83:12: should omit comparison to bool constant, can be simplified to !has (S1002)
pkg/services/sqlstore/plugin_setting.go:39:12: should omit comparison to bool constant, can be simplified to !has (S1002)
pkg/services/sqlstore/quota.go:34:12: should omit comparison to bool constant, can be simplified to !has (S1002)
pkg/services/sqlstore/quota.go:111:6: should omit comparison to bool constant, can be simplified to !has (S1002)
pkg/services/sqlstore/quota.go:136:12: should omit comparison to bool constant, can be simplified to !has (S1002)
pkg/services/sqlstore/quota.go:213:6: should omit comparison to bool constant, can be simplified to !has (S1002)
pkg/services/sqlstore/temp_user.go:129:12: should omit comparison to bool constant, can be simplified to !has (S1002)
pkg/services/sqlstore/user.go:157:12: should omit comparison to bool constant, can be simplified to !has (S1002)
pkg/services/sqlstore/user.go:182:5: should omit comparison to bool constant, can be simplified to !has (S1002)
pkg/services/sqlstore/user.go:191:12: should omit comparison to bool constant, can be simplified to !has (S1002)
pkg/services/sqlstore/user.go:212:12: should omit comparison to bool constant, can be simplified to !has (S1002)
pkg/services/sqlstore/user.go:307:12: should omit comparison to bool constant, can be simplified to !has (S1002)
pkg/social/generic_oauth.go:185:5: should omit comparison to bool constant, can be simplified to !s.extractToken(&data, token) (S1002)
pkg/tsdb/mssql/mssql.go:148:39: should omit comparison to bool constant, can be simplified to ok (S1002)
pkg/tsdb/mssql/mssql.go:212:6: should omit comparison to bool constant, can be simplified to !query.Model.Get("fillNull").MustBool(false) (S1002)
pkg/tsdb/mssql/mssql.go:247:56: should omit comparison to bool constant, can be simplified to ok (S1002)
pkg/tsdb/mssql/mssql.go:274:7: should omit comparison to bool constant, can be simplified to !exist (S1002)
pkg/tsdb/mssql/mssql.go:282:8: should omit comparison to bool constant, can be simplified to !exist (S1002)
pkg/tsdb/mysql/mysql.go:221:6: should omit comparison to bool constant, can be simplified to !query.Model.Get("fillNull").MustBool(false) (S1002)
pkg/tsdb/mysql/mysql.go:256:56: should omit comparison to bool constant, can be simplified to ok (S1002)
pkg/tsdb/mysql/mysql.go:283:7: should omit comparison to bool constant, can be simplified to !exist (S1002)
pkg/tsdb/mysql/mysql.go:291:8: should omit comparison to bool constant, can be simplified to !exist (S1002)
pkg/tsdb/postgres/postgres.go:134:39: should omit comparison to bool constant, can be simplified to ok (S1002)
pkg/tsdb/postgres/postgres.go:201:6: should omit comparison to bool constant, can be simplified to !query.Model.Get("fillNull").MustBool(false) (S1002)
pkg/tsdb/postgres/postgres.go:236:56: should omit comparison to bool constant, can be simplified to ok (S1002)
pkg/tsdb/postgres/postgres.go:263:7: should omit comparison to bool constant, can be simplified to !exist (S1002)
pkg/tsdb/postgres/postgres.go:271:8: should omit comparison to bool constant, can be simplified to !exist (S1002)
2018-04-16 21:04:57 +02:00
Mario Trangoni
ce941a004d fix unconvert issues 2018-04-16 20:04:58 +02:00
Matthew McGinn
ee623e2091 Grafana-CLI: mention the plugins directory is not writable on failure 2018-04-15 13:44:59 -04:00
Penghan Wang
fbed72c89c
Merge branch 'master' into feature/add_es_alerting 2018-04-09 14:00:28 +08:00
bergquist
45d9bfca97 print to stderr since logger might not exist 2018-03-28 22:51:21 +02:00
Penghan Wang
a21afbe9a6
Merge branch 'master' into feature/add_es_alerting 2018-03-26 19:51:03 +08:00
wph95
8e7d23cdeb
wip
Signed-off-by: wph95 <wph657856467@gmail.com>
2018-03-23 23:50:16 +08:00
Julian Kornberger
0a415c50d0 Make golint happier 2018-03-22 22:38:44 +01:00
Julian Kornberger
7aab6a8887 Make golint happier 2018-03-22 12:40:21 +01:00
bergquist
b099f0309f cli: download latest dependency by default 2018-02-16 09:54:37 +01:00
bergquist
5bbe047eaa Revert "removes dependencies install for plugins"
This reverts commit 47e363ea15.
2018-02-16 09:49:29 +01:00