Report Generator¶
The Report Generator module is responsible for creating comprehensive deployment compute reports. It consists of two main components: the generate_report
function and the ReportGenerator
class.
generate_report Function¶
This function orchestrates the entire report generation process:
- Fetches data from Chronosphere for specified metrics and namespaces using
get_metrics_data_and_plot
. - Processes data and generates visualizations (figures) for each metric.
- Creates an overall report structure containing detailed information for each namespace.
- Generates a Word document report using the
ReportGenerator
class. - Exports the report data to JSON and CSV formats using
json.dump
andgenerate_csv_from_report
respectively.
ReportGenerator Class¶
This class handles the creation and formatting of the Word document report:
setup_document
: Sets up the document structure with proper margins and headers/footers.add_title_page
: Creates a title page with report metadata.add_figure
: Adds figures (charts) to the document.add_statistics_table
: Includes statistics tables for each metric.add_visualization_url
: Adds URLs for each query.save_document
: Saves the formatted document.
The ReportGenerator
class allows the generate_report
function to focus on data processing and overall report structure, while delegating the specifics of document creation to this specialized class. This separation of concerns enhances modularity and maintainability of the code.