diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 7abd2692bdb..188d783eccb 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -255,7 +255,7 @@ # BI backend code /pkg/tsdb/mysql/ @grafana/oss-big-tent -/pkg/tsdb/postgres/ @grafana/oss-big-tent +/pkg/tsdb/grafana-postgresql-datasource/ @grafana/oss-big-tent /pkg/tsdb/mssql/ @grafana/grafana-bi-squad # Database migrations @@ -544,7 +544,7 @@ scripts/generate-icon-bundle.js @grafana/plugins-platform-frontend @grafana/graf /public/app/plugins/datasource/mssql/ @grafana/grafana-bi-squad /public/app/plugins/datasource/mysql/ @grafana/oss-big-tent /public/app/plugins/datasource/opentsdb/ @grafana/observability-metrics -/public/app/plugins/datasource/postgres/ @grafana/oss-big-tent +/public/app/plugins/datasource/grafana-postgresql-datasource/ @grafana/oss-big-tent /public/app/plugins/datasource/prometheus/ @grafana/observability-metrics /public/app/plugins/datasource/cloud-monitoring/ @grafana/partner-datasources /public/app/plugins/datasource/zipkin/ @grafana/observability-traces-and-profiling diff --git a/.github/pr-commands.json b/.github/pr-commands.json index ec60e516e21..27ac70337c0 100644 --- a/.github/pr-commands.json +++ b/.github/pr-commands.json @@ -149,7 +149,7 @@ }, { "type": "changedfiles", - "matches": [ "public/app/plugins/datasource/postgres/**/*", "pkg/tsdb/postgres/**/*"], + "matches": [ "public/app/plugins/datasource/grafana-postgresql-datasource/**/*", "pkg/tsdb/grafana-postgresql-datasource/**/*"], "action": "updateLabel", "addLabel": "datasource/Postgres" }, diff --git a/pkg/plugins/backendplugin/coreplugin/registry.go b/pkg/plugins/backendplugin/coreplugin/registry.go index 933ee377c2d..44c8a045e33 100644 --- a/pkg/plugins/backendplugin/coreplugin/registry.go +++ b/pkg/plugins/backendplugin/coreplugin/registry.go @@ -15,6 +15,7 @@ import ( cloudmonitoring "github.com/grafana/grafana/pkg/tsdb/cloud-monitoring" "github.com/grafana/grafana/pkg/tsdb/cloudwatch" "github.com/grafana/grafana/pkg/tsdb/elasticsearch" + postgres "github.com/grafana/grafana/pkg/tsdb/grafana-postgresql-datasource" pyroscope "github.com/grafana/grafana/pkg/tsdb/grafana-pyroscope-datasource" testdatasource "github.com/grafana/grafana/pkg/tsdb/grafana-testdata-datasource" "github.com/grafana/grafana/pkg/tsdb/grafanads" @@ -25,7 +26,6 @@ import ( "github.com/grafana/grafana/pkg/tsdb/mysql" "github.com/grafana/grafana/pkg/tsdb/opentsdb" "github.com/grafana/grafana/pkg/tsdb/parca" - "github.com/grafana/grafana/pkg/tsdb/postgres" "github.com/grafana/grafana/pkg/tsdb/prometheus" "github.com/grafana/grafana/pkg/tsdb/tempo" ) @@ -42,7 +42,7 @@ const ( Prometheus = "prometheus" Tempo = "tempo" TestData = "grafana-testdata-datasource" - PostgreSQL = "postgres" + PostgreSQL = "grafana-postgresql-datasource" MySQL = "mysql" MSSQL = "mssql" Grafana = "grafana" diff --git a/pkg/plugins/pfs/corelist/corelist_load_gen.go b/pkg/plugins/pfs/corelist/corelist_load_gen.go index de2a8fbff57..3394d9fe03d 100644 --- a/pkg/plugins/pfs/corelist/corelist_load_gen.go +++ b/pkg/plugins/pfs/corelist/corelist_load_gen.go @@ -39,6 +39,7 @@ func corePlugins(rt *thema.Runtime) []pfs.ParsedPlugin { parsePluginOrPanic("public/app/plugins/datasource/dashboard", "dashboard", rt), parsePluginOrPanic("public/app/plugins/datasource/elasticsearch", "elasticsearch", rt), parsePluginOrPanic("public/app/plugins/datasource/grafana", "grafana", rt), + parsePluginOrPanic("public/app/plugins/datasource/grafana-postgresql-datasource", "grafana_postgresql_datasource", rt), parsePluginOrPanic("public/app/plugins/datasource/grafana-pyroscope-datasource", "grafana_pyroscope_datasource", rt), parsePluginOrPanic("public/app/plugins/datasource/grafana-testdata-datasource", "grafana_testdata_datasource", rt), parsePluginOrPanic("public/app/plugins/datasource/graphite", "graphite", rt), @@ -47,7 +48,6 @@ func corePlugins(rt *thema.Runtime) []pfs.ParsedPlugin { parsePluginOrPanic("public/app/plugins/datasource/mssql", "mssql", rt), parsePluginOrPanic("public/app/plugins/datasource/mysql", "mysql", rt), parsePluginOrPanic("public/app/plugins/datasource/parca", "parca", rt), - parsePluginOrPanic("public/app/plugins/datasource/postgres", "postgres", rt), parsePluginOrPanic("public/app/plugins/datasource/prometheus", "prometheus", rt), parsePluginOrPanic("public/app/plugins/datasource/tempo", "tempo", rt), parsePluginOrPanic("public/app/plugins/datasource/zipkin", "zipkin", rt), diff --git a/pkg/plugins/plugins.go b/pkg/plugins/plugins.go index 186520310ec..2abf01705f1 100644 --- a/pkg/plugins/plugins.go +++ b/pkg/plugins/plugins.go @@ -137,6 +137,8 @@ func ReadPluginJSON(reader io.Reader) (JSONData, error) { fallthrough case "grafana-testdata-datasource": fallthrough + case "grafana-postgresql-datasource": + fallthrough case "annolist": fallthrough case "debug": diff --git a/pkg/server/wire.go b/pkg/server/wire.go index 0822df70718..ea242d21120 100644 --- a/pkg/server/wire.go +++ b/pkg/server/wire.go @@ -156,6 +156,7 @@ import ( cloudmonitoring "github.com/grafana/grafana/pkg/tsdb/cloud-monitoring" "github.com/grafana/grafana/pkg/tsdb/cloudwatch" "github.com/grafana/grafana/pkg/tsdb/elasticsearch" + postgres "github.com/grafana/grafana/pkg/tsdb/grafana-postgresql-datasource" pyroscope "github.com/grafana/grafana/pkg/tsdb/grafana-pyroscope-datasource" testdatasource "github.com/grafana/grafana/pkg/tsdb/grafana-testdata-datasource" "github.com/grafana/grafana/pkg/tsdb/grafanads" @@ -168,7 +169,6 @@ import ( "github.com/grafana/grafana/pkg/tsdb/mysql" "github.com/grafana/grafana/pkg/tsdb/opentsdb" "github.com/grafana/grafana/pkg/tsdb/parca" - "github.com/grafana/grafana/pkg/tsdb/postgres" "github.com/grafana/grafana/pkg/tsdb/prometheus" "github.com/grafana/grafana/pkg/tsdb/tempo" ) diff --git a/pkg/services/datasources/models.go b/pkg/services/datasources/models.go index cbda760f0fb..0006523b6fe 100644 --- a/pkg/services/datasources/models.go +++ b/pkg/services/datasources/models.go @@ -23,7 +23,7 @@ const ( DS_TEMPO = "tempo" DS_ZIPKIN = "zipkin" DS_MYSQL = "mysql" - DS_POSTGRES = "postgres" + DS_POSTGRES = "grafana-postgresql-datasource" DS_MSSQL = "mssql" DS_ACCESS_DIRECT = "direct" DS_ACCESS_PROXY = "proxy" diff --git a/pkg/services/pluginsintegration/plugins_integration_test.go b/pkg/services/pluginsintegration/plugins_integration_test.go index c0d75900477..e912999f86d 100644 --- a/pkg/services/pluginsintegration/plugins_integration_test.go +++ b/pkg/services/pluginsintegration/plugins_integration_test.go @@ -27,6 +27,7 @@ import ( cloudmonitoring "github.com/grafana/grafana/pkg/tsdb/cloud-monitoring" "github.com/grafana/grafana/pkg/tsdb/cloudwatch" "github.com/grafana/grafana/pkg/tsdb/elasticsearch" + postgres "github.com/grafana/grafana/pkg/tsdb/grafana-postgresql-datasource" pyroscope "github.com/grafana/grafana/pkg/tsdb/grafana-pyroscope-datasource" testdatasource "github.com/grafana/grafana/pkg/tsdb/grafana-testdata-datasource" "github.com/grafana/grafana/pkg/tsdb/grafanads" @@ -37,7 +38,6 @@ import ( "github.com/grafana/grafana/pkg/tsdb/mysql" "github.com/grafana/grafana/pkg/tsdb/opentsdb" "github.com/grafana/grafana/pkg/tsdb/parca" - "github.com/grafana/grafana/pkg/tsdb/postgres" "github.com/grafana/grafana/pkg/tsdb/prometheus" "github.com/grafana/grafana/pkg/tsdb/tempo" ) @@ -185,7 +185,7 @@ func verifyCorePluginCatalogue(t *testing.T, ctx context.Context, ps *pluginstor "prometheus": {}, "tempo": {}, "grafana-testdata-datasource": {}, - "postgres": {}, + "grafana-postgresql-datasource": {}, "mysql": {}, "mssql": {}, "grafana": {}, diff --git a/pkg/tests/api/plugins/data/expectedListResp.json b/pkg/tests/api/plugins/data/expectedListResp.json index acb65047be2..339b230d01f 100644 --- a/pkg/tests/api/plugins/data/expectedListResp.json +++ b/pkg/tests/api/plugins/data/expectedListResp.json @@ -1292,7 +1292,7 @@ { "name": "PostgreSQL", "type": "datasource", - "id": "postgres", + "id": "grafana-postgresql-datasource", "enabled": true, "pinned": false, "info": { @@ -1303,8 +1303,8 @@ "description": "Data source for PostgreSQL and compatible databases", "links": null, "logos": { - "small": "/public/app/plugins/datasource/postgres/img/postgresql_logo.svg", - "large": "/public/app/plugins/datasource/postgres/img/postgresql_logo.svg" + "small": "/public/app/plugins/datasource/grafana-postgresql-datasource/img/postgresql_logo.svg", + "large": "/public/app/plugins/datasource/grafana-postgresql-datasource/img/postgresql_logo.svg" }, "build": {}, "screenshots": null, @@ -1318,7 +1318,7 @@ }, "latestVersion": "", "hasUpdate": false, - "defaultNavUrl": "/plugins/postgres/", + "defaultNavUrl": "/plugins/grafana-postgresql-datasource/", "category": "sql", "state": "", "signature": "internal", diff --git a/pkg/tsdb/postgres/locker.go b/pkg/tsdb/grafana-postgresql-datasource/locker.go similarity index 100% rename from pkg/tsdb/postgres/locker.go rename to pkg/tsdb/grafana-postgresql-datasource/locker.go diff --git a/pkg/tsdb/postgres/locker_test.go b/pkg/tsdb/grafana-postgresql-datasource/locker_test.go similarity index 100% rename from pkg/tsdb/postgres/locker_test.go rename to pkg/tsdb/grafana-postgresql-datasource/locker_test.go diff --git a/pkg/tsdb/postgres/macros.go b/pkg/tsdb/grafana-postgresql-datasource/macros.go similarity index 100% rename from pkg/tsdb/postgres/macros.go rename to pkg/tsdb/grafana-postgresql-datasource/macros.go diff --git a/pkg/tsdb/postgres/macros_test.go b/pkg/tsdb/grafana-postgresql-datasource/macros_test.go similarity index 100% rename from pkg/tsdb/postgres/macros_test.go rename to pkg/tsdb/grafana-postgresql-datasource/macros_test.go diff --git a/pkg/tsdb/postgres/postgres.go b/pkg/tsdb/grafana-postgresql-datasource/postgres.go similarity index 100% rename from pkg/tsdb/postgres/postgres.go rename to pkg/tsdb/grafana-postgresql-datasource/postgres.go diff --git a/pkg/tsdb/postgres/postgres_test.go b/pkg/tsdb/grafana-postgresql-datasource/postgres_test.go similarity index 99% rename from pkg/tsdb/postgres/postgres_test.go rename to pkg/tsdb/grafana-postgresql-datasource/postgres_test.go index 133d5d7b3e6..cca2d6160c3 100644 --- a/pkg/tsdb/postgres/postgres_test.go +++ b/pkg/tsdb/grafana-postgresql-datasource/postgres_test.go @@ -166,7 +166,7 @@ func TestIntegrationGenerateConnectionString(t *testing.T) { } // To run this test, set runPostgresTests=true -// Or from the commandline: GRAFANA_TEST_DB=postgres go test -tags=integration -v ./pkg/tsdb/postgres +// Or from the commandline: GRAFANA_TEST_DB=postgres go test -tags=integration -v ./pkg/tsdb/grafana-postgresql-datasource // The tests require a PostgreSQL db named grafanadstest and a user/password grafanatest/grafanatest! // Use the docker/blocks/postgres_tests/docker-compose.yaml to spin up a // preconfigured Postgres server suitable for running these tests. diff --git a/pkg/tsdb/postgres/proxy.go b/pkg/tsdb/grafana-postgresql-datasource/proxy.go similarity index 100% rename from pkg/tsdb/postgres/proxy.go rename to pkg/tsdb/grafana-postgresql-datasource/proxy.go diff --git a/pkg/tsdb/postgres/proxy_test.go b/pkg/tsdb/grafana-postgresql-datasource/proxy_test.go similarity index 100% rename from pkg/tsdb/postgres/proxy_test.go rename to pkg/tsdb/grafana-postgresql-datasource/proxy_test.go diff --git a/pkg/tsdb/postgres/tlsmanager.go b/pkg/tsdb/grafana-postgresql-datasource/tlsmanager.go similarity index 100% rename from pkg/tsdb/postgres/tlsmanager.go rename to pkg/tsdb/grafana-postgresql-datasource/tlsmanager.go diff --git a/pkg/tsdb/postgres/tlsmanager_test.go b/pkg/tsdb/grafana-postgresql-datasource/tlsmanager_test.go similarity index 100% rename from pkg/tsdb/postgres/tlsmanager_test.go rename to pkg/tsdb/grafana-postgresql-datasource/tlsmanager_test.go diff --git a/public/app/features/plugins/built_in_plugins.ts b/public/app/features/plugins/built_in_plugins.ts index fe48f0b03ae..cb939419d1f 100644 --- a/public/app/features/plugins/built_in_plugins.ts +++ b/public/app/features/plugins/built_in_plugins.ts @@ -22,7 +22,7 @@ const mixedPlugin = async () => const mysqlPlugin = async () => await import(/* webpackChunkName: "mysqlPlugin" */ 'app/plugins/datasource/mysql/module'); const postgresPlugin = async () => - await import(/* webpackChunkName: "postgresPlugin" */ 'app/plugins/datasource/postgres/module'); + await import(/* webpackChunkName: "postgresPlugin" */ 'app/plugins/datasource/grafana-postgresql-datasource/module'); const prometheusPlugin = async () => await import(/* webpackChunkName: "prometheusPlugin" */ 'app/plugins/datasource/prometheus/module'); const mssqlPlugin = async () => @@ -94,7 +94,7 @@ const builtInPlugins: Record Promise