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

Signed-off-by: bergquist <carl.bergquist@gmail.com>
pull/63016/head
Carl Bergquist 2 years ago committed by GitHub
parent 7384ec0c3d
commit 2a29a07465
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      conf/defaults.ini
  2. 2
      conf/sample.ini
  3. 1
      docs/sources/setup-grafana/configure-grafana/feature-toggles/index.md
  4. 1
      packages/grafana-data/src/types/featureToggles.gen.ts
  5. 3
      pkg/plugins/config/config.go
  6. 5
      pkg/services/featuremgmt/registry.go
  7. 4
      pkg/services/featuremgmt/toggles_gen.go
  8. 3
      pkg/setting/setting.go
  9. 1
      pkg/setting/setting_plugins.go

@ -1218,6 +1218,8 @@ plugin_admin_external_manage_enabled = false
plugin_catalog_url = https://grafana.com/grafana/plugins/
# Enter a comma-separated list of plugin identifiers to hide in the plugin catalog.
plugin_catalog_hidden_plugins =
# Log all backend requests for core and external plugins.
log_backend_requests = false
#################################### Grafana Live ##########################################
[live]

@ -1176,6 +1176,8 @@
;plugin_catalog_url = https://grafana.com/grafana/plugins/
# Enter a comma-separated list of plugin identifiers to hide in the plugin catalog.
;plugin_catalog_hidden_plugins =
# Log all backend requests for core and external plugins.
;log_backend_requests = false
#################################### Grafana 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 |
| `autoMigrateGraphPanels` | Replace the angular graph panel with timeseries |
| `topnav` | Displays new top nav and page layouts |
| `datasourceLogger` | Logs all datasource requests |
| `accessControlOnCall` | Access control primitives for OnCall |
| `alertingNoNormalState` | Stop maintaining state of alerts that are not firing |
| `topNavCommandPalette` | Launch the Command Palette from the top navigation search box |

@ -70,7 +70,6 @@ export interface FeatureToggles {
queryLibrary?: boolean;
showDashboardValidationWarnings?: boolean;
mysqlAnsiQuotes?: boolean;
datasourceLogger?: boolean;
accessControlOnCall?: boolean;
nestedFolders?: boolean;
accessTokenExpirationCheck?: boolean;

@ -6,7 +6,6 @@ import (
"github.com/grafana/grafana-azure-sdk-go/azsettings"
"github.com/grafana/grafana/pkg/infra/log"
"github.com/grafana/grafana/pkg/services/featuremgmt"
"github.com/grafana/grafana/pkg/setting"
)
@ -64,7 +63,7 @@ func NewCfg(settingProvider setting.Provider, grafanaCfg *setting.Cfg) *Cfg {
AWSAllowedAuthProviders: allowedAuth,
AWSAssumeRoleEnabled: aws.KeyValue("assume_role_enabled").MustBool(grafanaCfg.AWSAssumeRoleEnabled),
Azure: grafanaCfg.Azure,
LogDatasourceRequests: grafanaCfg.IsFeatureToggleEnabled(featuremgmt.FlagDatasourceLogger),
LogDatasourceRequests: grafanaCfg.PluginLogBackendRequests,
PluginsCDNURLTemplate: grafanaCfg.PluginsCDNURLTemplate,
}
}

@ -306,11 +306,6 @@ var (
Description: "Use double quotes to escape keyword in a MySQL query",
State: FeatureStateAlpha,
},
{
Name: "datasourceLogger",
Description: "Logs all datasource requests",
State: FeatureStateBeta,
},
{
Name: "accessControlOnCall",
Description: "Access control primitives for OnCall",

@ -223,10 +223,6 @@ const (
// Use double quotes to escape keyword in a MySQL query
FlagMysqlAnsiQuotes = "mysqlAnsiQuotes"
// FlagDatasourceLogger
// Logs all datasource requests
FlagDatasourceLogger = "datasourceLogger"
// FlagAccessControlOnCall
// Access control primitives for OnCall
FlagAccessControlOnCall = "accessControlOnCall"

@ -276,7 +276,8 @@ type Cfg struct {
PluginAdminEnabled bool
PluginAdminExternalManageEnabled bool
PluginsCDNURLTemplate string
PluginsCDNURLTemplate string
PluginLogBackendRequests bool
// Panels
DisableSanitizeHtml bool

@ -50,6 +50,7 @@ func (cfg *Cfg) readPluginSettings(iniFile *ini.File) error {
// Plugins CDN settings
cfg.PluginsCDNURLTemplate = strings.TrimRight(pluginsSection.Key("cdn_base_url").MustString(""), "/")
cfg.PluginLogBackendRequests = pluginsSection.Key("log_backend_requests").MustBool(false)
return nil
}

Loading…
Cancel
Save