diff options
-rw-r--r-- | app/diagnostics.go | 2 | ||||
-rw-r--r-- | einterfaces/cluster.go | 1 | ||||
-rw-r--r-- | model/cluster_info.go | 1 | ||||
-rw-r--r-- | utils/config.go | 8 |
4 files changed, 11 insertions, 1 deletions
diff --git a/app/diagnostics.go b/app/diagnostics.go index 2eae5871d..1df5b1feb 100644 --- a/app/diagnostics.go +++ b/app/diagnostics.go @@ -49,7 +49,7 @@ const ( var client *analytics.Client func SendDailyDiagnostics() { - if *utils.Cfg.LogSettings.EnableDiagnostics { + if *utils.Cfg.LogSettings.EnableDiagnostics && utils.IsLeader() { initDiagnostics("") trackActivity() trackConfig() diff --git a/einterfaces/cluster.go b/einterfaces/cluster.go index 096a775fe..9d61b7503 100644 --- a/einterfaces/cluster.go +++ b/einterfaces/cluster.go @@ -14,6 +14,7 @@ type ClusterInterface interface { StopInterNodeCommunication() RegisterClusterMessageHandler(event string, crm ClusterMessageHandler) GetClusterId() string + IsLeader() bool GetClusterInfos() []*model.ClusterInfo SendClusterMessage(cluster *model.ClusterMessage) NotifyMsg(buf []byte) diff --git a/model/cluster_info.go b/model/cluster_info.go index 1e468044e..c4f7e89a6 100644 --- a/model/cluster_info.go +++ b/model/cluster_info.go @@ -10,6 +10,7 @@ import ( ) type ClusterInfo struct { + Id string `json:"id"` Version string `json:"version"` ConfigHash string `json:"config_hash"` IpAddress string `json:"ipaddress"` diff --git a/utils/config.go b/utils/config.go index 187af4125..af88f816e 100644 --- a/utils/config.go +++ b/utils/config.go @@ -653,3 +653,11 @@ func Desanitize(cfg *model.Config) { cfg.SqlSettings.DataSourceSearchReplicas[i] = Cfg.SqlSettings.DataSourceSearchReplicas[i] } } + +func IsLeader() bool { + if IsLicensed && *Cfg.ClusterSettings.Enable && einterfaces.GetClusterInterface() != nil { + return einterfaces.GetClusterInterface().IsLeader() + } else { + return true + } +} |