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

Improve error messages in garm log #314

Merged
merged 7 commits into from
Nov 26, 2024

Conversation

maigl
Copy link
Contributor

@maigl maigl commented Nov 22, 2024

finding errors in logs is very important and there are some logs that are errors but seem to be rather normal:

  • workflow events without labels -> this happens very often (at least in our GHE instance), this might be a bug in github code .. but garm probably has to accept this and don't consider this an error
  • workflows that have runner_names which are not our runners. This always happens in a scenario where our garm runners are not the only runner setup (and we still get the workflow_job events, e.g. enterprise wide hooks)

@maigl maigl force-pushed the improve_error_message branch from 8230b40 to 8a31d81 Compare November 22, 2024 10:49
@maigl maigl marked this pull request as ready for review November 22, 2024 10:50
Copy link
Member

@gabriel-samfira gabriel-samfira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I should have added more context to those messages.

database/sql/jobs.go Outdated Show resolved Hide resolved
@@ -244,7 +246,8 @@ func (s *sqlDatabase) CreateOrUpdateJob(ctx context.Context, job params.Job) (pa
if err == nil {
workflowJob.InstanceID = &instance.ID
} else {
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to get instance by name")
// This usually is very normal as not all jobs run on our runners.
slog.DebugContext(ctx, fmt.Sprintf("failed to get instance by name: %s", job.RunnerName))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above. The level change to DebugContext is fine.

maigl and others added 2 commits November 22, 2024 16:40
Co-authored-by: Gabriel <samfiragabriel@gmail.com>
@maigl maigl force-pushed the improve_error_message branch from 8255c5f to d6de596 Compare November 22, 2024 15:50
@gabriel-samfira
Copy link
Member

I think we need to bump golangci-lint to >= 1.60.1. Details here: golangci/golangci-lint#4662 (comment)

@maigl
Copy link
Contributor Author

maigl commented Nov 26, 2024

I added a specific golangci-lint version in the Makefile .. now we're left with a bunch of G115: integer overflow conversion findings .. I think they are okayish .. how to deal with them, exclude G115?

@gabriel-samfira
Copy link
Member

Yeah. Let's exclude them for now. I don't think anyone will try to set 2^32 MaxRunners. Anytime soon. We may change the types later to avoid the need to convert, or add some overflow checks. But for now, let's jut exclude them.

@maigl
Copy link
Contributor Author

maigl commented Nov 26, 2024

Yeah. Let's exclude them for now. I don't think anyone will try to set 2^32 MaxRunners. Anytime soon. We may change the types later to avoid the need to convert, or add some overflow checks. But for now, let's jut exclude them.

done

@gabriel-samfira gabriel-samfira merged commit 8e13588 into cloudbase:main Nov 26, 2024
4 checks passed
@gabriel-samfira
Copy link
Member

Thanks @maigl !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants