Skip to content

[18.0][IMP] rest_log: add profiling#589

Draft
grindtildeath wants to merge 11 commits intoOCA:18.0from
camptocamp:18.0-imp-server_logs_and_profiling
Draft

[18.0][IMP] rest_log: add profiling#589
grindtildeath wants to merge 11 commits intoOCA:18.0from
camptocamp:18.0-imp-server_logs_and_profiling

Conversation

@grindtildeath
Copy link
Contributor

@grindtildeath grindtildeath commented Feb 10, 2026

[REF] rest_log: Add hooks to read configuration from system params

This allows to use the same syntax than the existing one from
rest.log.active to define other config parameters.

[IMP] rest_log: Allow to profile requests through rest services

Leverage ir.profile machinery to track what happens when a user
calls some rest services.

Since profiling can be done only for a single user at a time the
system parameter rest.log.profiling.uid has to be defined with
the ID from res.users whose calls need to be profiled.

Moreover, system parameter rest.log.profiling.conf can be defined
using the syntax from rest.log.active to fine tune which requests
will trigger the profiling for the user defined by the previous
parameter.

To note, once a request is identified to start the profiling, all
incoming requests from the user will be profiled until the timeout
duration defined by rest.log.profiling.duration is reached.

@OCA-git-bot
Copy link
Contributor

Hi @simahawk,
some modules you are maintaining are being modified, check this out!

Copy link
Contributor

@simahawk simahawk left a comment

Choose a reason for hiding this comment

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

early review, to be tested.

@simahawk
Copy link
Contributor

simahawk commented Feb 11, 2026

I've reworked it and simplified a bit. How it works:

  1. set rest.log.profiling.uid to enable the given user id(s) (CSV list of ids)
  2. set rest.log.profiling.conf to enable the conf for a specific app/collection (eg: shopfloor.app)

base.profiling_enabled_until is needed only to view the speedscope.

UPDATED: 12/02

.get_param("rest.log.profiling.uid")
)
except ValueError as err:
_logger.warning(
Copy link
Member

Choose a reason for hiding this comment

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

Should return None after ?

Copy link
Member

Choose a reason for hiding this comment

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

If no valid uid is found, then profiling_uid is set to 0, which never matches self.env.uid.
Then nothing happens.

@mmequignon mmequignon force-pushed the 18.0-imp-server_logs_and_profiling branch from 66f3662 to 524d239 Compare February 11, 2026 10:28
grindtildeath and others added 7 commits February 12, 2026 13:00
This allows to use the same syntax than the existing one from
rest.log.active to define other config parameters.
Leverage ir.profile machinery to track what happens when a user
calls some rest services.

Since profiling can be done only for a single user at a time the
system parameter rest.log.profiling.uid has to be defined with
the ID from res.users whose calls need to be profiled.

Moreover, system parameter rest.log.profiling.conf can be defined
using the syntax from rest.log.active to fine tune which requests
will trigger the profiling for the user defined by the previous
parameter.

To note, once a request is identified to start the profiling, all
incoming requests from the user will be profiled until the timeout
duration defined by rest.log.profiling.duration is reached.
Gives better control on how to profile.
@simahawk simahawk force-pushed the 18.0-imp-server_logs_and_profiling branch from 524d239 to 582e759 Compare February 12, 2026 12:38
@simahawk simahawk changed the title [18.0][IMP] server logs and profiling [18.0][IMP] rest_log: add profiling Feb 12, 2026
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.

5 participants