Skip to content

Conversation

@jpodivin
Copy link
Contributor

This PR implements results handler for Log Detective events. It also makes slight modifications to event handler logic, expands comments and renames a variable in LogDetectiveRunModel.set_status method, to improve clarity of the code.

Handler maps LogDetectiveResult.complete to BaseCommitStatus.neutral. Log Detective only runs when build is known to have failed. At the same time, Log Detective analysis can't fail, unless Log Detective itself encounters an error. Therefore it doesn't make sense to mark the state as a "success".

The log_detective_analysis_start timestamp is using ISO 8601 format with an offset. For sake of simplicity and consistency, the timezone is set to UTC.

The Pushgateway class has three more metrics. Two counters for started and finished Log Detective runs and one elapsed time tracker.

The test file had a typo. While adding new test cases I have fixed it, this makes the diff somewhat larger than it would otherwise be.

I have tried to cover as much of the behavior as possible with tests. The coverage of packit_service.worker.handlers.logdetective is now about 97% as measured by pytest.

RELEASE NOTES BEGIN

Handle for Log Detective results reporting has been implemented in packit_service.worker.handlers.logdetective.

RELEASE NOTES END

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @jpodivin, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a dedicated handler for Log Detective analysis results, streamlining the reporting and tracking of these events within the system. It establishes clear rules for translating Log Detective outcomes into commit statuses, integrates new metrics for better operational visibility, and refines existing code for improved readability and maintainability. The changes ensure robust processing of analysis results and provide valuable insights into the performance of Log Detective runs.

Highlights

  • Log Detective Results Handler: A new handler, DownstreamLogDetectiveResultsHandler, has been implemented to process and report events from Log Detective analysis, integrating its results into the system's status reporting.
  • Status Mapping Logic: The pull request defines how Log Detective results map to commit statuses: complete results are marked as neutral, running as running, and error or unknown results are marked as error.
  • Metrics Integration: New Prometheus metrics have been added to the Pushgateway for monitoring Log Detective activity, including counters for started and finished runs, and a histogram to track elapsed analysis time.
  • Code Clarity and Refinement: Improvements were made to the LogDetectiveRunModel.set_status method, including renaming a parameter and expanding comments for better clarity. The log_detective_analysis_start timestamp now consistently uses UTC.
  • Enhanced Test Coverage: The test coverage for the packit_service.worker.handlers.logdetective module has been significantly increased to approximately 97% with the addition of comprehensive new test cases.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
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 introduces a new handler for Log Detective results, which is a significant feature addition. The changes include the new DownstreamLogDetectiveResultsHandler, corresponding updates to event and model definitions, and new metrics for monitoring. The code is well-structured, and the inclusion of comprehensive tests is commendable. I've found a few areas for improvement: there's a potential for an unhandled exception in the event parser, and the new handler contains some unused variables and unreachable code that could be cleaned up for better maintainability. Overall, this is a solid contribution.

@softwarefactory-project-zuul
Copy link
Contributor

@jpodivin jpodivin force-pushed the log_detective_results_handler branch from ca376b9 to 9592131 Compare December 12, 2025 12:19
@softwarefactory-project-zuul
Copy link
Contributor

@jpodivin jpodivin force-pushed the log_detective_results_handler branch from 9592131 to b28f85c Compare December 12, 2025 17:26
@centosinfra-prod-github-app
Copy link
Contributor

@softwarefactory-project-zuul
Copy link
Contributor

@centosinfra-prod-github-app
Copy link
Contributor

@betulependule betulependule moved this from new to in-review in Packit Kanban Board Dec 16, 2025
Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
@jpodivin jpodivin requested a review from lbarcziova December 16, 2025 11:46
@jpodivin jpodivin force-pushed the log_detective_results_handler branch from 7cb4f5f to c729ad7 Compare December 17, 2025 12:17
@centosinfra-prod-github-app
Copy link
Contributor

@jpodivin jpodivin force-pushed the log_detective_results_handler branch from c729ad7 to 5d351fa Compare December 17, 2025 12:36
@centosinfra-prod-github-app
Copy link
Contributor

@jpodivin
Copy link
Contributor Author

/gemini review

Copy link
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 introduces a handler for Log Detective results, along with necessary database schema changes and model updates. The changes are well-structured and include comprehensive tests. I've provided a few suggestions to improve data consistency in the database migration, optimize database access, and enhance code clarity and correctness. Overall, this is a solid contribution.

Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Parser has been updated with commit_sha, pr_id and project_url handling.

Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
@jpodivin jpodivin force-pushed the log_detective_results_handler branch from 5d351fa to f82924e Compare December 17, 2025 14:42
@centosinfra-prod-github-app
Copy link
Contributor

Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
@jpodivin jpodivin force-pushed the log_detective_results_handler branch from f82924e to b90147b Compare December 18, 2025 13:40
@centosinfra-prod-github-app
Copy link
Contributor

@jpodivin jpodivin requested review from mfocko and nforro as code owners January 2, 2026 13:41
@centosinfra-prod-github-app
Copy link
Contributor

@jpodivin jpodivin force-pushed the log_detective_results_handler branch from 235debf to 6e0ba2a Compare January 2, 2026 14:03
@centosinfra-prod-github-app
Copy link
Contributor

Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
@jpodivin jpodivin force-pushed the log_detective_results_handler branch from 6e0ba2a to a579333 Compare January 2, 2026 16:35
@centosinfra-prod-github-app
Copy link
Contributor

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

Labels

None yet

Projects

Status: in-review

Development

Successfully merging this pull request may close these issues.

2 participants