Skip to content

Conversation

samueld-activator
Copy link
Contributor

@samueld-activator samueld-activator commented Aug 15, 2025

TaskCP-1062 Remove excessive information returned from reading log files

…files

msg := logLine.Body.Msg

if !startPrinting {
if msg == "Dependencies downloaded and unpacked." {
Copy link
Member

Choose a reason for hiding this comment

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

This feels very brittle, due to how implicit it is. Now we have downstream automation logic depending on a localization on some other API that has zero awareness of this automation.

Is there something else we can use, something less prone to change?

Could you instead filter out any log messages that are not errors or warnings? ie. filter out DEBUG and INFO.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The errors are logged as INFO:

{"body": {"facility": "INFO", "msg": "ModuleNotFoundError: No module named 'poetry'"}, "artifact_id": "0fc44508-4e7e-58f6-8553-58592a52b04c", "timestamp": "2025-08-12T19:24:19.211884", "type": "artifact_progress", "source": "python", "pid": 124, "pipe_name": "stderr"}

We should do a better job classifying these log levels. Additionally, there could be something in the logs that tell where in the process it is (downloading, unpacking, building...)? Or perhaps these strings like "Dependencies downloaded and unpacked." are already intended for that and we just want to make it more explicit?

Copy link
Member

Choose a reason for hiding this comment

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

We are empowered to make changes throughout the whole codebase, and this feels like a relatively simple one. Perhaps you could modify the log line where "Dependencies downloaded and unpacked" and add some form of context to make the relationship explicit? At the very least this could be a comment stating "If you change this also change this file here: X". But ideally we'd add something specifically meant for programmatic interpretation, ie. some sort of status code or something that explicitly communicates "this is for programmatic use".

Then again I imagine you might be looking at failed builds that predate this change? If that's the case I suppose a comment is the best we can do for now, though I'd challenge you to think through the problem and see if there's a clean solution.

Base automatically changed from samueld/CP-1037 to master August 15, 2025 21:11
@samueld-activator
Copy link
Contributor Author

We should be fine looking for "error" +- 10 lines, at least for now that we are only fixing missing dependencies. My concern is about missing important information that were "farther" in the logs, but we are already risking to lose when we only return what comes after "Dependencies downloaded and unpacked.". Additionally, 10 seems to be a good default.

Copy link
Member

@Naatan Naatan left a comment

Choose a reason for hiding this comment

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

Looks good to me, just one comment for your consideration. I think sooner or later we'll want this to capture things other than the specific errors you're handling now.

// Check what lines contain the keyword "error" and print the previous 10 and next 10 lines
printedLines := make(map[int]bool)
for i, line := range lines {
if strings.Contains(strings.ToLower(line), "error") {
Copy link
Member

Choose a reason for hiding this comment

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

Should perhaps include some more synonyms here, eg.

fail
critical
panic
exception

@samueld-activator samueld-activator merged commit 3a41998 into master Sep 4, 2025
5 of 15 checks passed
@samueld-activator samueld-activator deleted the samueld/CP-1062 branch September 4, 2025 16:52
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