Skip to content

Commit

Permalink
Use right date type for Usage.monthly_usage
Browse files Browse the repository at this point in the history
  • Loading branch information
Iain-S committed May 16, 2024
1 parent 2896887 commit febe6b8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion usage_function/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ It will get all the usage data for subscriptions in a management group or billin

`costmanagement` is also an Azure function. It should be deployed to the same function app as the `usage` function.

`monthly_usage` uses similar code as `usage` but runs on the 7th day of each month to get the previous month's usage.
`monthly_usage` uses similar code as `usage` but runs bi-hourly on the 7th and 8th day of each month to get the previous month's usage.

See the docs for more.
4 changes: 2 additions & 2 deletions usage_function/monthly_usage/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ def main(mytimer: func.TimerRequest) -> None:
try:
usage_items = retrieve_usage(usage_query)

isodate = datetime.now().isoformat()
today = date.today()
for usage_item in usage_items:
usage_item.monthly_upload = isodate
usage_item.monthly_upload = today

logger.warning("Sending usage for %s", dates)
send_usage(config.API_URL, usage_items, monthly_usage_upload=True)
Expand Down

0 comments on commit febe6b8

Please sign in to comment.