Skip to content
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

Allow setting output file name #24

Merged
merged 1 commit into from
Dec 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions openshift_metrics/merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,16 @@ def main():
"""Reads the metrics from files and generates the reports"""
parser = argparse.ArgumentParser()
parser.add_argument("files", nargs="+")
parser.add_argument("--output-file")
args = parser.parse_args()
files = args.files
merged_dictionary = {}
output_file = f"{datetime.today().strftime('%Y-%m-%d')}.csv"

if args.output_file:
output_file = args.output_file
else:
output_file = f"{datetime.today().strftime('%Y-%m-%d')}.csv"

merged_dictionary = {}
report_start_date = None
report_end_date = None

Expand Down Expand Up @@ -65,7 +70,7 @@ def main():
)
utils.write_metrics_by_namespace(
condensed_metrics_dict,
"namespace-" + output_file,
output_file,
report_month
)
utils.write_metrics_by_pod(condensed_metrics_dict, "pod-" + output_file)
Expand Down