-
Notifications
You must be signed in to change notification settings - Fork 0
Introduce machinery to handle multiple Handler streams, and parsing handler configurations from OKS #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
|
|
||
|
|
||
| @dataclass | ||
| class ERSHandlerConf: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See if there's a better name
| @staticmethod | ||
| def get_oks_conf(): | ||
| """From the set of known environment variables, generate the ERS conf dict""" | ||
| ers_env_vars = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check if we want to define this elsewhere, eg more centrally
| return | ||
|
|
||
|
|
||
| def add_ers_protobuf_handler(log: logging.Logger, use_parent_handlers: bool, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is technically ERS protobuf and Kafka, see if there's a better name
|
@PawelPlesniak This, and the sister PR DUNE-DAQ/erskafka#43 is ready for review. Theres a few things I've highlighted here that I think we should discuss, but the general implementation should be ready for you to go through Let me know what you think :) |
| #TODO/ask: See if we want to define this mapping elsewhere | ||
| level_to_ers_var = { | ||
| "ERROR": "DUNEDAQ_ERS_ERROR", | ||
| "WARNING": "DUNEDAQ_ERS_WARNING", | ||
| "CRITICAL": "DUNEDAQ_ERS_FATAL", | ||
| "INFO": "DUNEDAQ_ERS_INFO", | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See if we want this defined elsewhere
src/daqpytools/logging/handlers.py
Outdated
| #TODO/ask: Need to decide what happens if no environment variable is detected | ||
| # Do we return None or do we raise an error? | ||
| raise ValueError(f"The environment variable {ers_log_level} is empty") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When we call LogHandlerConf to generate all the various streams, the ERS stream constructor is called. As you can imagine, the ERS streams rely on the environment variables having been defined in the environment this code is run in.
The question is, what behaviour do we want when we call this where the environment variables are not set? Do we want to throw an error or do we want it to default as being 'None'?
Description
Close #35
Needs to go in with DUNE-DAQ/erskafka#43
To fully implement ERS into drunc, some machinery is required to be introduced to the logging infrastructure in the Python implementation of the DUNEDAQ.
This PR adds several things
Full information the logic behind this is described in the logging page in the drunc wiki
A full demonstration of how this works in practice is found in the demonstration python script that has been updated as part of this PR.
Testing instructions for review
NFD_DEV_260109_A9) and check out this branch and Update handlers in preparation for introducing ERS to drunc erskafka#43.daqpytools-logging-demonstrator -r -f logger.log --handlertypesType 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)Comments here on the testing
Further checks
dbt-build --lint, and/or see https://dune-daq-sw.readthedocs.io/en/latest/packages/styleguide/)(Indicate issue here: # (issue))
FOLLOW UP
TODOs: