Plugins: Add optional logger for plugin requests sent to backend plugins (#62981)

Signed-off-by: bergquist <carl.bergquist@gmail.com>
This commit is contained in:
Carl Bergquist
2023-02-07 12:49:16 +01:00
committed by GitHub
parent 7384ec0c3d
commit 2a29a07465
9 changed files with 8 additions and 14 deletions
+2
View File
@@ -1218,6 +1218,8 @@ plugin_admin_external_manage_enabled = false
plugin_catalog_url = https://grafana.com/grafana/plugins/ plugin_catalog_url = https://grafana.com/grafana/plugins/
# Enter a comma-separated list of plugin identifiers to hide in the plugin catalog. # Enter a comma-separated list of plugin identifiers to hide in the plugin catalog.
plugin_catalog_hidden_plugins = plugin_catalog_hidden_plugins =
# Log all backend requests for core and external plugins.
log_backend_requests = false
#################################### Grafana Live ########################################## #################################### Grafana Live ##########################################
[live] [live]
+2
View File
@@ -1176,6 +1176,8 @@
;plugin_catalog_url = https://grafana.com/grafana/plugins/ ;plugin_catalog_url = https://grafana.com/grafana/plugins/
# Enter a comma-separated list of plugin identifiers to hide in the plugin catalog. # Enter a comma-separated list of plugin identifiers to hide in the plugin catalog.
;plugin_catalog_hidden_plugins = ;plugin_catalog_hidden_plugins =
# Log all backend requests for core and external plugins.
;log_backend_requests = false
#################################### Grafana Live ########################################## #################################### Grafana Live ##########################################
[live] [live]
@@ -44,7 +44,6 @@ Some stable features are enabled by default. You can disable a stable feature by
| `validateDashboardsOnSave` | Validate dashboard JSON POSTed to api/dashboards/db | | `validateDashboardsOnSave` | Validate dashboard JSON POSTed to api/dashboards/db |
| `autoMigrateGraphPanels` | Replace the angular graph panel with timeseries | | `autoMigrateGraphPanels` | Replace the angular graph panel with timeseries |
| `topnav` | Displays new top nav and page layouts | | `topnav` | Displays new top nav and page layouts |
| `datasourceLogger` | Logs all datasource requests |
| `accessControlOnCall` | Access control primitives for OnCall | | `accessControlOnCall` | Access control primitives for OnCall |
| `alertingNoNormalState` | Stop maintaining state of alerts that are not firing | | `alertingNoNormalState` | Stop maintaining state of alerts that are not firing |
| `topNavCommandPalette` | Launch the Command Palette from the top navigation search box | | `topNavCommandPalette` | Launch the Command Palette from the top navigation search box |
@@ -70,7 +70,6 @@ export interface FeatureToggles {
queryLibrary?: boolean; queryLibrary?: boolean;
showDashboardValidationWarnings?: boolean; showDashboardValidationWarnings?: boolean;
mysqlAnsiQuotes?: boolean; mysqlAnsiQuotes?: boolean;
datasourceLogger?: boolean;
accessControlOnCall?: boolean; accessControlOnCall?: boolean;
nestedFolders?: boolean; nestedFolders?: boolean;
accessTokenExpirationCheck?: boolean; accessTokenExpirationCheck?: boolean;
+1 -2
View File
@@ -6,7 +6,6 @@ import (
"github.com/grafana/grafana-azure-sdk-go/azsettings" "github.com/grafana/grafana-azure-sdk-go/azsettings"
"github.com/grafana/grafana/pkg/infra/log" "github.com/grafana/grafana/pkg/infra/log"
"github.com/grafana/grafana/pkg/services/featuremgmt"
"github.com/grafana/grafana/pkg/setting" "github.com/grafana/grafana/pkg/setting"
) )
@@ -64,7 +63,7 @@ func NewCfg(settingProvider setting.Provider, grafanaCfg *setting.Cfg) *Cfg {
AWSAllowedAuthProviders: allowedAuth, AWSAllowedAuthProviders: allowedAuth,
AWSAssumeRoleEnabled: aws.KeyValue("assume_role_enabled").MustBool(grafanaCfg.AWSAssumeRoleEnabled), AWSAssumeRoleEnabled: aws.KeyValue("assume_role_enabled").MustBool(grafanaCfg.AWSAssumeRoleEnabled),
Azure: grafanaCfg.Azure, Azure: grafanaCfg.Azure,
LogDatasourceRequests: grafanaCfg.IsFeatureToggleEnabled(featuremgmt.FlagDatasourceLogger), LogDatasourceRequests: grafanaCfg.PluginLogBackendRequests,
PluginsCDNURLTemplate: grafanaCfg.PluginsCDNURLTemplate, PluginsCDNURLTemplate: grafanaCfg.PluginsCDNURLTemplate,
} }
} }
-5
View File
@@ -306,11 +306,6 @@ var (
Description: "Use double quotes to escape keyword in a MySQL query", Description: "Use double quotes to escape keyword in a MySQL query",
State: FeatureStateAlpha, State: FeatureStateAlpha,
}, },
{
Name: "datasourceLogger",
Description: "Logs all datasource requests",
State: FeatureStateBeta,
},
{ {
Name: "accessControlOnCall", Name: "accessControlOnCall",
Description: "Access control primitives for OnCall", Description: "Access control primitives for OnCall",
-4
View File
@@ -223,10 +223,6 @@ const (
// Use double quotes to escape keyword in a MySQL query // Use double quotes to escape keyword in a MySQL query
FlagMysqlAnsiQuotes = "mysqlAnsiQuotes" FlagMysqlAnsiQuotes = "mysqlAnsiQuotes"
// FlagDatasourceLogger
// Logs all datasource requests
FlagDatasourceLogger = "datasourceLogger"
// FlagAccessControlOnCall // FlagAccessControlOnCall
// Access control primitives for OnCall // Access control primitives for OnCall
FlagAccessControlOnCall = "accessControlOnCall" FlagAccessControlOnCall = "accessControlOnCall"
+2 -1
View File
@@ -276,7 +276,8 @@ type Cfg struct {
PluginAdminEnabled bool PluginAdminEnabled bool
PluginAdminExternalManageEnabled bool PluginAdminExternalManageEnabled bool
PluginsCDNURLTemplate string PluginsCDNURLTemplate string
PluginLogBackendRequests bool
// Panels // Panels
DisableSanitizeHtml bool DisableSanitizeHtml bool
+1
View File
@@ -50,6 +50,7 @@ func (cfg *Cfg) readPluginSettings(iniFile *ini.File) error {
// Plugins CDN settings // Plugins CDN settings
cfg.PluginsCDNURLTemplate = strings.TrimRight(pluginsSection.Key("cdn_base_url").MustString(""), "/") cfg.PluginsCDNURLTemplate = strings.TrimRight(pluginsSection.Key("cdn_base_url").MustString(""), "/")
cfg.PluginLogBackendRequests = pluginsSection.Key("log_backend_requests").MustBool(false)
return nil return nil
} }