Commit Graph

146 Commits

Author SHA1 Message Date
Sven Grossmann
ec857e1de9
Loki: Add dashboard and panel names as headers (#92096)
* feat(nameHeaders): add feature flag

* add safe parsing of headers

* use headers in loki datasource

* Loki: add option to pass headers to Loki

* Loki: add datasource tests for dashboard names

* cleanup

* DataSourceWithBackend: add test

* rename to `sanitizeHeader`

* Loki: add condition when to add headers

* Loki: add e2e tests

* Loki: change test name
2024-08-22 21:30:43 +02:00
Sven Grossmann
94dd4105e2
Loki: Allow alert headers to be forwarded (#90890)
* Loki: Allow alert headers to be forwarded

* Loki: fix tests

---------

Co-authored-by: Yuri Tseretyan <yuriy.tseretyan@grafana.com>
2024-07-25 07:39:34 +02:00
Sven Grossmann
80b2e793ab
Loki: Remove unnecessary featuremgmt (#90874)
Loki: Remove unnecessary featuremgmt
2024-07-24 11:00:41 +02:00
Stephanie Hingtgen
3fcc7f412b
Loki Datasource: Fix getting the feature toggles in MT mode (#90684) 2024-07-19 20:37:46 +03:00
Marcus Efraimsson
c8af659f02
Plugins: Enhanced plugin instrumentation (#90199)
* Plugins: Enhanced plugin instrumentation

* use backend.CallResourceResponseSenderFunc

* sdk v0.237.0

* support admission control

* cover all handlers in log and metrics middlewares

* fix after review
2024-07-09 15:03:46 +02:00
Fabrizio
953c8f838f
Loki: Lower log level when retrieving metadata (#87910)
Co-authored-by: Sven Grossmann <sven.grossmann@grafana.com>
2024-05-15 17:08:03 +03:00
Fabrizio
0b2e748bd8
Loki: Fix setting of tenant ID (#86433) 2024-04-22 21:02:56 +01:00
Fabrizio
653d9fa895
Loki: Handle X-Scope-OrgID and tenant IDs (#85726) 2024-04-11 11:51:54 +02:00
Sven Grossmann
c80b31a0d4
Loki: Remove API restrictions on resource calls (#85191)
Loki: Remove API restrictions
2024-03-26 18:15:35 +01:00
Sven Grossmann
9a8ae3c932
Loki: Support custom X-Query-Tags header (#85123)
* Loki: Support custom `X-Query-Tags` header

* add comment
2024-03-26 13:08:09 +02:00
Erik Sundell
29d4f6a217
Datasource: Change query filtering (#84656)
* call filterQuery from queryrunner

* test query hide filtering

* fix more broken tests

* lint errrors

* remove redundant filterQuery call

* skip filter in variable queries

* fix broken cypress test

* change tooltip text

* fix translations

* fix comments

* do not execute query is targets are empty

* add more tests

* remove unsued import

* update translations

* revert id change

* change header text

* update comment for hide prop

* rename hide query prop

* change tooltip and introduce different toggle state text

* update tests

* update comment and regenerate types

* run extract again

* fix broken e2e test

* track event

* fix build issues

* revert changes in wire file
2024-03-21 13:39:39 +01:00
Selene
473898e47c
Core: Remove thema and kindsys dependencies (#84499)
* Move some thema code inside grafana

* Use new codegen instead of thema for core kinds

* Replace TS generator

* Use new generator for go types

* Remove thema from oapi generator

* Remove thema from generators

* Don't use kindsys/thema for core kinds

* Remove kindsys/thema from plugins

* Remove last thema related

* Remove most of cuectx and move utils_ts into codegen. It also deletes wire dependency

* Merge plugins generators

* Delete thema dependency 🎉

* Fix CODEOWNERS

* Fix package name

* Fix TS output names

* More path fixes

* Fix mod codeowners

* Use original plugin's name

* Remove kindsys dependency 🎉

* Modify oapi schema and create an apply function to fix elasticsearch errors

* cue.mod was deleted by mistake

* Fix TS panels

* sort imports

* Fixing elasticsearch output

* Downgrade oapi-codegen library

* Update output ts files

* More fixes

* Restore old elasticsearch generated file and skip its generation. Remove core imports into plugins

* More lint fixes

* Add codeowners

* restore embed.go file

* Fix embed.go
2024-03-21 11:11:29 +01:00
Fabrizio
288b06b64c
Loki: Replace imports of infra/log with SDK (#84336) 2024-03-20 11:25:35 +02:00
Fabrizio
c1c9ccb8e8
Loki: Replace imports of infra/httpclient with SDK (#84337) 2024-03-19 10:59:53 +01:00
Sven Grossmann
34f9bff9e0
Loki: Fix null pointer exception in case request returned an error (#84398)
Loki: Fix nullpointer in case query returned an error
2024-03-13 18:14:21 +01:00
ismail simsek
3fb6319d1b
Prometheus: Introduce prometheus backend library (#83952)
* Move files to prometheus-library

* refactor core prometheus to use prometheus-library

* modify client transport options

* mock

* have a type

* import aliases

* rename

* call the right method

* remove unrelated test from the library

* update codeowners

* go work sync

* update go.work.sum

* make swagger-clean && make openapi3-gen

* add promlib to makefile

* remove clilogger

* Export the function

* update unit test

* add prometheus_test.go

* fix mock type

* use mapUtil from grafana-plugin-sdk-go
2024-03-11 17:22:33 +01:00
ismail simsek
916a7bbb08
Prometheus: Move converter in prometheus package (#82269)
* use jsoniter from sdk

* move converter into the prometheus

* remove jsonitere

* unit test

* remove redundant ownership
2024-02-15 15:09:30 +01:00
ismail simsek
b0dfeb1911
Chore: Clean up intervalv2 functions (#82074)
* clean up intervalv2 functions

* use roundInterval from grafana-plugin-sdk-go

* use from grafana-plugin-sdk-go

* have intervalv2 in publicdashboards and remove tsdb/intervalv2

* legacydata cleanup

* remove unused variables

* Update pkg/tsdb/legacydata/interval/interval.go

Co-authored-by: Arati R. <33031346+suntala@users.noreply.github.com>

---------

Co-authored-by: Arati R. <33031346+suntala@users.noreply.github.com>
2024-02-09 11:39:21 +01:00
Matias Chomicki
5486a111e6
parseSupportingQueryType: add missing case for infinite scroll (#81492) 2024-01-29 18:12:03 +02:00
Matias Chomicki
df05c79d91
Infinite scrolling: Add X-Query-Tag header (#81089) 2024-01-29 11:24:05 +01:00
Sven Grossmann
b315c5e54d
Loki: Also log statusSource in error case (#81040) 2024-01-23 11:16:29 +01:00
Sven Grossmann
e1aa8a95d9
Loki: Fix bug duplicating parsed labels across multiple log lines (#80292) 2024-01-11 15:09:13 +01:00
Ivana Huckova
3dc7cfdc18
Loki: Implement error source (#80143) 2024-01-08 18:32:16 +01:00
Sven Grossmann
777d119a80
Loki: Fix nil pointer in api.go (#78727) 2023-11-28 12:48:23 +02:00
Sven Grossmann
44586df7bf
Loki: Fix scope of labels variable being wrong (#78417)
fix scope of labels var
2023-11-21 10:14:21 +01:00
Sven Grossmann
a01f8c5b42
Loki: Add backend functionality to parse structured metadata from Loki (#77361)
* prepare backend for structured metadata

* add `lokiStructuredMetadata` feature toggle

* use `lokiStructuredMetadata` feature flag

* add field type check to `labelTypesField`

* remove fixme

* fix feature toggle

* add field in dataplane mode

* use `data.Labels` where possible

* adjust framing tests

* improve verbiage

* improve naming

* update tests to "attributes"
2023-11-16 17:06:14 +01:00
Ryan McKinley
f69fd3726b
FeatureToggles: Add context and and an explicit global check (#78081) 2023-11-14 12:50:27 -08:00
Ivana Huckova
8cd8eb7882
Revert "Loki: Add error source to DataQuery (#77876)" (#78006)
This reverts commit 934456dc1c.
2023-11-10 17:03:59 +01:00
Ivana Huckova
934456dc1c
Loki: Add error source to DataQuery (#77876)
* Loki: Add error source to DataQuery

* Create middlewares to fix healtcheck test

* Add comment for errors from ReadPrometheusStyleResult
2023-11-10 10:26:56 +01:00
Ivana Huckova
d4a257bc8e
Logs: Update logic to process logs dataPlane frame with labels field (#77708)
* Logs: Update dataplane logic to use labels instead of attributes

* Update Loki logs data plane data frame according to specs

* Remove only in test
2023-11-07 10:53:10 +01:00
Will Browne
9d92818cae
Plugins: Update PDC pattern from latest plugin SDK changes (#76576)
* update with sdk

* do sql

* fix core plugins

* fix proxy settings

* bump SDK version

* tidy

* enable pdc for test

* add codeowners

* bump dep

* go mod tidy

* bump SDK
2023-10-16 16:40:04 +02:00
Dan Cech
91cf4f0c1c
Revert "Plugins: Update PDC pattern from latest plugin SDK changes" (#76565)
Revert "Plugins: Update PDC pattern from latest plugin SDK changes (#76036)"

This reverts commit 151f6d6216.
2023-10-13 12:35:16 -04:00
Will Browne
151f6d6216
Plugins: Update PDC pattern from latest plugin SDK changes (#76036)
* update with sdk

* do sql

* fix core plugins

* fix proxy settings

* bump SDK version

* tidy

* enable pdc for test

* add codeowners
2023-10-13 14:42:15 +02:00
Marcus Efraimsson
e4c1a7a141
Tracing: Standardize on otel tracing (#75528) 2023-10-03 14:54:20 +02:00
Ivana Huckova
5510a0d8d1
Loki: Add instrumentation for grafana_loki_plugin_parse_response_duration_seconds_bucket (#75570)
* Add metric for loki parsing response duration

* Rename and add exemplars

* Fix lint
2023-09-28 17:25:09 +02:00
Marcus Efraimsson
0128d0403f
Tracing: Use tracing.InitializeTracerForTest (#75479) 2023-09-27 09:51:57 +02:00
Will Browne
7fca1bde54
Plugins: Set grafana config, plugin version and user agent on plugin requests (#75171)
* first pass

* fixup

* remove test line

* fix tests

* use new fields

* fix imports + formatting

* fix tests

* rollback changes

* undo whitespace

* apply pr feedback
2023-09-21 11:33:31 +02:00
Travis Patterson
98aa7db64a
Loki: Run queries in parallel behind lokiRunQueriesInParallel feature toggle (#74064)
* issue loki queries in parallel so total query time is only the slowest query rather than the sum of all query times.

* Fix lint

* Add running of queries in parallel behind feature toggle to test the functonality before release

* Add span end

* Move shared logic to separate function

* Add logging and tracing around running of all queries

---------

Co-authored-by: Ivana Huckova <ivana.huckova@gmail.com>
2023-09-19 12:34:01 +03:00
Sven Grossmann
727c83d562
Loki: Improve error logging in case statusCode is not 200 (#75075)
* improve loki logging

* fix error log

* fix logger arg
2023-09-19 11:11:27 +02:00
Sven Grossmann
aaef8d3b40
Loki: Add query expression to backend logging (#74927)
add query expression to loki log
2023-09-14 17:23:02 +02:00
Sven Grossmann
d14851c877
Loki: Adjust to logging convention (#74531)
* adjust Loki to logging convention

* Fix call resource logging

* Update dataquery

* Update

* Remove redundant logging

* Fix TODO

* Rename action to stage and use variables

* `resp` might be `nil`

* `resp` might be `nil` here as well

* change to `statusCode`

* use correct logger

* also here

* add query information to logging

---------

Co-authored-by: Ivana Huckova <ivana.huckova@gmail.com>
2023-09-07 17:09:24 +02:00
Sven Grossmann
a403027608
Loki: Add backend healthcheck (#74330)
* add loki healthcheck

* remove `testDatasource` call

* remove unused error check

* change success message

* improve error messages
2023-09-05 08:59:13 +02:00
Serge Zaitsev
93cdc94a94
Chore: capitalise logs in other backend packages (#74344)
* capitalise logs in observability logs

* capitalise oss-bit-tent packages

* capitalise logs in aws-datasources

* capitalise logs for traces and profiling

* capitalise logs for partner datasources

* capitalise logs in plugins platform

* capitalise logs for observability metrics
2023-09-04 22:25:43 +02:00
Sven Grossmann
056c83c788
Loki: Improve backend instrumentation of CallResource calls (#73899)
* instrument call resource

* capitalize log messages
2023-09-01 15:26:25 +02:00
Sven Grossmann
124f445db0
Loki: Improve backend instrumentation of QueryData calls (#73807)
* improve loki `queryData` instrumentation

* fix lint

* use correct logger in "queryData"

* capitalize log messages

* distinguish between requests from alerting
2023-09-01 11:44:18 +02:00
Ryan McKinley
025b2f3011
Chore: use any rather than interface{} (#74066) 2023-08-30 18:46:47 +03:00
Kyle Brandt
6d8fc42cdd
Prometheus: (Chore) Remove experimental unshipped prometheusWideSerie… (#73751) 2023-08-24 17:47:19 +03:00
Sven Grossmann
703f4be15d
Loki: Fix wrong context being passed to HTTP client (#72991)
use new context containing tracing information
2023-08-08 10:24:07 +02:00
Ivana Huckova
7bb0ff7055
Loki: Introduce $__auto range variable for metric queries (#72690)
* Loki: Add  interpolation to backend

* Loki: Replace default variable  with  in frontend

* Loki: Update docs in query builder fro __auto

* Loki: Update test for change default __auto

* Loki: Remove  and  from suggestions as  should be used

* Update docs

* Update pkg/tsdb/loki/parse_query.go

* Fix backend lint

* Fix lint and test

* Update

* Update docs/sources/datasources/loki/template-variables/index.md

Co-authored-by: lwandz13 <126723338+lwandz13@users.noreply.github.com>

* Update public/app/plugins/datasource/loki/querybuilder/operationUtils.ts

Co-authored-by: Matias Chomicki <matyax@gmail.com>

---------

Co-authored-by: lwandz13 <126723338+lwandz13@users.noreply.github.com>
Co-authored-by: Matias Chomicki <matyax@gmail.com>
2023-08-03 16:27:23 +02:00
Gábor Farkas
e045860fbf
loki: generate dataplane-compliant logs dataframes (behind feature flag) (#69909)
* add feature flag

* prepare tests

* enable dataplane-format in loki-backend
2023-07-13 09:58:00 +02:00