Add some more diagnostics for plugins (#7669)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
539f66313d
Коммит
09c5f5e2ea
@@ -47,6 +47,7 @@ const (
|
||||
TRACK_ACTIVITY = "activity"
|
||||
TRACK_LICENSE = "license"
|
||||
TRACK_SERVER = "server"
|
||||
TRACK_PLUGINS = "plugins"
|
||||
)
|
||||
|
||||
var client *analytics.Client
|
||||
@@ -57,6 +58,7 @@ func (a *App) SendDailyDiagnostics() {
|
||||
a.trackActivity()
|
||||
a.trackConfig()
|
||||
trackLicense()
|
||||
a.trackPlugins()
|
||||
a.trackServer()
|
||||
}
|
||||
}
|
||||
@@ -445,7 +447,9 @@ func (a *App) trackConfig() {
|
||||
})
|
||||
|
||||
SendDiagnostic(TRACK_CONFIG_PLUGIN, map[string]interface{}{
|
||||
"enable_jira": pluginSetting(&cfg.PluginSettings, "jira", "enabled", false),
|
||||
"enable_jira": pluginSetting(&cfg.PluginSettings, "jira", "enabled", false),
|
||||
"enable": *utils.Cfg.PluginSettings.Enable,
|
||||
"enable_uploads": *utils.Cfg.PluginSettings.EnableUploads,
|
||||
})
|
||||
|
||||
SendDiagnostic(TRACK_CONFIG_DATA_RETENTION, map[string]interface{}{
|
||||
@@ -477,6 +481,54 @@ func trackLicense() {
|
||||
}
|
||||
}
|
||||
|
||||
func (a *App) trackPlugins() {
|
||||
if *a.Config().PluginSettings.Enable {
|
||||
totalActiveCount := -1 // -1 to indicate disabled or error
|
||||
webappActiveCount := 0
|
||||
backendActiveCount := 0
|
||||
totalInactiveCount := -1 // -1 to indicate disabled or error
|
||||
webappInactiveCount := 0
|
||||
backendInactiveCount := 0
|
||||
|
||||
plugins, _ := a.GetPluginManifests()
|
||||
|
||||
if plugins != nil {
|
||||
totalActiveCount = len(plugins.Active)
|
||||
|
||||
for _, plugin := range plugins.Active {
|
||||
if plugin.Webapp != nil {
|
||||
webappActiveCount += 1
|
||||
}
|
||||
|
||||
if plugin.Backend != nil {
|
||||
backendActiveCount += 1
|
||||
}
|
||||
}
|
||||
|
||||
totalInactiveCount = len(plugins.Inactive)
|
||||
|
||||
for _, plugin := range plugins.Inactive {
|
||||
if plugin.Webapp != nil {
|
||||
webappInactiveCount += 1
|
||||
}
|
||||
|
||||
if plugin.Backend != nil {
|
||||
backendInactiveCount += 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SendDiagnostic(TRACK_PLUGINS, map[string]interface{}{
|
||||
"active_plugins": totalActiveCount,
|
||||
"active_webapp_plugins": webappActiveCount,
|
||||
"active_backend_plugins": backendActiveCount,
|
||||
"inactive_plugins": totalInactiveCount,
|
||||
"inactive_webapp_plugins": webappInactiveCount,
|
||||
"inactive_backend_plugins": backendInactiveCount,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (a *App) trackServer() {
|
||||
data := map[string]interface{}{
|
||||
"edition": model.BuildEnterpriseReady,
|
||||
|
||||
@@ -135,6 +135,7 @@ func TestDiagnostics(t *testing.T) {
|
||||
TRACK_CONFIG_PLUGIN,
|
||||
TRACK_ACTIVITY,
|
||||
TRACK_SERVER,
|
||||
TRACK_PLUGINS,
|
||||
} {
|
||||
if !strings.Contains(info, item) {
|
||||
t.Fatal("Sent diagnostics missing item: " + item)
|
||||
|
||||
Ссылка в новой задаче
Block a user