175 Commits

Author SHA1 Message Date
a18ea34688 CloudWatch: Backport aws-sdk-go-v2 update from external plugin (#107136)
* CloudWatch: Backport aws-sdk-go-v2 update from external plugin

* Review feedback & cleaning up a couple typos
2025-06-26 15:56:50 +02:00
6a0cf22b53 Revert "Postgres: Switch the datasource plugin from lib/pq to pgx (#103961)" (#106270)
This reverts commit 1e383b0c1e98734ad4bf974f0435512d10c33246.
2025-06-03 08:45:07 -04:00
1e383b0c1e Postgres: Switch the datasource plugin from lib/pq to pgx (#103961)
* Create libpqToPGX feature toggle

* Refactor PostgreSQL datasource to support PGX with feature toggle

- Updated `ProvideService` to accept feature toggles for enabling PGX.
- Modified integration tests to use the new PGX connection method.
- Introduced new functions for handling PGX connections and queries.
- Enhanced TLS configuration handling for PostgreSQL connections.
- Updated existing tests to ensure compatibility with PGX and new connection methods.

* Update PostgreSQL datasource to enhance connection pooling and error handling

- Increased `MaxOpenConns` to 10 in integration tests for improved connection management.
- Refactored connection handling in `newPostgresPGX` to return a connection pool instead of a single connection.
- Updated health check error handling to utilize context and feature toggles for better error reporting.
- Adjusted `DisposePGX` method to close the connection pool properly.
- Enhanced query execution to acquire connections from the pool, ensuring efficient resource usage.

* Cleanup

* Revert postgres_test unnecessary changes

* Rename feature toggle from `libpqToPGX` to `postgresDSUsePGX`

* Add null check to dispose method

* Fix lint issues

* Refactor connection string generation

* Address comment in health check file

* Rename p to pool

* Refactor executeQueryPGX and split into multiple functions

* Fix lint issues

* The returning error message from PGX is enough no need to separate the error code.

* Move TLS handling to newPostgresPGX function

* Disable ssl for integration tests

* Use MaxIdleConns option

* Remove old feature toggle

* Rename`generateConnectionConfigPGX` to `generateConnectionStringPGX`

* Add back part of the error messages

* Don't show max idle connections option when PGX enabled

* Address comments from Sriram

* Add back Sriram's changes

* PostgreSQL: Rework tls manager to use temporary files instead (#105330)

* Rework tls manager to use temporary files instead

* Lint and test fixes

* Update pkg/tsdb/grafana-postgresql-datasource/postgres.go

Co-authored-by: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com>

* Update betterer

---------

Co-authored-by: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com>

---------

Co-authored-by: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com>
2025-05-26 08:54:18 +02:00
9c2846c4fb Plugins: Separate pluginv2 interfaces from ProtoClient interface (#104795)
split interfaces
2025-05-06 17:02:32 +01:00
54a51bd3e3 Data source plugin: Improve error message when plugin has connection issues (#102625)
* Improve data source error message when stackID

* Update comment

* Revert "Update comment"

This reverts commit 48922bc55259803f1717e91afc9f749a60d61184.

* Revert "Improve data source error message when stackID"

This reverts commit 4bf0a2f7b712e77b9de4655716695a7ee75c183b.

* Make public messagic configurable based on context

* Update, simplify

* Update

* Update getting stack

* Update pkg/plugins/errors.go

Co-authored-by: Andres Martinez Gotor <andres.martinez@grafana.com>

* Refactor test to test for when context has stack value

* Remove duplicated test

* Fix error checking logic

---------

Co-authored-by: Andres Martinez Gotor <andres.martinez@grafana.com>
2025-03-31 12:00:40 +02:00
307974f20d Data sources: Improve error messages for grpc errors (#102372)
* Data sources: Improve error messages for grpc errors

* Improve code comments

* Fix lint

* Update connection issue message

* Update name

* Update comment

* Update, rename and add test

* Update, remove POC change

* Fix lint
2025-03-20 18:44:47 +01:00
5b67ae1876 Plugins: Remove support for secrets manager plugins (#101467)
* remove secrets manager code

* remove unused struct

* add test toggles back

* rollback golden file changes

* add missing TestMain

* update betterer
2025-03-20 10:00:59 +00:00
806c043e45 UnifiedStorage: Rename Batch processing to Bulk (#101413) 2025-02-28 08:41:08 +03:00
9eda0f44ac Update ErrRequestErrorBase from [plugin.downstreamError] to [plugin.requestFailureError] (#100965)
* Update ErrRequestErrorBase to make it more clear for developers

* Trigger build

* requestError -> requestFailureError

* Fix test

* Update pkg/plugins/backendplugin/grpcplugin/client_v2.go

Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>

---------

Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
2025-02-20 10:23:53 +01:00
33d82c43df Jaeger: run health check through backend (#99322)
run health check through backend
2025-01-24 19:37:36 +07:00
cd46f1ddb9 Search: Remove history query (#99026) 2025-01-15 12:49:47 -06:00
5a2315dabf Plugins: Capture error source from grpc status errors (#97471)
* capture errorsource from grpc error

* apply PR feedback

* update comment

* update comment

* use SDK logic

* update SDK commit

* update sdk

* update golden files
2025-01-08 17:05:28 +00:00
f6ccf976e5 UnifiedSearch: Use ResourceIndex from dashboards apiserver (v0alpha1 only) (#96939) 2024-11-27 07:57:53 +02:00
5965aa9aca Loki: Fix healthcheck logger always appending endpoint (#96531)
* Loki: Fix healthcheck logger always appending `endpoint`

* add test
2024-11-15 12:51:52 +01:00
4d0a7637b2 Zipkin: Run health check through backend (#96031)
* Zipkin: Run health check through backend

* Mark some errors as downstream

* Update pkg/tsdb/zipkin/zipkin.go

Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>

* Use errors.New where error formatting is not needed

* Remove executable in plugin.json

* Fix joining the path

* Keep logger as global and then create from context

* Close the res body

---------

Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
2024-11-07 16:48:00 +01:00
0eb7b755e2 Unified Storage Indexer: Add integration tests (#95687)
* indexer integration tests WIP

* make protobuf

* Adds a few more integration test cases to cover the basics. Use Limit instead of Size param from SearchRequest.

* skip if testing.Short()

* adds test comments
2024-11-01 07:58:10 -06:00
f8748f0724 ref: pass tracer to plugin factory func (#93701)
* ref: pass tracer to plugin factory func

* fix: add tracer to coreplugin

* test: fix test, generate wire

* test: ignore trace field in loader_test

* ref: pass tracer as dependency, don't store in plugin

* ref: wrap tracer with tracer provider to satisfy WithTracerProvider

* ref: use otel trace.Tracer type for tracer
2024-10-10 20:30:56 -04:00
52f8cecd4a Plugins: Add state logs for plugin client retrieval (#93630)
* add state to grpc plugin

* tidy

* fix lint

* fix issues

* return true

* use defer

* update err message
2024-09-24 15:55:02 +03:00
7cd546238b Revert "Plugins: Add logs for plugin proto client retrieval" (#93617)
Revert "Plugins: Add logs for plugin proto client retrieval (#93527)"

This reverts commit ccf6fbebfae8358a05c050447e61a66693abc979.
2024-09-23 19:26:02 +03:00
ccf6fbebfa Plugins: Add logs for plugin proto client retrieval (#93527) 2024-09-20 17:36:11 +01:00
a12b372556 Plugins: Update missed ConversionHandler checks (#92011) 2024-08-16 16:10:32 +03:00
e60b0aef83 Plugins: Add support for ResourceConversion (#91977) 2024-08-15 16:02:21 -04:00
80b2e793ab Loki: Remove unnecessary featuremgmt (#90874)
Loki: Remove unnecessary featuremgmt
2024-07-24 11:00:41 +02:00
f8c43d0bf3 Elasticsearch: Decouple backend from infra/tracing (#90528) 2024-07-19 09:26:10 +02:00
2bb66209ca Chore: make protobuf (#90282) 2024-07-10 19:19:21 +03:00
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
ffc2702552 Plugins: Support Admission validation hooks (#87718) 2024-05-24 18:45:16 +03:00
41b29ff93c Chore: Migrate to use buf for protobuf generation (#87407)
* Chore: Migrate to use buf for protobuf generation

* fix codeowners

* fixes after review

* docs/tooling for installing buf

* add back codeowners

* Update upgrading-dependencies.md

Co-authored-by: Giuseppe Guerra <giuseppe.guerra@grafana.com>

* sdk v0.229.0

---------

Co-authored-by: Giuseppe Guerra <giuseppe.guerra@grafana.com>
2024-05-08 15:42:40 +02:00
40558899e4 Unified Storage: Adds health check service for entity server (#86471) 2024-05-01 11:36:44 -06:00
ec6f59a678 Chore: Update protoc-gen-go (#87116)
Update protoc-gen-go
2024-04-30 12:14:33 +02:00
fbcb9a3677 Chore: Upgrade/fix deps after thema removal (#86763)
* Chore: Upgrade/fix deps after thema removal

* github.com/deepmap/oapi-codegen v1.14.0

* github.com/deepmap/oapi-codegen v1.15.0

* github.com/deepmap/oapi-codegen v1.16.0

* fix for dep used in enterprise

* github.com/deepmap/oapi-codegen/v2 v2.0.0

* oapi-codegen/v2 v2.1.0, kin-openapi v0.122.0, sdk

* keep kin-openapi at v0.122.0 and allow SDK to use v0.124.0

* remove github.com/deepmap/oapi-codegen v1 dep

* fix owner

* add back github.com/deepmap/oapi-codegen v1 dep

* upgrade github.com/influxdata/influxdb-client-go/v2 to get rid of deepmap/oapi-codegen

* migrate to oapi-codegen/runtime

* sdk

* sdk v0.227.0
2024-04-25 20:52:09 +02:00
ac152ca416 Chore: Upgrade grpc-ecosystem/go-grpc-middleware to v2 (#86724)
* Chore: Replace deprecated prometheus grpc middleware

* go mod tidy without enterprise

* with updated sdk branch

* sdk v0.226.0

* remove deprecated opentracing support for outgoing plugin requests

* migrate to github.com/grpc-ecosystem/go-grpc-middleware/v2

* fix
2024-04-25 17:25:48 +02:00
dceb83ab42 Plugins: Expose backendplugin for client proto interface (#86207)
* first pass

* tidy

* add err check

* remove comment

* simplify

* remove unused stuff

* add backend()

* use SDK commit

* add codeowners for go.mod

* fix go.mod

* bump SDK

* go work sync
2024-04-17 18:47:01 +02:00
8f12fb94f9 Plugins: Factory for instantiating core plugin (#85047) 2024-03-25 15:41:26 +01:00
7b4925ea37 Storage: Watch support (#82282)
* initial naive implementation

* Update pkg/services/store/entity/sqlstash/sql_storage_server.go

Co-authored-by: Igor Suleymanov <radiohead@users.noreply.github.com>

* tidy up

* add action column, batch watch events

* initial implementation of broadcast-based watcher

* fix up watch init

* remove batching, it just adds needless complexity

* use StreamWatcher

* make broadcaster generic

* add circular buffer to replay recent events to new watchers

* loop within poll until all events are read

* add index on entity_history.resource_version to support poller

* increment r.Since when we send events to consumer

* switch broadcaster and cache to use channels instead of mutexes

* cleanup

---------

Co-authored-by: Igor Suleymanov <radiohead@users.noreply.github.com>
2024-03-05 10:14:38 -05:00
28e66b4ad8 Rendering: Adds PDF support behind feature toggle (#81811)
* start pdf refactor

* Update AppChrome.tsx

* Update AppChrome.tsx

* add encoding param to rendering grpc service

* fix plugin mode

* clean up

* fix backend tests

* fix lint errors

* Support pdf encoding in render http api

---------

Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
2024-02-08 13:09:34 +01:00
b1c7aa269b Dependencies: Bump github.com/grafana/grafana-plugin-sdk-go from v0.197.0 to v0.198.0 (#79928)
* chore: Bump google.golang.org/grpc from 1.59.0 to 1.60.1

* Bump google.golang.org/protobuf to v1.32.0

* Fix make protobuf failing with latest protoc and protoc-gen-go

* Re-generate protobuf files

* Re-generate protobuf files

* Bump grafana-plugin-sdk-go

* go mod tidy
2024-01-03 13:36:44 +02:00
ce8fd14f1f Plugins: Make renderer service load renderer plugin (#77854)
* rendering service loads renderer plugin

* update naming

* tidy

* apply PR feedback

* fix missing feature manager

* fix step

* set plugin
2023-12-14 17:33:29 +01:00
027a157898 Plugins: Allow disabling "skip host environment variables" per-plugin (#78266)
* Plugins: Allow disabling skipping host environment variables per-plugin

* Renamed SkipEnvVarsDecorateFunc to SkipHostEnvVarsDecorateFunc

* PR review feedback

* fix tests
2023-11-17 16:12:05 +02:00
ddb7406caa Plugins: Add running method to interface (#78326)
* add running to interface

* add context
2023-11-17 13:52:31 +01:00
cb0a88a027 Plugins: Backend: Skip host environment variables (#77858)
* Add pluginsSkipHostEnvVars feature flag

* Set go-plugin's SkipHostEnvVar depending on feature flags

* add missing file

* Re-generate feature flags

* Add allowedHostEnvVarNames

* Fix feature toggles not being passed to plugin context service's plugin env vars

* Fix tests

* PR review feedback: Use cfg.Features

* Fix tests

* PR review feedback: removed DefaultProviderWithFeatures

* merge with master

* fix tests

* use features.IsEnabledGlobally
2023-11-15 18:09:14 +01:00
b3ad61e180 Plugins: Add plugin version field to proto interface (#78213)
add plugin version
2023-11-15 16:53:30 +01:00
fcc2f01c7e Chore: Update otel deps (#78069)
Co-authored-by: Giuseppe Guerra <giuseppe@guerra.in>
Co-authored-by: Giuseppe Guerra <giuseppe.guerra@grafana.com>
2023-11-14 14:14:15 +01:00
4299efbc56 Plugins: Expose PID through proto interface (#77821)
* expose PID thru interface

* apply PR feedback

* simplify

* add read lock
2023-11-13 14:41:53 +01:00
2d391c1bf5 postgresql: change plugin id (#77444)
* postgres: change plugin id

* fixed cue file

* codeowners update

* fixed backend test
2023-11-13 08:49:26 +01:00
19cd7dbae1 Plugins: Add API for creating pluginv2 proto client (#77492)
* first pass

* remove client from plugin

* fix wire

* update

* undo import change

* add opts

* add check

* tidy

* re-use logic

* rollback changes
2023-11-03 14:01:08 +01:00
2adfdb49c9 Update grafana-plugin-go-sdk to v0.187.0 (#76816) 2023-10-19 16:17:31 +02:00
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
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 151f6d6216e5e93edf56e4bbc6d3bfa5e0690b45.
2023-10-13 12:35:16 -04:00
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