Commit Graph

153 Commits

Author SHA1 Message Date
Serge Zaitsev
0bdb105df2
Chore: Remove xorcare/pointer dependency (#63900)
* Chore: remove pointer dependency

* fix type casts

* deprecate xorcare/pointer library in linter

* rooky mistake
2023-03-06 05:23:15 -05:00
Emil Tullstedt
110b05a0c0
Chore: Upgrade Go to 1.20.1 and Alpine to 3.17 (#63639) 2023-02-27 14:50:32 +01:00
Ryan McKinley
b1e58eb47e
Chore: Replace short UID generation with more standard UUIDs (#62731) 2023-02-06 20:44:37 -05:00
Karl Persson
ce5e067d28
ContextHandler: add all configured auth header to context (#62775)
* ContextHandler: Always store list of possible auth headers in context
and remove individual calls
2023-02-02 16:25:46 +01:00
ying-jeanne
6d4e8ec4d6
[xorm] Remove unused functions from engine (#62590)
remove unuseful functions from engine
2023-01-31 14:43:35 +00:00
Serge Zaitsev
e2d49ea17f
Chore: Fix goimports grouping (#62423)
* fix goimports

* fix goimports order
2023-01-30 08:25:58 +00:00
ying-jeanne
2eaa3fb4d2
[Xorm] remove oracle driver + unused function (#62125)
[Xorm] Some more clean up
2023-01-26 22:24:11 +08:00
ying-jeanne
ec171bcad5
[xorm] Clean up xorm dialect & cascade (#61969)
clean up xorm dialect
2023-01-24 19:57:33 +08:00
Christian Simon
a1f2d0e205
Prometheus: Reduce allocations parsing exemplars (#58959)
* Prometheus: Reduce allocations parsing exemplars

This reduces allocations for parsing exemplars.

name            old time/op    new time/op    delta
ExemplarJson-8    24.7ms ±15%    17.6ms ± 2%  -28.72%  (p=0.008 n=5+5)

name            old alloc/op   new alloc/op   delta
ExemplarJson-8    4.70MB ± 0%    3.58MB ± 0%  -23.79%  (p=0.008 n=5+5)

name            old allocs/op  new allocs/op  delta
ExemplarJson-8     72.6k ± 0%     69.1k ± 0%   -4.81%  (p=0.008 n=5+5)

* Ensure pairs is reset
2023-01-18 16:42:22 +01:00
Alexander Zobnin
997105c20d
Config: Support JSON list syntax (#61288)
* Config: Separate lists either by spaces or by commas.

* Simplify space separation

* use separate function for the config strings

* Change behavior only if string contains quotes

* add test for invalid string

* Use JSON list syntax

* ignore leading spaces when process list

* Add notes about using JSON lists into the docs

* Fix typo

* Apply suggestions from code review

Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>

Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>
2023-01-16 16:03:20 +03:00
KonH
4421b31b66
Loki/Prometheus: Change signature - return non-reference from ReadPrometheusStyleResult (#57209)
* Change signature - return non-reference from ReadPrometheusStyleResult

Related to https://github.com/grafana/grafana/issues/52430

* Fix invalid reference usage

* Potential fix for test data

* Remove additional ref usage

* Revert "Potential fix for test data"

This reverts commit 94ed588ab3.

* Commit changed test data

* Revert unwanted conflict resolution

* Add additional condition to track empty responses

* Setup valid empty response

* Re-introduce changes reverted by merge
2023-01-13 09:00:39 +01:00
ying-jeanne
f9daf61e96
[Bug] Fix xorm dependency on yaml v2 2.2.3 (#61183)
fix xorm dependency on yaml v2 2.2.3
2023-01-11 08:08:28 +00:00
ying-jeanne
ce8512ace7
[xorm] Change interface to become an interface (#60838)
[xorm] change interface to become an interface
2022-12-30 13:58:10 +00:00
ying-jeanne
a3a0c01301
[xorm] Remove some unused functions && mssql related logics (#60788)
* remove some unused functions

* more

* put back the pakcage replace
2022-12-28 22:23:25 -05:00
ying-jeanne
29276581d2
[xorm] Remove cache from xorm (#60770)
[xorm] remove cache from xorm
2022-12-27 10:48:49 -05:00
Torkel Ödegaard
591c86e31d
Scene: Consolidate layout props on a layout prop (formerly named size) (#60437)
* Initial prop rename changes

* Updates

* Rename layout to placement

* Fix

* Fixed test

Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com>
2022-12-27 09:05:06 +01:00
ying-jeanne
746c7839dc
[xorm] Remove some unused functionalities from engine (#60763)
remove some unused functionalities from engine
2022-12-26 22:39:21 +08:00
ying-jeanne
77b3520b47
[xorm] remove mssql as driver (#60760)
* Remove mssql driver

* reput the go.mod

* add back xorm and remove mssql
2022-12-26 06:01:51 -05:00
ying-jeanne
33dbbbad6b
[xorm] Rmove engine group (#60761) 2022-12-26 05:32:51 -05:00
ying-jeanne
572e5a76ef
[xorm] add xorm as package into grafana (#60678)
* add xorm and xorm/core as package

* remove mssql and oracle as driver

* fix some typo

* remove unittest

* remove some cache

* restore the removed part

* remove logfile
2022-12-26 17:45:21 +08:00
Marcus Efraimsson
6478d0a5ef
Plugins: Forward user header (X-Grafana-User) in backend plugin requests (#58646)
Grafana would forward the X-Grafana-User header to backend plugin request when 
dataproxy.send_user_header is enabled. In addition, X-Grafana-User will be automatically
forwarded in outgoing HTTP requests for core/builtin HTTP datasources. 
Use grafana-plugin-sdk-go v0.147.0.

Fixes #47734

Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
2022-12-15 15:28:25 +01:00
Neil Fordyce
b0874d8059
DataProxy: Populate X-Grafana-Referer header (#60040)
* ProxyUtil: Populate X-Grafana-Referer header

* ProxyUtil: Move Referer/Origin header removal

So that the removal and setting X-Grafana-Referer logic applies to all
proxied requests and not just datasource proxy.

* ProxyUtil: Test to guard against multiline headers

* ProxyUtil: Explicitly check injected header isn't parsed
2022-12-15 10:08:10 +01:00
Kyle Brandt
4e0f95dc31
Chore: Update SDK to v0.145.0 with TimeSeriesMulti Constant (#59729) 2022-12-05 12:48:10 -05:00
Dan Cech
de99ce139c
Server: Switch from separate server & cli to a unified grafana binary (#58286)
* avoid the need for a second bulky binary for grafana-cli

* look for grafana-server in $PATH as well as same directory

* implement unified "grafana" command

* update dockerfiles, fix grafana-cli -v

* update packaging to work with single binary

- add wrapper scripts for grafana and grafana-server
- update and sync package files
- implement --sign flag of build package command
- stop packaging scripts folder, they are not useful for end users
- add support for --configOverrides in server command
- remove unused nfpm.yaml config file

* windows support
2022-11-22 11:53:43 -05:00
Emil Tullstedt
89eba7a108
Server: Write internal server error on missing write (#57813) 2022-11-07 16:14:41 +01:00
Sofia Papagiannaki
5c973e58bd
Nested Folders: Add tests for store methods (#57662)
* Nested Folders: Add store tests

* Fix parent order

* Fix update

* skip tests!

* Export test helpers for now
2022-11-03 14:21:41 +01:00
Emil Tullstedt
1e2b7c5368
Errors: Add HTTP writer for errutil.Error (#57661) 2022-10-26 16:57:53 +02:00
Marcus Efraimsson
6f8fcae01b
[main] Plugin fixes (#57399)
* Plugins: Remove support for V1 manifests

* Plugins: Make proxy endpoints not leak sensitive HTTP headers

* Security: Fix do not forward login cookie in outgoing requests

(cherry picked from commit 4539c33fce)

Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
2022-10-21 13:54:55 +02:00
Emil Tullstedt
22756913ba
Errutil: Update documentation for Go 1.19 (#55807) 2022-10-07 12:47:43 +02:00
Todd Treece
152c7f149a
Prometheus: Add Exemplar sampling for streaming parser (#56049) 2022-10-04 08:40:01 -04:00
Alexander Weaver
bd6a5c900f
Alerting: Extract ticker into shared package (#55703)
* Move ticker files to dedicated package with no changes

* Fix package naming and resolve naming conflicts

* Fix up all existing references to moved objects

* Remove all alerting-specific references from shared util

* Rename TickerMetrics to simply Metrics

* Rename base ticker type to T and rename NewTicker to simply New
2022-09-26 12:35:33 -05:00
Marcus Efraimsson
862a6a2fa6
Logging: Introduce API for contextual logging (#55198)
Introduces a FromContext method on the log.Logger interface that 
allows contextual key/value pairs to be attached, e.g. per request, 
so that any logger using this API will automatically get the per request 
context attached. The proposal makes the traceID available for 
contextual logger , if available, and would allow logs originating from 
a certain HTTP request to be correlated with traceID.
In addition, when tracing not enabled, skip adding
traceID=00000000000000000000000000000000
to logs.
2022-09-20 18:32:06 +02:00
Marcus Efraimsson
cc583c5d87
Chore: Change default log level for errutil.CoreStatus (#55199) 2022-09-15 14:08:59 +02:00
Will Browne
29327cbba2
Plugins: Use error plane for api/ds/query (#54750)
* plugin client returns error base

* fix api test

* add plugin client test

* add fallback err

* fix linting

* wip

* replace bad query

* template is an error

* failing test of templated error

* add one test passing

* fix failing test

* move test

* rename ErrBadQuery to ErrQueryValidationFailure

* tidy diff

* Change to one error per specific error kind

* last err + fix test

* fix imports

* more tests

* keep req vars together

Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
2022-09-14 18:19:57 +02:00
Emil Tullstedt
b287047052
Chore: Upgrade Go to 1.19.1 (#54902)
* WIP

* Set public_suffix to a pre Ruby 2.6 version

* we don't need to install python

* Stretch->Buster

* Bump versions in lib.star

* Manually update linter

Sort of messy, but the .mod-file need to contain all dependencies that
use 1.16+ features, otherwise they're assumed to be compiled with
-lang=go1.16 and cannot access generics et al.

Bingo doesn't seem to understand that, but it's possible to manually
update things to get Bingo happy.

* undo reformatting

* Various lint improvements

* More from the linter

* goimports -w ./pkg/

* Disable gocritic

* Add/modify linter exceptions

* lint + flatten nested list

Go 1.19 doesn't support nested lists, and there wasn't an obvious workaround.
https://go.dev/doc/comment#lists
2022-09-12 12:03:49 +02:00
Yuriy Tseretyan
736d035c65
Chore: Add context util that allow to provide cause of cancellation (#53918) 2022-08-24 10:24:41 -04:00
Emil Tullstedt
ce7593686d
Errors: Allow using Base as an error type (#53824) 2022-08-22 11:07:33 +02:00
Jo
ca72cd570e
Remove ioutil.ReadDir from usage (#53550)
* add depguard rule for ioutil

* replace ioutil.ReadDir with os.ReadDir

* use legacy option in depguard supported in golangci-lint v1.40

* replace ioutil.ReadDir with os.ReadDir

* return error for file info
2022-08-11 07:21:12 -04:00
Eric Leijonmarck
58a4122624
Fix: Comment out flaky tests for TestReadProm (#52243)
* comment out flaky test

* commented out unused functions

* using t.skip()

* disable linting
2022-07-14 17:42:13 +01:00
Emil Tullstedt
dd6d71ee4b
HTTP: Add function for using new style errors with fallback (#51627) 2022-07-13 13:14:28 +02:00
Ryan McKinley
4a00c7ebde
Storage: Add basic file upload management (#50638) 2022-07-05 10:53:41 -07:00
Leon Sorokin
f4f31b40fd
HeatmapNG: consolidate frame types & fix color ranging (#51089)
* rename yZeroDisplay -> yMinDisplay
* remove heatmap-cells-sparse frame type
* parse x bucket size to millis
* take into account hideLE & hideGE filters to auto-range color scale
* extract cell value range scanning to heatmapData
2022-06-20 15:38:13 -05:00
Gábor Farkas
fd63ed540f
loki: fix bug in labels framing (#51015) 2022-06-17 12:50:10 +02:00
Emil Tullstedt
f1834163ec
ShortURL: Use new Error type (#50859) 2022-06-15 15:11:36 +02:00
Emil Tullstedt
264c2a9d1e
Errors: Introduce error type with Grafana specific metadata (#47504) 2022-06-14 10:50:11 +02:00
Yuriy Tseretyan
a88408bfd1
Fix Reporter GetDiffsForField (#50264) 2022-06-07 11:16:05 +08:00
Kat Yang
31630edf0c
Chore: Remove Wrapf (#50128)
* Chore: Remove Wrapf

* Remove all Wrapf refs

* Remove last Wrapf ref

* Fix lint errors

* Remove Wrap and Wrapf definitions

* Remove unnecessary colon
2022-06-06 22:30:31 +02:00
Todd Treece
64d93498de
Chore: Update grafana-plugin-sdk-go to v0.136.0 (#50127) 2022-06-03 08:25:52 -04:00
Todd Treece
33d4850c90
Prometheus: Fix sort issue in wide frames (#49660) 2022-05-25 23:32:55 -04:00
Dave Henderson
1f85101787
Util: Improve performance of strings.SplitString (#49115)
Replaces the regexp with calls to strings.ReplaceAll and strings.Fields
for simplicity and improved performance.

Signed-off-by: Dave Henderson <dave.henderson@grafana.com>
2022-05-25 14:10:22 -07:00