Commit Graph

74 Commits

Author SHA1 Message Date
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
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
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
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
bergquist 8a3a3cccc3 moves metric package to /infra
ref #14679
2019-02-24 21:12:51 +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
Carl Bergquist acf8d43682
Merge pull request #14056 from mjtrangoni/fix-errcheck-issues
Fix errcheck issues
2018-11-21 17:23:56 +01:00
Leonard Gram 2e8c4699b0 build: internal metrics for packaging. 2018-11-15 14:42:09 +01:00
Mario Trangoni a6d54d5d9f pkg/cmd/grafana-server/main.go: Fix error value not checked
See,
$ gometalinter --vendor --deadline 10m --disable-all --enable=errcheck ./...
pkg/cmd/grafana-server/main.go:56:23⚠️ error return value not checked (http.ListenAndServe(fmt.Sprintf("localhost:%d", *profilePort), nil)) (errcheck)
2018-11-13 19:51:32 +01:00
Carl Bergquist 42d902b07d
Add new build info metrics that contains more info (#13876)
* Add new build info metrics that contains more info

The goal was to add more information about Grafana. But rather than
just adding those to the current metrics I created a new metric
since its a common pattern in the prometheus community to expose that
info in a metric named `*_build_info`.

We keep the old metric to avoid introducing any breaking changes but
we should be able to remove it the next breaking change
2018-10-30 11:18:43 +01:00
bergquist c9ac762fb1 build: adds branch info to binary build 2018-10-29 13:27:29 +01:00
Mario Trangoni 6218fadf21 pkg/cmd/grafana-server/main.go: remove os.Kill as it cannot be trapped
See,
$ gometalinter --vendor --deadline 10m --disable-all --enable=megacheck ./...
pkg/cmd/grafana-server/main.go:103:42⚠️ os.Kill cannot be trapped (did you mean syscall.SIGTERM?) (SA1016) (megacheck)
2018-10-13 11:02:36 +02:00
Mario Trangoni 236e0b3814 pkg/cmd/grafana-server/main.go: '_ = <-ch' simplified to '<-ch'
See,
pkg/cmd/grafana-server/main.go:107:8⚠️ '_ = <-ch' can be simplified to '<-ch' (S1005) (megacheck)
2018-10-01 18:24:00 +02:00
Erik Sundell 9ee61b6606 Add stackdriver backend skeleton 2018-09-14 09:33:50 +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
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
Marcus Efraimsson cde347bd3d
Merge branch 'master' into WPH95-feature/add_es_alerting 2018-05-08 17:13:08 +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 b5e70d4607 fix: removed unused channel 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
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
Mario Trangoni c1742df9ac remove unused variables detected by varcheck 2018-04-18 19:04:37 +02:00
wph95 8e7d23cdeb
wip
Signed-off-by: wph95 <wph657856467@gmail.com>
2018-03-23 23:50:16 +08:00
Torkel Ödegaard cafed8ce8f Merge branch 'master' into develop 2017-12-12 13:19:07 +01:00
Torkel Ödegaard 795d9c0362 ux: fixed navbar and sidemenu z-index issue and improved responsive rules 2017-12-11 11:42:13 +01:00
bergquist f7ed24475c wait for all sub routines to finish
simple solution for waiting for all go sub routines to
finish before closing Grafana. We would use errGroup
here as well but I dont like spreading context's all
over the place.

closes #10131
2017-12-11 08:53:06 +01:00
bergquist 39b6c04643 datasource as cfg: basic implementation 2017-11-15 14:30:32 +01:00
Daniel Lee d1c9760fa8 Postgres Data Source (#9475)
* add postgresql datasource

* add rest of files for postgres datasource

* fix timeseries query, remove unused code

* consistent naming, refactoring

* s/mysql/postgres/

* s/mysql/postgres/

* couple more tests

* tests for more datatypes

* fix macros for postgres

* add __timeSec macro

* add frontend for postgres datasource

* adjust documentation

* fix formatting

* add proper plugin description

* merge editor changes from mysql

* port changes from mysql datasource

* set proper defaultQuery for postgres

* add time_sec to timeseries query
accept int for value for timeseries query

* revert allowing time_sec and handle int or float values as unix
timestamp for "time" column

* fix tslint error

* handle decimal values in timeseries query

* allow setting sslmode for postgres datasource

* use type switch for handling data types

* fix value for timeseries query

* refactor timeseries queries to make them more flexible

* remove debug statement from inner loop in type conversion

* use plain for loop in getTypedRowData

* fix timeseries queries

* adjust postgres datasource to tsdb refactoring

* adjust postgres datasource to frontend changes

* update lib/pq to latest version

* move type conversion to getTypedRowData

* handle address types cidr, inet and macaddr

* adjust response parser and docs for annotations

* convert unknown types to string

* add documentation for postgres datasource

* add another example query with metric column

* set more helpful default query

* update help text in query editor

* handle NULL in value column of timeseries query

* add __timeGroup macro

* add test for __timeGroup macro

* document __timeGroup and set proper default query for annotations

* fix typos in docs

* add postgres to list of datasources

* add postgres to builtInPlugins

* mysql: refactoring as prep for merging postgres

Refactors out the initialization of the xorm engine and the query logic
for an sql data source.

* mysql: rename refactoring + test update

* postgres:refactor to use SqlEngine(same as mysql)

Refactored to use a common base class with the MySql data source.

Other changes from the original PR:
- Changed time column to be time_sec to allow other time units in the
future and to be the same as MySQL
- Changed integration test to test the main Query method rather than
the private transformToTable method
- Changed the __timeSec macro name to __timeEpoch
- Renamed PostgresExecutor to PostgresQueryEndpoint

Fixes #9209 (the original PR)

* postgres: encrypt password on config page

With some other cosmetic changes to the config page:
- placeholder texts
- reset button for the password after it has been encrypted.
- default value for the sslmode field.

* postgres: change back col name to time from time_sec

* postgres mysql: remove annotation title

Title has been removed from annotations

* postgres: fix images for docs page

* postgres mysql: fix specs
2017-10-10 15:19:14 +02:00
Mitsuhiro Tanda 39607d09d7 (cloudwatch) alerting 2017-09-29 13:44:00 +09:00
bergquist 2ed753232f internal metrics: add grafana version 2017-09-26 15:25:44 +02:00
bergquist 0229d28d64 remove unused structs 2017-09-21 15:02:17 +02:00
bergquist 6c7454fc2b tag alert queries that return no_data 2017-09-18 14:53:30 +02:00
Torkel Ödegaard c3cffeb10c packaging: fixed issue with pid file on systemd systems, fixes #9133 2017-09-04 10:43:04 +02:00
Alexander 35522c475f Fix #8998 by not overriding GOMAXPROCS (#8999) 2017-08-07 15:02:04 +02:00
Daniel Lee 3ca3c96226 profiling: adds profiling and tracing
If grafana-server binary is started with the -profile flag then
tracing will create a trace.out file and pprof data can be accessed
on the 6060 port.

A custom port for pprof profiling can be set with the -profile-port
flag.
2017-04-11 10:32:18 +02:00
Torkel Ödegaard 8f90c6115d mysql: progress on mysql data source 2017-03-29 22:54:18 +02:00
bergquist 99e3db8208 Merge branch 'master' into alerting_mqe 2016-12-12 19:01:50 +01:00
bergquist ba7a990f86 tech: bump version in server cli 2016-12-09 12:30:36 +01:00
Torkel Ödegaard 7e831e10a2 updated version in grafana-server main.go 2016-11-29 10:41:31 -05:00
bergquist bd3259d07a feat(mqe): init commit 2016-11-09 15:55:47 +01:00
bergquist 2df8c649b7 Merge branch 'master' into alerting_opentsdb 2016-10-19 13:15:22 +02:00
Torkel Ödegaard 04c23ef322 fix(SIGHUP): ignore SIGHUP syscall, fixes #6276 2016-10-14 14:23:22 +02:00
bergquist 455df7f0a0 Merge branch 'master' into alerting_opentsdb 2016-10-14 09:17:35 +02:00
bergquist e556df5b49 feat(tsdb): add draft implementation for influxdb 2016-10-04 16:25:33 +02:00
bergquist 1606b74fce tech(opentsdb): add init ref for opentsdb 2016-10-03 10:59:09 +02:00
Torkel Ödegaard 24a25453f6 fix(server): shutdown logging fixes 2016-09-30 10:18:19 +02:00