Skip to content

fix(log-detective): do not log missing run as error#3136

Merged
mfocko merged 1 commit into
packit:mainfrom
mfocko:fix/ld-parser-logging
May 28, 2026
Merged

fix(log-detective): do not log missing run as error#3136
mfocko merged 1 commit into
packit:mainfrom
mfocko:fix/ld-parser-logging

Conversation

@mfocko
Copy link
Copy Markdown
Member

@mfocko mfocko commented May 27, 2026

I have to admit, I don't really like the fact that we're touching database from within the parser. Parser should be totally stateless… I would move this check to the beginning of the handler, if there are no objections to it.

Fixes #3135

Cc @Jany26

Fixes packit#3135

Signed-off-by: Matej Focko <mfocko@packit.dev>
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request changes the logging level from error to info in parse_logdetective_analysis_event when a Log Detective analysis ID is received but no matching analysis was requested. However, according to the repository style guide, parser functions that return None because specific conditions are not met must log a warning. The reviewer has requested changing this log level to warning instead of info to comply with this guideline.

Comment on lines +1925 to 1928
logger.info(
f"Received results Log Detective analysis: '{analysis_id}' "
"but no analysis with this id was requested."
)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

According to the Repository Style Guide (lines 537-539), when a parser returns None because the event doesn't satisfy specific conditions, a warning must be logged. Changing this log level to info violates this guideline. Please use logger.warning instead.

Suggested change
logger.info(
f"Received results Log Detective analysis: '{analysis_id}' "
"but no analysis with this id was requested."
)
logger.warning(
f"Received results Log Detective analysis: '{analysis_id}' "
"but no analysis with this id was requested."
)
References
  1. Parsers process dictionaries and must either return a parsed object, or None, if the dictionary doesn't satisfy conditions specific to the event. In cases when parser returns None, a warning must be logged. (link)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This was not true for this parser even before I adjusted this one instance…

@centosinfra-prod-github-app
Copy link
Copy Markdown
Contributor

@mfocko mfocko merged commit 56dc679 into packit:main May 28, 2026
4 checks passed
@mfocko mfocko deleted the fix/ld-parser-logging branch May 28, 2026 10:31
@github-project-automation github-project-automation Bot moved this from New to Done in Packit pull requests May 28, 2026
@Jany26
Copy link
Copy Markdown
Contributor

Jany26 commented May 28, 2026

I would move this check to the beginning of the handler, if there are no objections to it.

+1 this makes a lot of sense @mfocko

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

Received results Log Detective analysis: ‹XXX› but no analysis with this id was requested.

4 participants