Commerce: Rate Card "meter_sub_category" output format has changed!
Was wondering why my code for outputting VM price started failing. Found out the "meter_sub_category" for the Rate Card meter object has changed. For instance D8v3 use to have output:
Standard_D8_v3 VM
Now it outputs
Dv3/DSv3 Series
This is problematic because compute_client.virtual_machine_sizes.list() gives the first format (Standard_D8_v3)
What an easy way to match up VM Size with the Rate card pricing?
@yugangw-msft have you encountered this?
Wrong service - adding Commerce. Sorry @yugangw-msft - as you were :)
Hi @ttruong7 Could you confirm that you used the same package, and suddenly your code has stopped working? This would mean the RestAPI changed suddenly one day, and I would route this problem differently. Thanks!
Hi @lmazuel
Yes the package version is still the same and hasn't be changed. Version: azure-mgmt-commerce==1.0.1. Code used to grab rates:
OfferDurableID = 'MS-AZR-0003P' # Pay-as-you-go
rate = commerce_client.rate_card.get(
"OfferDurableId eq '{}' and Currency eq 'USD' \
and Locale eq 'en-US' and RegionInfo eq 'US'".format(OfferDurableID)
)
rate_filtered = list(filter(lambda x: x.meter_region == 'US West' and x.meter_category == 'Virtual Machines',
rate.meters))
for r in rate_filtered:
print(r)`
# Example Output
'''
{'additional_properties': {}, 'meter_id': '878ae2c5-f13d-4c83-9af2-7b333b1c9fa1', 'meter_name': 'D16 v3/D16s v3', 'meter_category': 'Virtual Machines', 'meter_sub_category': 'Dv3/DSv3 Series', 'unit': '1 Hour', 'meter_tags': [], 'meter_region': 'US West', 'meter_rates': {'0': 0.936}, 'effective_date': datetime.datetime(2017, 7, 21, 0, 0, tzinfo=<isodate.tzinfo.Utc object at 0x7f5e3648cdd8>), 'included_quantity': 0.0}
'''
###
## Here, meter_sub_category use to output: Standard_D16_v3 VM
###
I'm also getting this issue. This feature is very important to our customers for us to predict rates on VMs. In the past month or so the rate card meters started returning different sub categories that broke our code. I need to be able to map VM sizes to meters, but I don't see a consistent pattern between the naming conventions. For example, 'Basic_A0' VM size is equivalent to the 'A Series Basic' sub_category in meters, but 'Standard_A0' is just the 'A0' sub_category, but 'Standard_DS2_v3' is also very different. Is there an easy way to map the VM sizes to meters?
@yugangw-msft for ideas?
Adding to this. Why are region names in a different format than other Azure APIs? For instance, the region name when querying rate card gives 'meter_region': 'EU West'. For Compute API, region name is 'Europe West'. Similarly, 'Asia East' is 'AP East'. This mismatch in standards is rather aggravating.
I found this file: http://download.microsoft.com/download/4/6/4/464DEF8A-4D12-4956-9066-34750C84219F/AzureMeterMapping-en.xlsx available for mapping old naming conventions to new ones. Pretty hefty file to read from, but glad it exists.
The region names are also rather aggravating to me.
@gsimore Thanks for this!
np :)
@ttruong-a10 Given latest azure-mgmt-commerce is 6.0.0, could you help to check if this issue is stall valid?
Thank you.
Hi, we're sending this friendly reminder because we haven't heard back from you in a while. We need more information about this issue to help address it. Please be sure to give us your input within the next 7 days. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you!