Add server id to plugin telemetry (#903)
This commit is contained in:
parent
1914b5a921
commit
904dfc2158
5 changed files with 11 additions and 6 deletions
|
@ -59,7 +59,7 @@ func runServer(port int) (*server.Server, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
server, err := server.New(config, sessionToken, db, logger)
|
||||
server, err := server.New(config, sessionToken, db, logger, "")
|
||||
if err != nil {
|
||||
fmt.Println("ERROR INITIALIZING THE SERVER", err)
|
||||
return nil, err
|
||||
|
|
|
@ -142,7 +142,9 @@ func (p *Plugin) OnActivate() error {
|
|||
db = layeredStore
|
||||
}
|
||||
|
||||
server, err := server.New(cfg, "", db, logger)
|
||||
serverID := client.System.GetDiagnosticID()
|
||||
|
||||
server, err := server.New(cfg, "", db, logger, serverID)
|
||||
if err != nil {
|
||||
fmt.Println("ERROR INITIALIZING THE SERVER", err)
|
||||
return err
|
||||
|
|
|
@ -74,7 +74,7 @@ func SetupTestHelper() *TestHelper {
|
|||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
srv, err := server.New(cfg, sessionToken, db, logger)
|
||||
srv, err := server.New(cfg, sessionToken, db, logger, "")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
|
@ -165,7 +165,7 @@ func main() {
|
|||
logger.Fatal("server.NewStore ERROR", mlog.Err(err))
|
||||
}
|
||||
|
||||
server, err := server.New(config, singleUserToken, db, logger)
|
||||
server, err := server.New(config, singleUserToken, db, logger, "")
|
||||
if err != nil {
|
||||
logger.Fatal("server.New ERROR", mlog.Err(err))
|
||||
}
|
||||
|
@ -245,7 +245,7 @@ func startServer(webPath string, filesPath string, port int, singleUserToken, db
|
|||
logger.Fatal("server.NewStore ERROR", mlog.Err(err))
|
||||
}
|
||||
|
||||
pServer, err = server.New(config, singleUserToken, db, logger)
|
||||
pServer, err = server.New(config, singleUserToken, db, logger, "")
|
||||
if err != nil {
|
||||
logger.Fatal("server.New ERROR", mlog.Err(err))
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ type Server struct {
|
|||
api *api.API
|
||||
}
|
||||
|
||||
func New(cfg *config.Configuration, singleUserToken string, db store.Store, logger *mlog.Logger) (*Server, error) {
|
||||
func New(cfg *config.Configuration, singleUserToken string, db store.Store, logger *mlog.Logger, serverID string) (*Server, error) {
|
||||
authenticator := auth.New(cfg, db)
|
||||
|
||||
wsServer := ws.NewServer(authenticator, singleUserToken, cfg.AuthMode == MattermostAuthMod, logger)
|
||||
|
@ -152,6 +152,7 @@ func New(cfg *config.Configuration, singleUserToken string, db store.Store, logg
|
|||
app: app,
|
||||
cfg: cfg,
|
||||
telemetryID: telemetryID,
|
||||
serverID: serverID,
|
||||
logger: logger,
|
||||
singleUser: len(singleUserToken) > 0,
|
||||
}
|
||||
|
@ -365,6 +366,7 @@ type telemetryOptions struct {
|
|||
app *app.App
|
||||
cfg *config.Configuration
|
||||
telemetryID string
|
||||
serverID string
|
||||
logger *mlog.Logger
|
||||
singleUser bool
|
||||
}
|
||||
|
@ -379,6 +381,7 @@ func initTelemetry(opts telemetryOptions) *telemetry.Service {
|
|||
"build_hash": appModel.BuildHash,
|
||||
"edition": appModel.Edition,
|
||||
"operating_system": runtime.GOOS,
|
||||
"server_id": opts.serverID,
|
||||
}, nil
|
||||
})
|
||||
telemetryService.RegisterTracker("config", func() (telemetry.Tracker, error) {
|
||||
|
|
Loading…
Reference in a new issue