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

Propagate project and entity information to rule evaluation logs #4818

Merged
merged 1 commit into from
Oct 24, 2024
Merged
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: 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