azure-cli icon indicating copy to clipboard operation
azure-cli copied to clipboard

az consumption usage list errors out with memoryError

Open KionMeiringerMartin opened this issue 5 years ago • 4 comments

Describe the bug

When there is a large amount of resources (>2750), resource groups (>150) in a subscription and you run the command for a past billing period (e.g. 202106) it is possible to produce a memory error. Running the command multiple times with smaller parts of the billing period (e.g. day 1-10, 11-20, 20-31) is a workaround but I would assume not a suitable one for everyone.

Command Name az consumption usage list

Errors:

The command failed with an unexpected error. Here is the traceback:


Traceback (most recent call last):
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 237, in invoke
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/output.py", line 146, in out
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/output.py", line 38, in format_json
  File "json\__init__.py", line 238, in dumps
  File "json\encoder.py", line 202, in encode
MemoryError

To Reproduce:

Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

  • Put any pre-requisite steps here...
  • az consumption usage list --subscription {} --billing-period-name {}

Expected Behavior

Environment Summary

Windows-10-10.0.19041-SP0
Python 3.6.8
Installer: MSI

azure-cli 2.22.1

Extensions:
account 0.2.1
ad 0.1.0
application-insights 0.1.13
azure-devops 0.18.0
resource-graph 2.0.0

Additional Context

KionMeiringerMartin avatar Jul 02 '21 11:07 KionMeiringerMartin

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @ms-premp.

Issue Details

Describe the bug

When there is a large amount of resources (>2750), resource groups (>150) in a subscription and you run the command for a past billing period (e.g. 202106) it is possible to produce a memory error. Running the command multiple times with smaller parts of the billing period (e.g. day 1-10, 11-20, 20-31) is a workaround but I would assume not a suitable one for everyone.

Command Name az consumption usage list

Errors:

The command failed with an unexpected error. Here is the traceback:


Traceback (most recent call last):
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 237, in invoke
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/output.py", line 146, in out
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/output.py", line 38, in format_json
  File "json\__init__.py", line 238, in dumps
  File "json\encoder.py", line 202, in encode
MemoryError

To Reproduce:

Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

  • Put any pre-requisite steps here...
  • az consumption usage list --subscription {} --billing-period-name {}

Expected Behavior

Environment Summary

Windows-10-10.0.19041-SP0
Python 3.6.8
Installer: MSI

azure-cli 2.22.1

Extensions:
account 0.2.1
ad 0.1.0
application-insights 0.1.13
azure-devops 0.18.0
resource-graph 2.0.0

Additional Context

Author: KionMeiringerMartin
Assignees: -
Labels:

Consumption, Service Attention

Milestone: -

ghost avatar Jul 02 '21 15:07 ghost

route to service team

yonzhan avatar Jul 02 '21 15:07 yonzhan

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @TiagoCrewGitHubIssues.

Issue Details

Describe the bug

When there is a large amount of resources (>2750), resource groups (>150) in a subscription and you run the command for a past billing period (e.g. 202106) it is possible to produce a memory error. Running the command multiple times with smaller parts of the billing period (e.g. day 1-10, 11-20, 20-31) is a workaround but I would assume not a suitable one for everyone.

Command Name az consumption usage list

Errors:

The command failed with an unexpected error. Here is the traceback:


Traceback (most recent call last):
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 237, in invoke
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/output.py", line 146, in out
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/output.py", line 38, in format_json
  File "json\__init__.py", line 238, in dumps
  File "json\encoder.py", line 202, in encode
MemoryError

To Reproduce:

Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

  • Put any pre-requisite steps here...
  • az consumption usage list --subscription {} --billing-period-name {}

Expected Behavior

Environment Summary

Windows-10-10.0.19041-SP0
Python 3.6.8
Installer: MSI

azure-cli 2.22.1

Extensions:
account 0.2.1
ad 0.1.0
application-insights 0.1.13
azure-devops 0.18.0
resource-graph 2.0.0

Additional Context

Author: KionMeiringerMartin
Assignees: -
Labels:

Consumption, Consumption-UsageDetailsandExport, Service Attention

Milestone: -

ghost avatar Jul 07 '21 23:07 ghost

@KionMeiringerMartin I apologize for the issues seen here. You are most likely experiencing memory issues due to the size of the data you are pulling down. The chunking logic that you have put into place as a workaround is our recommendation for all customers experiencing this kind of issue. As your workloads increase, the amount of usage details data can become very large month over month. To better scale your solutions, we recommend customers utilize our Exports feature. More info on that is below:

https://docs.microsoft.com/en-us/azure/cost-management-billing/costs/tutorial-export-acm-data?tabs=azure-portal

adwise3 avatar Sep 09 '21 18:09 adwise3