core: component -> task

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
Andrea Luzzardi 2021-11-24 16:58:24 -08:00
parent ef407c787a
commit 81ec746d2c
6 changed files with 12 additions and 12 deletions

View File

@ -223,7 +223,7 @@ func (c *Client) logSolveStatus(ctx context.Context, pctx *plancontext.Context,
lg := log.
Ctx(ctx).
With().
Str("component", component).
Str("task", component).
Logger()
lg.
@ -238,7 +238,7 @@ func (c *Client) logSolveStatus(ctx context.Context, pctx *plancontext.Context,
lg := log.
Ctx(ctx).
With().
Str("component", component).
Str("task", component).
Logger()
msg := secureSprintf(format, a...)
@ -251,7 +251,7 @@ func (c *Client) logSolveStatus(ctx context.Context, pctx *plancontext.Context,
lg := log.
Ctx(ctx).
With().
Str("component", component).
Str("task", component).
Logger()
msg := secureSprintf(format, a...)

View File

@ -118,7 +118,7 @@ func formatMessage(event map[string]interface{}) string {
func parseSource(event map[string]interface{}) string {
source := "system"
if task, ok := event["component"].(string); ok && task != "" {
if task, ok := event["task"].(string); ok && task != "" {
source = task
}
return source
@ -141,7 +141,7 @@ func formatFields(entry map[string]interface{}) string {
zerolog.ErrorFieldName: {},
zerolog.CallerFieldName: {},
"environment": {},
"component": {},
"task": {},
"state": {},
}

View File

@ -43,7 +43,7 @@ func (l *Logs) Add(event Event) error {
l.l.Lock()
defer l.l.Unlock()
component, ok := event["component"].(string)
task, ok := event["task"].(string)
if !ok {
l.Messages = append(l.Messages, Message{
Event: event,
@ -52,7 +52,7 @@ func (l *Logs) Add(event Event) error {
return nil
}
groupKey := strings.Split(component, ".#up")[0]
groupKey := strings.Split(task, ".#up")[0]
group := l.groups[groupKey]
// If the group doesn't exist, create it
@ -72,8 +72,8 @@ func (l *Logs) Add(event Event) error {
// For state events, we just want to update the group status -- no need to
// dispanything
if st, ok := event["state"].(string); ok {
// Ignore state updates for "sub" components
if component != groupKey {
// Ignore state updates for "sub" tasks
if task != groupKey {
return nil
}

View File

@ -126,7 +126,7 @@ func newPipelineRunner(computed *compiler.Value, s solver.Solver, pctx *plancont
lg := log.
Ctx(ctx).
With().
Str("component", t.Path().String()).
Str("task", t.Path().String()).
Logger()
ctx = lg.WithContext(ctx)

View File

@ -166,7 +166,7 @@ func (p *Pipeline) Run(ctx context.Context) error {
lg := log.
Ctx(ctx).
With().
Str("component", p.name).
Str("task", p.name).
Logger()
start := time.Now()

View File

@ -120,7 +120,7 @@ func newRunner(pctx *plancontext.Context, s solver.Solver, computed *compiler.Va
// Wrapper around `task.Run` that handles logging, tracing, etc.
return cueflow.RunnerFunc(func(t *cueflow.Task) error {
ctx := t.Context()
lg := log.Ctx(ctx).With().Str("component", t.Path().String()).Logger()
lg := log.Ctx(ctx).With().Str("task", t.Path().String()).Logger()
ctx = lg.WithContext(ctx)
ctx, span := otel.Tracer("dagger").Start(ctx, fmt.Sprintf("compute: %s", t.Path().String()))
defer span.End()