Skip to content

Commit

Permalink
fix: Fix calculating total test cost in Mixpanel (#2084)
Browse files Browse the repository at this point in the history
Fixes #

## Test Plan
> How do we know the code works?

In mixpanel ```devices_cost. total_cost ``` event should be the sum of virtual cost and physical cost instead of the sum of physical and virtual minutes
  • Loading branch information
adamfilipow92 authored Jul 12, 2021
1 parent c4b8ba5 commit 3f4bc7d
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions test_runner/src/main/kotlin/ftl/reports/CostReport.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,16 @@ object CostReport : IReport {
totalBillablePhysicalMinutes += it.billableMinutes.physical
}

val virtualCost = calculateVirtualCost(totalBillableVirtualMinutes.toBigDecimal())
val physicalCost = calculatePhysicalCost(totalBillablePhysicalMinutes.toBigDecimal())

args.sendConfiguration(
events = mapOf(
"virtual_cost" to calculateVirtualCost(totalBillableVirtualMinutes.toBigDecimal()),
"physical_cost" to calculatePhysicalCost(totalBillablePhysicalMinutes.toBigDecimal()),
"total_cost" to calculateTotalCost(
totalBillablePhysicalMinutes.toBigDecimal(),
totalBillableVirtualMinutes.toBigDecimal()
"virtual_cost" to virtualCost,
"physical_cost" to physicalCost,
"cost_total" to calculateTotalCost(
virtualCost,
physicalCost
)
),
eventName = "devices_cost"
Expand Down

0 comments on commit 3f4bc7d

Please sign in to comment.