Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Several log improvements #645

Merged
merged 4 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions configuration/template/stackutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ package template
import (
"encoding/json"
"fmt"
"github.com/AliceO2Group/Control/common/logger/infologger"
texttemplate "text/template"
"time"

Expand All @@ -51,8 +52,8 @@ func getConfigLegacy(confSvc ConfigurationService, varStack map[string]string, p

fields := Fields{WrapPointer(&payload)}
err = fields.Execute(confSvc, query.Path(), varStack, nil, nil, make(map[string]texttemplate.Template), nil)
log.Warn(varStack)
log.Warn(payload)
log.WithField("level", infologger.IL_Devel).Debug(varStack)
log.WithField("level", infologger.IL_Devel).Debug(payload)
return payload
}

Expand All @@ -68,8 +69,8 @@ func getConfig(confSvc ConfigurationService, varStack map[string]string, path st
return fmt.Sprintf("{\"error\":\"%s\"}", err.Error())
}

log.Warn(varStack)
log.Warn(payload)
log.WithField("level", infologger.IL_Devel).Debug(varStack)
log.WithField("level", infologger.IL_Devel).Debug(payload)
return payload
}

Expand Down
4 changes: 2 additions & 2 deletions core/environment/transition_deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -342,9 +342,9 @@ func (t DeployTransition) do(env *Environment) (err error) {
}

if err != nil {
log.WithError(err).
log.WithField("level", infologger.IL_Ops).
WithField("partition", env.Id().String()).
Error("deployment error")
Error(err)
return
}

Expand Down
3 changes: 2 additions & 1 deletion core/task/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -1207,7 +1207,8 @@ func (m *Manager) handleMessage(tm *TaskmanMessage) error {
if err != nil {
log.WithError(err).
WithField("partition", tm.GetEnvironmentId().String()).
Errorf("Failed task creation and Mesos resources allocation during the deployment of the environment. For more details check Devel logs in Info Logger.")
WithField("level", infologger.IL_Support).
Errorf("failed task creation and Mesos resources allocation during the deployment of the environment. More details in Devel logs.")
}
}()
case taskop.ConfigureTasks:
Expand Down
19 changes: 14 additions & 5 deletions core/workflow/taskrole.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,11 +257,20 @@ func (t *taskRole) updateState(s sm.State) {
EnvironmentId: t.GetEnvironmentId().String(),
})
if t.state.get() == sm.ERROR {
log.WithField("partition", t.GetEnvironmentId().String()).
WithField("level", infologger.IL_Support).
WithField("role", t.Name).
WithField("critical", t.Critical).
Error("task went into ERROR")
host := "unknown"
if t.Task != nil {
host = t.Task.GetHostname()
}
if t.Critical {
log.WithField("partition", t.GetEnvironmentId().String()).
WithField("level", infologger.IL_Ops).
Errorf("critical task '%s' on host '%s' went into ERROR, the environment will stop or tear down", t.Name, host)
} else {
log.WithField("partition", t.GetEnvironmentId().String()).
WithField("level", infologger.IL_Ops).
Errorf("non-critical task '%s' on host '%s' went into ERROR, but the environment might continue", t.Name, host)
}

}
}
t.SendEvent(&event.RoleEvent{Name: t.Name, State: t.state.get().String(), RolePath: t.GetPath()})
Expand Down
3 changes: 2 additions & 1 deletion executor/executable/controllabletask.go
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,8 @@ func (t *ControllableTask) Launch() error {
WithField("taskId", taskId).
WithField("taskName", t.ti.Name).
WithField("taskPid", t.knownPid).
Warningf("task %s transitioned to ERROR on its own - notifying environment", deo.TaskId.String())
WithField("level", infologger.IL_Support).
Warningf("task transitioned to ERROR on its own - notifying environment")
}
}
deviceEvent.SetLabels(map[string]string{"detector": t.knownDetector, "environmentId": t.knownEnvironmentId.String()})
Expand Down