tests/reporter: Add gauge scrape#597
Conversation
Summary of ChangesHello @RamLavi, 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 significantly improves the diagnostic capabilities of the test suite by integrating a detailed report of MAC address collisions into the failure logs. By capturing the Highlights
Changelog
Activity
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
Code Review
This pull request enhances test failure diagnostics by adding a log of the kmp_mac_collisions gauge. When a test fails, it now scrapes this metric and correlates the MAC addresses with running VMIs, which is a great addition for debugging potential MAC collision issues. The implementation is solid, but I've pointed out a small performance improvement opportunity in the new code.
491c2f4 to
6f5a6f2
Compare
|
Change: Address gemini code review and linter issues |
ormergi
left a comment
There was a problem hiding this comment.
This PR seem to dump some metrics KubeMacPoll generates in tests, then there is the scrapped content parsing and formatting, and additional non related refactoring.
Please consider keep this PR simple as possible, leaving only the metric dump part.
Making the log nicer or additional refactoring can be done on follow up.
About making the dumped metric logs nicer:
Its not clear why its necessary (i.e: before and after examples) or how common this log will be used, that it require additional processing.
Sound like something we should avoid maintaining (e.g.: content formatting changes, metric detains are added, etc..)
I am sure there are tooling that can present Prometheus metrics nicely.
| if strings.TrimSpace(report) == "" { | ||
| report = "(no kmp_mac_collisions metrics found)" | ||
| } | ||
|
|
||
| if err != nil { | ||
| report = fmt.Sprintf("failed to build kmp mac collision gauge report: %v\n\n%s", err, report) | ||
| } |
There was a problem hiding this comment.
Looks like the convention for errors is to not write the file, why is it needed in this case?
There was a problem hiding this comment.
You're right, I wanted the avoid an empty file with no explanation (or no file at all), but it would make better sense to keep the convention.
DONE
wish I could - but it failed linter (the one function I added tipped the scale and fires the "this function is too complex" linter).
I'm sorry I didn't make the intention clear on the PR Desc. will fix.
There are promql tools that do the parsing for us, but I figured they require too much additional resource and code for the simple purpose of our scrape. IOW IMO using these clients would be a huge overkill. |
Print the gauge scrape, and also print the VMIs that are attached to it, for easy debugging. Signed-off-by: Ram Lavi <ralavi@redhat.com>
Signed-off-by: Ram Lavi <ralavi@redhat.com>
6f5a6f2 to
16d6c9b
Compare
Can we just move the part that process the metric content to different PR, that is macCollisionGaugeReport() code? So that this PR outcome is the metric being dumped as is to a file in the test artifacts dir. It just that I am not sure we need or want to review the processing the metric part, do we really need it?
Sound like we need an assert before each test that ensure no collision occurred before the next test run,
I meant one could use such tools on their local env, not on CI. |
|
Although I would avoid parsing some log because the expected output could change, looking at this again its not harmful because it done in tests, and can improve debugging. /lgtm |
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: RamLavi The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What this PR does / why we need it:
When a test fails on
kmp_mac_collisionsgauge not having the expected value, it may be related to the current test or a remnant from an old one not clearing up well, or a design bug.However the current reporter does not log the
kmp_mac_collisionsgauge so that it could be debugged later.This PR adds a log after test failure, of the
kmp_mac_collisionsgauge, and also print the VMIs that are attached to it, for easy debugging.Special notes for your reviewer:
Release note: