summaryrefslogtreecommitdiffstats
path: root/app/diagnostics.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2017-10-30 14:10:48 -0400
committerGitHub <noreply@github.com>2017-10-30 14:10:48 -0400
commit09c5f5e2eacb9705f5675c51493776c5618e0716 (patch)
tree1bab6e2155f1b70835f1d24e96e0f35892985b83 /app/diagnostics.go
parent539f66313d4f23231aba73119dfc2e8340df1400 (diff)
downloadchat-09c5f5e2eacb9705f5675c51493776c5618e0716.tar.gz
chat-09c5f5e2eacb9705f5675c51493776c5618e0716.tar.bz2
chat-09c5f5e2eacb9705f5675c51493776c5618e0716.zip
Add some more diagnostics for plugins (#7669)
Diffstat (limited to 'app/diagnostics.go')
-rw-r--r--app/diagnostics.go54
1 files changed, 53 insertions, 1 deletions
diff --git a/app/diagnostics.go b/app/diagnostics.go
index c0499bd89..4974d6444 100644
--- a/app/diagnostics.go
+++ b/app/diagnostics.go
@@ -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,