Skip to content

Commit

Permalink
server 日志优化 TencentBlueKing#54
Browse files Browse the repository at this point in the history
  • Loading branch information
tbs60 committed Aug 2, 2023
1 parent 69a5675 commit 0576b8c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
5 changes: 5 additions & 0 deletions src/backend/booster/server/pkg/api/v2/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,11 @@ func ReleaseResource(req *restful.Request, resp *restful.Response) {
if err = defaultManager.ReleaseTask(param); err != nil {
blog.Errorf("release resource: release task(%s) failed, url(%s): %v",
param.TaskID, req.Request.URL.String(), err)

if err == engine.ErrorUnterminatedTaskNoFound {
api.ReturnRest(&api.RestResponse{Resp: resp, Message: err.Error()})
return
}
api.ReturnRest(&api.RestResponse{Resp: resp, ErrCode: api.ServerErrReleaseResourceFailed, Message: err.Error()})
return
}
Expand Down
2 changes: 1 addition & 1 deletion src/backend/booster/server/pkg/manager/normal/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ func (m *manager) releaseTask(param *mgr.TaskReleaseParam) error {

tb, err := m.layer.GetTaskBasic(param.TaskID)
if err != nil {
blog.Errorf("manager: try releasing task, get task basic(%s) failed: %v",
blog.Warnf("manager: try releasing task, get task basic(%s) failed: %v",
param.TaskID, err)
return err
}
Expand Down
2 changes: 1 addition & 1 deletion src/backend/booster/server/pkg/resource/crm/broker.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ func (b *Broker) launch() error {
if availableInstance >= b.param.Instance {
return b.param.Instance, nil
}
blog.Errorf("crm broker: failed to launch resource(%s) for broker(%s) with user(%s), need (%d) instances"+
blog.Warnf("crm broker: failed to launch resource(%s) for broker(%s) with user(%s), need (%d) instances"+
", only (%d) available", brokerID, b.name, b.user, b.param.Instance, availableInstance)
return 0, ErrorBrokerNotEnoughResources
}, false)
Expand Down
6 changes: 1 addition & 5 deletions src/backend/booster/server/pkg/resource/crm/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -1069,11 +1069,7 @@ func (rm *resourceManager) checkBroker(broker *Broker) {
for i := 0; i < delta; i++ {
if err := broker.Launch(); err != nil {
switch err {
case ErrorBrokerNotEnoughResources:
blog.Errorf("crm: try launching resource for broker(%s) with user(%s) failed: %v",
broker.name, broker.user, err)
return
case ErrorBrokeringUnderCoolingTime:
case ErrorBrokeringUnderCoolingTime, ErrorBrokerNotEnoughResources:
blog.Warnf("crm: try launching resource for broker(%s) with user(%s) failed: %v",
broker.name, broker.user, err)

Expand Down

0 comments on commit 0576b8c

Please sign in to comment.