Skip to content

Expose jobrunner metrics - #976

Open
sbidoul wants to merge 1 commit into
OCA:19.0from
acsone:19.0-metrics-sbi
Open

Expose jobrunner metrics#976
sbidoul wants to merge 1 commit into
OCA:19.0from
acsone:19.0-metrics-sbi

Conversation

@sbidoul

@sbidoul sbidoul commented Aug 31, 2026

Copy link
Copy Markdown
Member

This is a first draft towards #965

This turns out to be fairly simple. A few things worth noting:

  • The http server runs in the same thread and event loop as listen/notify job events, so there are no concurrency issues while accessing the channels stats
  • I added the set of jobs waiting for dependencies on each channel for completeness and convenient access to that stat, similar to what is done for failed jobs.
  • I used the prometheus-client external library. It's currently required even if the metrics server is not configured. This could be improved by mocking the lib and making it mandatory only for users enabling the metrics server. Or make it a required dependency (which is my preference, for simplicity).
  • This still needs tests and docs.

Test by setting ODOO_QUEUE_JOB_METRICS_PORT=8080 before running Odoo then watch curl -s http://localhost:8080.

Assisted-By: Pamina (my cat)

@OCA-git-bot

Copy link
Copy Markdown
Contributor

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

self._metrics_labels = {
"channel": self.fullname,
"root": not bool(self.parent),
"leaf": not bool(self.children),

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Maybe move this to configure? Because the leaf label is probably not correct if/when children are added after the parent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants