MM-12389 Update segment library to v3 (#11472)

* Update analytics-go dependency

* Migrate from segment library v2 to v3

* Reinclude gorilla/handlers module

* Fix missing module

* Remove reference to outdated analytics module
Этот коммит содержится в:
Claudio Costa
2019-07-04 21:26:41 +02:00
коммит произвёл Christopher Speller
родитель c9e289f828
Коммит d844c52f06
34 изменённых файлов: 1599 добавлений и 459 удалений

Просмотреть файл

@@ -75,7 +75,7 @@ func (a *App) sendDailyDiagnostics(override bool) {
}
func (a *App) SendDiagnostic(event string, properties map[string]interface{}) {
a.Srv.diagnosticClient.Track(&analytics.Track{
a.Srv.diagnosticClient.Enqueue(&analytics.Track{
Event: event,
UserId: a.DiagnosticId(),
Properties: properties,

Просмотреть файл

@@ -103,7 +103,7 @@ type Server struct {
limitedClientConfig map[string]string
diagnosticId string
diagnosticClient *analytics.Client
diagnosticClient analytics.Client
phase2PermissionsMigrationComplete bool
@@ -745,15 +745,16 @@ func (s *Server) StartElasticsearch() {
func (s *Server) initDiagnostics(endpoint string) {
if s.diagnosticClient == nil {
client := analytics.New(SEGMENT_KEY)
client.Logger = s.Log.StdLog(mlog.String("source", "segment"))
config := analytics.Config{}
config.Logger = analytics.StdLogger(s.Log.StdLog(mlog.String("source", "segment")))
// For testing
if endpoint != "" {
client.Endpoint = endpoint
client.Verbose = true
client.Size = 1
config.Endpoint = endpoint
config.Verbose = true
config.BatchSize = 1
}
client.Identify(&analytics.Identify{
client, _ := analytics.NewWithConfig(SEGMENT_KEY, config)
client.Enqueue(&analytics.Identify{
UserId: s.diagnosticId,
})
@@ -761,7 +762,7 @@ func (s *Server) initDiagnostics(endpoint string) {
}
}
// ShutdownDiagnostics closes the diagnostic client.
// shutdownDiagnostics closes the diagnostic client.
func (s *Server) shutdownDiagnostics() error {
if s.diagnosticClient != nil {
return s.diagnosticClient.Close()