Skip to content

Conversation

Xavier-Do
Copy link
Contributor

@Xavier-Do Xavier-Do commented Mar 3, 2025

When handling errors on runbot, it can be difficult to know where a message comes from. It can be problematic to identify automatically the source of an error.

This branch give the possibility to add metadata to log_db.

The current only metadata is the canonical tag.

Some other information, like the stack, or the subtest could be added in the future. This is not the case for now to make the review easier.

     def get_log_metadata(self):
+        stack = traceback.format_stack()
+        start = next((index for index, frame in enumerate(stack) if self._testMethodName in frame), 0)
         metadata = {
             'canonical_tag': self.canonical_tag,
+            'stack': '\n'.join(traceback.format_stack()[start:-7]),
+            'subtest': str(self._subtest),
         }
         return metadata

@robodoo
Copy link
Contributor

robodoo commented Mar 3, 2025

Pull request status dashboard

odoo/netsvc.py Outdated
Comment on lines 59 to 60
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing checking if it returns something

Suggested change
cr.execute("""SELECT 1 FROM information_schema.columns WHERE table_name='ir_logging' and column_name='metadata'""")
self._support_metadata = True
cr.execute("""SELECT 1 FROM information_schema.columns WHERE table_name='ir_logging' and column_name='metadata'""")
self._support_metadata = bool(cr.rowcount)

@C3POdoo C3POdoo added the RD research & development, internal work label Mar 3, 2025
@Xavier-Do Xavier-Do force-pushed the 18.0-netsvc-log-metadata-xdo branch 5 times, most recently from cbb9949 to d210912 Compare March 3, 2025 14:12
@Xavier-Do Xavier-Do marked this pull request as ready for review March 3, 2025 14:19
@C3POdoo C3POdoo requested a review from a team March 3, 2025 14:20
@Xavier-Do Xavier-Do force-pushed the 18.0-netsvc-log-metadata-xdo branch 2 times, most recently from 0303425 to f05b952 Compare March 4, 2025 11:08
@Xavier-Do Xavier-Do changed the base branch from 18.0 to 16.0 March 4, 2025 11:08
@Xavier-Do Xavier-Do force-pushed the 18.0-netsvc-log-metadata-xdo branch 6 times, most recently from 3a2c325 to 246ca1b Compare March 5, 2025 11:45
@Xavier-Do
Copy link
Contributor Author

@robodoo r+

@robodoo
Copy link
Contributor

robodoo commented Mar 5, 2025

@Xavier-Do you may want to rebuild or fix this PR as it has failed CI.

@Xavier-Do Xavier-Do force-pushed the 18.0-netsvc-log-metadata-xdo branch from 246ca1b to 824ac5e Compare March 5, 2025 12:19
When handling errors on runbot, it can be difficult to know where a
message commes from. It can be problematic to identify automatically the
source of an error.

This branch give the possibility to add metadata to log_db.
@Xavier-Do Xavier-Do force-pushed the 18.0-netsvc-log-metadata-xdo branch from 824ac5e to f2db31b Compare March 5, 2025 12:30
@C3POdoo C3POdoo requested review from a team, kmagusiak and HydrionBurst and removed request for a team March 5, 2025 12:32
@Xavier-Do
Copy link
Contributor Author

@robodoo r+

robodoo pushed a commit that referenced this pull request Mar 5, 2025
When handling errors on runbot, it can be difficult to know where a
message commes from. It can be problematic to identify automatically the
source of an error.

This branch give the possibility to add metadata to log_db.

closes #199964

Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
@robodoo robodoo closed this Mar 5, 2025
@xmo-odoo xmo-odoo deleted the 18.0-netsvc-log-metadata-xdo branch March 7, 2025 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RD research & development, internal work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants