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

[refactor] - Adjust File Handling Errors #3519

Merged
merged 2 commits into from
Nov 15, 2024
Merged

Conversation

ahrav
Copy link
Collaborator

@ahrav ahrav commented Oct 28, 2024

Description:

This PR address the first point in this comment.

Avoid shadowing err by handling it immediately upon encountering an error.

Checklist:

  • Tests passing (make test-community)?
  • Lint passing (make lint this requires golangci-lint)?

@ahrav ahrav marked this pull request as ready for review October 28, 2024 18:20
@ahrav ahrav requested a review from a team as a code owner October 28, 2024 18:20
@ahrav ahrav requested a review from a team October 28, 2024 18:21
Comment on lines -41 to -44
defer func() {
h.measureLatencyAndHandleErrors(start, err)
h.metrics.incFilesProcessed()
}()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this mean that archives that generate errors during processing are no longer counted by the metric and no longer have their latency measured?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This change increments incFilesProcessed only for Non-Fatal errors, but latency is recorded regardless of success or failure. For Fatal errors, we increment the incErrors metric within measureLatencyAndHandleErrors instead.

I was concerned when I saw that we’re incrementing the file processed metric even in cases of errors. The metric name may be unclear, as I assumed "processed" meant successfully processed, not just acknowledged. With the current approach, even files we can’t open are counted as processed, which feels somewhat misleading. I’m open to changing it back, though.

Copy link
Contributor

Choose a reason for hiding this comment

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

Food for thought, the status could be represented with a metric tag and then we could use the same metric visualizations 'by status', which could be "success", "failure", "skipped" etc.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That's an interesting idea. I'll put together a separate PR with that. Thanks for the suggestion.

@ahrav ahrav requested review from rosecodym and a team November 13, 2024 20:23
pkg/handlers/rpm.go Outdated Show resolved Hide resolved
pkg/handlers/rpm.go Outdated Show resolved Hide resolved
@ahrav ahrav merged commit af3e682 into main Nov 15, 2024
13 checks passed
@ahrav ahrav deleted the refactor-handlers-error-handling branch November 15, 2024 22:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants