Skip to content

Commit

Permalink
add schema to a couple of log messages (#4759)
Browse files Browse the repository at this point in the history
  • Loading branch information
lcouzens authored Nov 2, 2023
1 parent c610a16 commit 0df1a2a
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions koku/masu/processor/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,18 +318,28 @@ def summarize_reports( # noqa: C901
"""
reports_by_source = defaultdict(list)
schema_name = None
for report in reports_to_summarize:
if report:
reports_by_source[report.get("provider_uuid")].append(report)

if schema_name is None:
# Only set the schema name once
schema_name = report.get("schema_name")

reports_deduplicated = []
dedup_func_map = {
Provider.PROVIDER_GCP: deduplicate_reports_for_gcp,
Provider.PROVIDER_GCP_LOCAL: deduplicate_reports_for_gcp,
Provider.PROVIDER_OCI: deduplicate_reports_for_oci,
Provider.PROVIDER_OCI_LOCAL: deduplicate_reports_for_oci,
}
LOG.info(log_json("summarize_reports", msg="deduplicating reports"))

kwargs = {}
if schema_name:
kwargs["schema_name"] = schema_name

LOG.info(log_json("summarize_reports", msg="deduplicating reports", **kwargs))
for report_list in reports_by_source.values():
if report and report.get("provider_type") in dedup_func_map:
provider_type = report.get("provider_type")
Expand Down Expand Up @@ -357,7 +367,13 @@ def summarize_reports( # noqa: C901
}
)

LOG.info(log_json("summarize_reports", msg=f"deduplicated reports, num report: {len(reports_deduplicated)}"))
LOG.info(
log_json(
"summarize_reports",
msg=f"deduplicated reports, num report: {len(reports_deduplicated)}",
**kwargs,
)
)
for report in reports_deduplicated:
# For day-to-day summarization we choose a small window to
# cover new data from a window of days.
Expand Down

0 comments on commit 0df1a2a

Please sign in to comment.