core: component -> task
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
parent
ef407c787a
commit
81ec746d2c
@ -223,7 +223,7 @@ func (c *Client) logSolveStatus(ctx context.Context, pctx *plancontext.Context,
|
|||||||
lg := log.
|
lg := log.
|
||||||
Ctx(ctx).
|
Ctx(ctx).
|
||||||
With().
|
With().
|
||||||
Str("component", component).
|
Str("task", component).
|
||||||
Logger()
|
Logger()
|
||||||
|
|
||||||
lg.
|
lg.
|
||||||
@ -238,7 +238,7 @@ func (c *Client) logSolveStatus(ctx context.Context, pctx *plancontext.Context,
|
|||||||
lg := log.
|
lg := log.
|
||||||
Ctx(ctx).
|
Ctx(ctx).
|
||||||
With().
|
With().
|
||||||
Str("component", component).
|
Str("task", component).
|
||||||
Logger()
|
Logger()
|
||||||
|
|
||||||
msg := secureSprintf(format, a...)
|
msg := secureSprintf(format, a...)
|
||||||
@ -251,7 +251,7 @@ func (c *Client) logSolveStatus(ctx context.Context, pctx *plancontext.Context,
|
|||||||
lg := log.
|
lg := log.
|
||||||
Ctx(ctx).
|
Ctx(ctx).
|
||||||
With().
|
With().
|
||||||
Str("component", component).
|
Str("task", component).
|
||||||
Logger()
|
Logger()
|
||||||
|
|
||||||
msg := secureSprintf(format, a...)
|
msg := secureSprintf(format, a...)
|
||||||
|
@ -118,7 +118,7 @@ func formatMessage(event map[string]interface{}) string {
|
|||||||
|
|
||||||
func parseSource(event map[string]interface{}) string {
|
func parseSource(event map[string]interface{}) string {
|
||||||
source := "system"
|
source := "system"
|
||||||
if task, ok := event["component"].(string); ok && task != "" {
|
if task, ok := event["task"].(string); ok && task != "" {
|
||||||
source = task
|
source = task
|
||||||
}
|
}
|
||||||
return source
|
return source
|
||||||
@ -141,7 +141,7 @@ func formatFields(entry map[string]interface{}) string {
|
|||||||
zerolog.ErrorFieldName: {},
|
zerolog.ErrorFieldName: {},
|
||||||
zerolog.CallerFieldName: {},
|
zerolog.CallerFieldName: {},
|
||||||
"environment": {},
|
"environment": {},
|
||||||
"component": {},
|
"task": {},
|
||||||
"state": {},
|
"state": {},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ func (l *Logs) Add(event Event) error {
|
|||||||
l.l.Lock()
|
l.l.Lock()
|
||||||
defer l.l.Unlock()
|
defer l.l.Unlock()
|
||||||
|
|
||||||
component, ok := event["component"].(string)
|
task, ok := event["task"].(string)
|
||||||
if !ok {
|
if !ok {
|
||||||
l.Messages = append(l.Messages, Message{
|
l.Messages = append(l.Messages, Message{
|
||||||
Event: event,
|
Event: event,
|
||||||
@ -52,7 +52,7 @@ func (l *Logs) Add(event Event) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
groupKey := strings.Split(component, ".#up")[0]
|
groupKey := strings.Split(task, ".#up")[0]
|
||||||
group := l.groups[groupKey]
|
group := l.groups[groupKey]
|
||||||
|
|
||||||
// If the group doesn't exist, create it
|
// 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
|
// For state events, we just want to update the group status -- no need to
|
||||||
// dispanything
|
// dispanything
|
||||||
if st, ok := event["state"].(string); ok {
|
if st, ok := event["state"].(string); ok {
|
||||||
// Ignore state updates for "sub" components
|
// Ignore state updates for "sub" tasks
|
||||||
if component != groupKey {
|
if task != groupKey {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ func newPipelineRunner(computed *compiler.Value, s solver.Solver, pctx *plancont
|
|||||||
lg := log.
|
lg := log.
|
||||||
Ctx(ctx).
|
Ctx(ctx).
|
||||||
With().
|
With().
|
||||||
Str("component", t.Path().String()).
|
Str("task", t.Path().String()).
|
||||||
Logger()
|
Logger()
|
||||||
ctx = lg.WithContext(ctx)
|
ctx = lg.WithContext(ctx)
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ func (p *Pipeline) Run(ctx context.Context) error {
|
|||||||
lg := log.
|
lg := log.
|
||||||
Ctx(ctx).
|
Ctx(ctx).
|
||||||
With().
|
With().
|
||||||
Str("component", p.name).
|
Str("task", p.name).
|
||||||
Logger()
|
Logger()
|
||||||
|
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
|
@ -120,7 +120,7 @@ func newRunner(pctx *plancontext.Context, s solver.Solver, computed *compiler.Va
|
|||||||
// Wrapper around `task.Run` that handles logging, tracing, etc.
|
// Wrapper around `task.Run` that handles logging, tracing, etc.
|
||||||
return cueflow.RunnerFunc(func(t *cueflow.Task) error {
|
return cueflow.RunnerFunc(func(t *cueflow.Task) error {
|
||||||
ctx := t.Context()
|
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 = lg.WithContext(ctx)
|
||||||
ctx, span := otel.Tracer("dagger").Start(ctx, fmt.Sprintf("compute: %s", t.Path().String()))
|
ctx, span := otel.Tracer("dagger").Start(ctx, fmt.Sprintf("compute: %s", t.Path().String()))
|
||||||
defer span.End()
|
defer span.End()
|
||||||
|
Reference in New Issue
Block a user