quipucords / yupana

Service app to process & upload data from quipucords and satellite to the host based inventory
GNU General Public License v3.0
4 stars 14 forks source link

Log originating request ID #324

Open apuntamb opened 4 years ago

apuntamb commented 4 years ago

As a beginner in yupana, created this small PR to fix logging of request_id for better traceability while debugging issues. Please review and feel free to correct in case something is missing.

apuntamb commented 4 years ago

I think better practice would be using LoggerAdapter to wrap log calls that are already emitted by the system with request_id.

You mean something like logging.LoggerAdapter.log("Originating Request ID: %s" % request_id) inside the report_consumer or inside abstract, report and slice processors?

Especially it's relevant for processors: abstract, report and slice. I see that the request_id is available through report_or_slice variable in pre_delegate. I suppose we can wrap the logger instance with LoggerAdapter inside the pre_delegate and then reuse that instance all the way along the class.

In here https://github.com/quipucords/yupana/blob/master/yupana/processor/report_slice_processor.py#L98 ? By reusing it all the way do you mean wrapping it like above and using it in every method call?