Skip to content

Commit

Permalink
Propagate project and entity information to rule evaluation logs (#4818)
Browse files Browse the repository at this point in the history
  • Loading branch information
evankanderson authored Oct 24, 2024
1 parent f75a16c commit c8678a1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions internal/engine/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,15 @@ func NewExecutor(
// EvalEntityEvent evaluates the entity specified in the EntityInfoWrapper
// against all relevant rules in the project hierarchy.
func (e *executor) EvalEntityEvent(ctx context.Context, inf *entities.EntityInfoWrapper) error {
logger := zerolog.Ctx(ctx).Info().
logger := zerolog.Ctx(ctx).With().
Str("entity_type", inf.Type.ToString()).
Str("execution_id", inf.ExecutionID.String()).
Str("provider_id", inf.ProviderID.String()).
Str("project_id", inf.ProjectID.String())
logger.Msg("entity evaluation - started")
Str("project_id", inf.ProjectID.String()).
Logger()
logger.Info().Msg("entity evaluation - started")
// Propagate info to remaining log messages
ctx = logger.WithContext(ctx)

// track the time taken to evaluate each entity
entityStartTime := time.Now()
Expand Down

0 comments on commit c8678a1

Please sign in to comment.