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

chore(automation) Prefix steps and components logs w/ run_id and name #1999

Merged
merged 9 commits into from
Mar 4, 2025

Conversation

kddubey
Copy link
Contributor

@kddubey kddubey commented Feb 26, 2025

so that it's a bit easier to query logs. currently tested via local run of relevant warnings where I used self.logger in the components (see example below)

lmk if i should also change the autofix components to use self.logger in a follow-up PR

Example log from Autofix

Before:

app-1       | [2025-03-01 19:33:14,437: INFO/ForkPoolWorker-1] Executing Autofix - Solution Step

After:

app-1       | [2025-03-01 19:52:14,123: INFO/ForkPoolWorker-1] [run_id=39] [AutofixSolutionStep] Executing Autofix - Solution Step
Example log from a component in relevant warnings

Before:

app-1       | [2025-03-01 20:02:31,835: INFO/ForkPoolWorker-16] Repo query: organization_id=1, provider='integrations:github', external_id='873328'

After:

app-1       | [2025-03-01 20:06:19,613: INFO/ForkPoolWorker-16] [run_id=40] [seer.automation.codegen.relevant_warnings_component.FetchIssuesComponent] Repo query: organization_id=1, provider='integrations:github', external_id='873328'

@kddubey kddubey changed the title chore(automation) Prefix steps and components w/ run_id and name chore(automation) Prefix steps and components logs w/ run_id and name Feb 26, 2025
Comment on lines +41 to +43
@cached_property
def logger(self):
run_id = self.context.run_id
Copy link
Contributor Author

@kddubey kddubey Feb 26, 2025

Choose a reason for hiding this comment

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

just need self.context.run_id once. double checking it's safe and correct to cache this?

@kddubey kddubey marked this pull request as ready for review March 3, 2025 05:42
@kddubey kddubey requested a review from a team as a code owner March 3, 2025 05:42
def logger(self):
run_id = self.context.run_id
name = f"{type(self).__module__}.{type(self).__qualname__}"
prefix = f"[{run_id=}] [{name}] "
Copy link
Member

Choose a reason for hiding this comment

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

didn't know about this syntax before, nice

@kddubey kddubey merged commit 65ebf6a into main Mar 4, 2025
22 checks passed
@kddubey kddubey deleted the kddubey/log-run-id branch March 4, 2025 20:35
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