Skip to content

Commit

Permalink
[669] Updates replicationFactors on Unknown Usage to be optional
Browse files Browse the repository at this point in the history
  • Loading branch information
aalva05-tw committed Jan 12, 2022
1 parent f4e3843 commit cce8738
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/chilly-shrimps-hope.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@cloud-carbon-footprint/aws': patch
---

Removes suffix from aws usage type
11 changes: 11 additions & 0 deletions packages/aws/src/__tests__/CostAndUsageReports.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,17 @@ describe('CostAndUsageReports Service', () => {
cost: 10,
region: 'us-east-1',
},
{
accountId: '123456789',
accountName: '123456789',
cloudProvider: 'AWS',
co2e: 0.0000024009352344000006,
cost: 14,
kilowattHours: 0.005774880000000001,
region: 'us-east-1',
serviceName: 'AmazonES',
usesAverageCPUConstant: true,
},
],
groupBy: grouping,
periodEndDate: new Date('2020-10-31T23:59:59.000Z'),
Expand Down
13 changes: 13 additions & 0 deletions packages/aws/src/__tests__/fixtures/athena.fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,19 @@ const queryResultsDataFour = [
{ VarCharValue: '10' },
],
},
{
Data: [
{ VarCharValue: '2020-10-31' },
{ VarCharValue: '123456789' },
{ VarCharValue: 'us-east-1' },
{ VarCharValue: 'AmazonES' },
{ VarCharValue: 'EUC1-HeavyUsage:t3.medium.elasticsearch' },
{ VarCharValue: 'Hours' },
{ VarCharValue: '' },
{ VarCharValue: '3' },
{ VarCharValue: '14' },
],
},
]

export const athenaMockGetQueryResultsWithKinesisESAndEc2Spot: Athena.GetQueryResultsOutput =
Expand Down
5 changes: 4 additions & 1 deletion packages/aws/src/lib/CostAndUsageReportsRow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,10 @@ export default class CostAndUsageReportsRow extends BillingDataRow {
this.usageType,
)
) {
return this.getBurstableInstanceVCPu(instanceType) * this.usageAmount
return (
this.getBurstableInstanceVCPu(instanceType.split('.', 2).join('.')) *
this.usageAmount
)
}
if (!vCpuFromReport)
return this.extractVCpuFromInstanceType(instanceType) * this.usageAmount
Expand Down

0 comments on commit cce8738

Please sign in to comment.