Moving diagnostics into a service (#14832)
* Moving diagnostics into a service * Fixing golint checks * Fixing tests * Renaming from diagnostics to telemetry * Adding missing files * Initializing telemetry earlier in the server startup * Fixing tests * Adding a log for the telemetryID initialization error * Addressing PR review comments * Fixing merge problem * Removing some extra Diagnostics mentions * Making tests pass
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
f0eb67fa0d
Коммит
44079785eb
@@ -109,6 +109,12 @@ type API interface {
|
||||
// Minimum server version: 5.10
|
||||
GetDiagnosticId() string
|
||||
|
||||
// GetTelemetryId returns a unique identifier used by the server for telemetry reports.
|
||||
//
|
||||
// @tag Server
|
||||
// Minimum server version: 5.28
|
||||
GetTelemetryId() string
|
||||
|
||||
// CreateUser creates a user.
|
||||
//
|
||||
// @tag User
|
||||
|
||||
@@ -133,6 +133,13 @@ func (api *apiTimerLayer) GetDiagnosticId() string {
|
||||
return _returnsA
|
||||
}
|
||||
|
||||
func (api *apiTimerLayer) GetTelemetryId() string {
|
||||
startTime := timePkg.Now()
|
||||
_returnsA := api.apiImpl.GetTelemetryId()
|
||||
api.recordTime(startTime, "GetTelemetryId", true)
|
||||
return _returnsA
|
||||
}
|
||||
|
||||
func (api *apiTimerLayer) CreateUser(user *model.User) (*model.User, *model.AppError) {
|
||||
startTime := timePkg.Now()
|
||||
_returnsA, _returnsB := api.apiImpl.CreateUser(user)
|
||||
|
||||
@@ -857,6 +857,33 @@ func (s *apiRPCServer) GetDiagnosticId(args *Z_GetDiagnosticIdArgs, returns *Z_G
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_GetTelemetryIdArgs struct {
|
||||
}
|
||||
|
||||
type Z_GetTelemetryIdReturns struct {
|
||||
A string
|
||||
}
|
||||
|
||||
func (g *apiRPCClient) GetTelemetryId() string {
|
||||
_args := &Z_GetTelemetryIdArgs{}
|
||||
_returns := &Z_GetTelemetryIdReturns{}
|
||||
if err := g.client.Call("Plugin.GetTelemetryId", _args, _returns); err != nil {
|
||||
log.Printf("RPC call to GetTelemetryId API failed: %s", err.Error())
|
||||
}
|
||||
return _returns.A
|
||||
}
|
||||
|
||||
func (s *apiRPCServer) GetTelemetryId(args *Z_GetTelemetryIdArgs, returns *Z_GetTelemetryIdReturns) error {
|
||||
if hook, ok := s.impl.(interface {
|
||||
GetTelemetryId() string
|
||||
}); ok {
|
||||
returns.A = hook.GetTelemetryId()
|
||||
} else {
|
||||
return encodableError(fmt.Errorf("API GetTelemetryId called but not implemented."))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_CreateUserArgs struct {
|
||||
A *model.User
|
||||
}
|
||||
|
||||
@@ -1916,6 +1916,20 @@ func (_m *API) GetTeamsUnreadForUser(userId string) ([]*model.TeamUnread, *model
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// GetTelemetryId provides a mock function with given fields:
|
||||
func (_m *API) GetTelemetryId() string {
|
||||
ret := _m.Called()
|
||||
|
||||
var r0 string
|
||||
if rf, ok := ret.Get(0).(func() string); ok {
|
||||
r0 = rf()
|
||||
} else {
|
||||
r0 = ret.Get(0).(string)
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// GetUnsanitizedConfig provides a mock function with given fields:
|
||||
func (_m *API) GetUnsanitizedConfig() *model.Config {
|
||||
ret := _m.Called()
|
||||
|
||||
Ссылка в новой задаче
Block a user