Skip to content
This repository has been archived by the owner on May 19, 2021. It is now read-only.

Commit

Permalink
fix for #12
Browse files Browse the repository at this point in the history
  • Loading branch information
ManuelBahr committed Jul 20, 2017
1 parent a90bc02 commit 31d166b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion azure_costs_exporter/prometheus_collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,6 @@ def collect(self):
groups = df.groupby(base_columns).sum()

for name, value in groups.iterrows():
c.add_metric(name, value.ExtendedCost)
c.add_metric(name, int(round(value.ExtendedCost)))

yield c
4 changes: 2 additions & 2 deletions tests/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
u'Date': u'03/01/2017',
u'Day': 1,
u'DepartmentName': u'Engineering',
u'ExtendedCost': 0.71,
u'ExtendedCost': 0.499222332425423563466,
u'InstanceId': u'platform-vnet',
u'MeterCategory': u'Virtual Network',
u'MeterId': u'c90286c8-adf0-438e-a257-4468387df385',
Expand Down Expand Up @@ -42,7 +42,7 @@
u'Date': u'03/01/2017',
u'Day': 1,
u'DepartmentName': u'Engineering',
u'ExtendedCost': 0.24,
u'ExtendedCost': 0.50000011123124314235234522345,
u'InstanceId': u'/subscriptions/abc3455ac-3feg-2b3c5-abe4-ec1111111e6/resourceGroups/my-group/providers/Microsoft.Storage/storageAccounts/ss7q3264domxo',
u'MeterCategory': u'Windows Azure Storage',
u'MeterId': u'd23a5753-ff85-4ddf-af28-8cc5cf2d3882',
Expand Down
4 changes: 2 additions & 2 deletions tests/test_collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ def test_extract_metrics():
result = generate_latest(registry).decode('utf8').split('\n')
assert len(result) == 5

expected_0 = 'costs{AccountName="platform",DepartmentName="engineering",MeterCategory="virtual network",MeterName="hours",MeterSubCategory="gateway hour",ResourceGroup="",SubscriptionName="production"} 0.71'
expected_1 = 'costs{AccountName="platform",DepartmentName="engineering",MeterCategory="windows azure storage",MeterName="standard io - page blob/disk (gb)",MeterSubCategory="locally redundant",ResourceGroup="my-group",SubscriptionName="production"} 0.24'
expected_0 = 'costs{AccountName="platform",DepartmentName="engineering",MeterCategory="virtual network",MeterName="hours",MeterSubCategory="gateway hour",ResourceGroup="",SubscriptionName="production"} 0.0'
expected_1 = 'costs{AccountName="platform",DepartmentName="engineering",MeterCategory="windows azure storage",MeterName="standard io - page blob/disk (gb)",MeterSubCategory="locally redundant",ResourceGroup="my-group",SubscriptionName="production"} 1.0'

assert result[2] == expected_0
assert result[3] == expected_1
Expand Down

0 comments on commit 31d166b

Please # to comment.