Auditor
A Python package that provides standardized logging and error handling for the Anuvaad dataflow pipeline. This package serves features like session tracing, job tracing, error debugging, and troubleshooting.
Installation
Prerequisites:
Python 3.7
Source code: GitHub Repository
Command:
pip install anuvaad-auditor==0.1.6Logging/Auditing
This part of the library provides features for logging by exposing the following functions:
Import file:
from anuvaad_auditor import loghandlerFunctions
log_info
Logs INFO level information.
loghandler.log_info(<str(message)>, <json(input_object)>)log_debug
Logs DEBUG level information.
log_error
Logs ERROR level information. Should be used for logical errors like “File is not valid”, “File format not accepted” etc.
log_exception
Logs EXCEPTION level information. Should be used in case of exceptions like “TypeError”, “KeyError” etc.
Notes
In all the functions, message and input-object are mandatory.
These functions build an object using these parameters and index them to Elasticsearch for easy tracing.
Ensure all major functions have a
log_infocall, all exceptions havelog_exceptioncalls, and all logical errors havelog_errorcalls.
Error Handling
This part of the library provides features for standardizing and indexing the error objects of the pipeline.
Import file:
Functions
post_error
Returns a standard error object for replying back to the client during a SYNC call and indexes the error to an error index.
post_error_wf
Constructs a standard error object which will be indexed to a different error index and PUSHES THE ERROR TO WFM internally.
Usage Notes:
Use
post_error_wffor flows triggered via Kafka or REST through WFM.Ensure both log functions and error functions are used in case of exceptions or errors.
Errors are indexed to two different indexes: Error index and Audit Index.
Use
post_error_wfcarefully, as this method will take the entire job to FAILED state.
Example Usage
Current Version
anuvaad-auditor==0.1.1 - Please use this version.
Last updated