Skip to content

tentacle: mgr: forward the root-logger fallback at the record's own level - #70960

Merged
batrick merged 2 commits into
ceph:tentaclefrom
NitzanMordhai:wip-78591-tentacle
Sep 10, 2026
Merged

batrick merged 2 commits into
ceph:tentaclefrom
NitzanMordhai:wip-78591-tentacle

Conversation

@NitzanMordhai

Copy link
Copy Markdown
Contributor

MgrRootHandler captures third-party logs from the Python root logger
and emits them through the _ceph_log method of whichever mgr module
last configured logging.  A handler on the root logger outlives any
single module, so once that module unloads the handler emits through
a stale pointer until another module reconfigures logging.

Add a free mgr_log() function to the ceph_module binding, emitting
via dout() like PyModuleRunner::log but with no PyModule involved,
and rewrite MgrRootHandler to route through it.  The handler no
longer references a module instance, so it cannot go stale.

Signed-off-by: Kefu Chai <[email protected]>
(cherry picked from commit 3705db8)
ceph_module.mgr_log() emitted every record at dout(0): a record either
passed the Python-side gate and went unconditionally to both the log
file and the in-memory recent buffer, or never reached the C++ log at
all.  The two-level debug_mgr semantics (file level / memory level)
never applied, so capturing third-party DEBUG logs meant sending each
record to the log file and a log_max_recent slot; with the kubernetes
client logging multi-megabyte HTTP response bodies at DEBUG, the
recent buffer alone could grow to tens of gigabytes.

Pass the record's level through mgr_log() and emit at the mapped ceph
level: CRITICAL/ERROR at 0, WARNING at 1, INFO at 2, DEBUG at 20.
INFO maps to 2 so it stays visible in the log file at the default
debug_mgr=2/5; DEBUG maps to 20 so floods are dropped there, while
debug_mgr=2/20 captures third-party DEBUG in the in-memory buffer
without touching the log file.  The Python-side gate follows the
higher of the two debug_mgr levels so memory-only records still
reach the C++ side.

Fixes: https://tracker.ceph.com/issues/77633
Signed-off-by: Kefu Chai <[email protected]>
(cherry picked from commit e61de15)
@NitzanMordhai
NitzanMordhai requested a review from a team as a code owner August 11, 2026 06:00
@NitzanMordhai NitzanMordhai added this to the tentacle milestone Aug 11, 2026
@github-actions github-actions Bot added mgr pybind releng-audit-pass Release engineering: passed backport verification audit. labels Aug 11, 2026

@tchaikov tchaikov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm

@yuriw

yuriw commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

This PR has been added to wip-yuri14-testing-20260812.153525-tentacle.

@Naveenaidu

Copy link
Copy Markdown
Contributor

@batrick
batrick merged commit e757367 into ceph:tentacle Sep 10, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core mgr needs-qa pybind releng-audit-pass Release engineering: passed backport verification audit. wip-yuri14-testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants