Introduce new handlers and refactor filters#37
Conversation
5a05edb to
4a16756
Compare
21222c2 to
f1d4953
Compare
f1d4953 to
a6ec6c9
Compare
|
Hi @PawelPlesniak, in the interest of timing and availability I'll ask for your review today before I leave. The overall functionality exists and works as expected. Theres a few minor improvements here and there that I've commented about, but they shouldn't affect the functionality. Theres also a couple where I ask for input. But yeah, wouldbe great if you can take a look at the code already + the functionality, and lmk what you think |
Things to checkEquivalent timestamp format in FormattedRichHandler and ThrottleFilter NotesThanks @emmuhamm this looks like exactly what we want. Few commentts
os.environ["DUNEDAQ_ERS_WARNING"] = "erstrace,throttle,lstdout"
os.environ["DUNEDAQ_ERS_INFO"] = "erstrace,throttle,lstdout"
os.environ["DUNEDAQ_ERS_FATAL"] = "erstrace,lstdout"
os.environ["DUNEDAQ_ERS_ERROR"] = (
"erstrace,"
"throttle,"
"lstdout,"
"protobufstream(monkafka.cern.ch:30092)"
)
I will check the Things to check section at the top, and then run some tests, but this logically looks good. In the meantime, can you introduce the In the meantime, I will review some of your other PRs |
|
Hi Pawel, thanks for your review. I will go ahead and do the lstderr stuff. Also good shout on the environment stuff, I did not consider that when i was writing this. I'll go ahead and make the change, will msg you on slack when this is ready to go again |
|
The env vars will be allocated to the subsequent PR, testing ongoing |
Follow up comments and questionWhen using the throttle testing, on boundary conditions (i.e. when reporting the last repeated message), the times are quite similar. It looks like 90 messages were published in 3ms, which is good. [2026/02/13 10:38:42 UTC] INFO logging_demonstrator.py:224 daqpytools_logging_demonstrator Throttle test 29
[2026/02/13 10:38:42 UTC] INFO logging_demonstrator.py:224 daqpytools_logging_demonstrator Throttle test 40 -- 10 similar messages suppressed, last occurrence was at 2026-02-13 11:38:42.139987
[2026/02/13 10:38:42 UTC] INFO logging_demonstrator.py:224 daqpytools_logging_demonstrator Throttle test 141 -- 100 similar messages suppressed, last occurrence was at 2026-02-13 11:38:42.142920Also note the filter is nicely implemented, it's good to see that it integrates well with rich. Issue #44 would be good to prioritize in preparation for showing in SWIT |
Description
Fixes #36
This PR Introduces a couple of changes that fixes #36
Added Throttling Filter (and demonstration)
get_daq_logger, it uses a boolean and so the 30s and 30msg can't be changed. This is fine for now but should be easy to make more customisable later.Added support for Lstdout
stdout_handler.addFilter(HandleIDFilter([HandlerType.Stream, HandlerType.Lstdout])).Improves Filtering class logic and inheritance
BaseHandlerFilterclass which contains a lot of the checks on when to emit a message or not.Move away from string based log level matching to enum-based log level matching
level_to_ers_var.get(record.levelname)), which would now contain erroneous whitespace and matching would failImproves logging of the logging framework
"erstrace,throttle,lstdout"TODO
Type of change
Testing checklist
dbt-build --unittest)pytest -s minimal_system_quick_test.py)daqsystemtest_integtest_bundle.sh)python -m pytest)pre-commit run --all-files)How to test the changes
daqpytools-logging-demonstrator -rdaqpytools-logging-demonstrator -r --throttledaqpytools-logging-demonstrator -s --handlertypesFurther checks
dbt-build --lint, and/or see https://dune-daq-sw.readthedocs.io/en/latest/packages/styleguide/)(Indicate issue here: # (issue))