Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update defaults for sysdig #160

Merged
merged 2 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions infracost-usage-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ resource_type_default_usage:
secretsmanager_instance: 1
logdna_gigabyte_months: 1
activitytracker_gigabyte_months: 1
monitoring_node_hour: 1
monitoring_container_hour: 1
monitoring_api_call: 1
monitoring_timeseries_hour: 1
monitoring_node_hour: 700
monitoring_container_hour: 700
monitoring_api_call: 1000
monitoring_timeseries_hour: 1000
continuousdelivery_authorized_users: 1
wml_capacity_unit_hour: 20
wml_instance: 1
Expand Down Expand Up @@ -1286,10 +1286,10 @@ resource_usage:
appconnect_vcpu_hours: 10 # The number of VCPU hours used in a month
logdna_gigabyte_months: 10 # The amount of logs in a month in GB
activitytracker_gigabyte_months: 10 # The amount of logs in a month in GB
monitoring_node_hour: 730 # The amount of hours monitoring runs on a host in a month
monitoring_container_hour: 1460 # Additional containers on a host above the base 50
monitoring_api_call: 100000 # Additional API calls above the base 1M/instance
monitoring_timeseries_hour: 100 # Additional time-series cost above the base 1000/host
monitoring_node_hour: 700 # The amount of hours monitoring runs on a host in a month
monitoring_container_hour: 700 # Additional containers on a host above the base 50
monitoring_api_call: 1000 # Additional API calls above the base 1M/instance
monitoring_timeseries_hour: 1000 # Additional time-series cost above the base 1000/host
continuousdelivery_authorized_users: 10 # Number of authorized users to the CD instance and its managed toolchains
wml_capacity_unit_hour: 20 # Amount of Capacity Unit-Hours used in a month
wml_instance: 1 # The number of instances used per month where each instance includes 2500 CUHs
Expand Down
116 changes: 0 additions & 116 deletions internal/resources/ibm/resource_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -492,122 +492,6 @@ func GetLogDNACostComponents(r *ResourceInstance) []*schema.CostComponent {
}
}

func GetSysdigTimeseriesCostComponent(r *ResourceInstance) *schema.CostComponent {
var q *decimal.Decimal
if r.Monitoring_TimeSeriesHour != nil {
q = decimalPtr(decimal.NewFromFloat(*r.Monitoring_TimeSeriesHour))
}
return &schema.CostComponent{
Name: "Additional Time series",
Unit: "Time series hour",
UnitMultiplier: decimal.NewFromInt(1),
MonthlyQuantity: q,
ProductFilter: &schema.ProductFilter{
VendorName: strPtr("ibm"),
Region: strPtr(r.Location),
Service: &r.Service,
AttributeFilters: []*schema.AttributeFilter{
{Key: "planName", Value: &r.Plan},
},
},
PriceFilter: &schema.PriceFilter{
Unit: strPtr("TIME_SERIES_HOURS"),
},
}
}

func GetSysdigContainerCostComponent(r *ResourceInstance) *schema.CostComponent {
var q *decimal.Decimal
if r.Monitoring_ContainerHour != nil {
q = decimalPtr(decimal.NewFromFloat(*r.Monitoring_ContainerHour))
}
return &schema.CostComponent{
Name: "Additional Containers",
Unit: "Container Hours",
UnitMultiplier: decimal.NewFromInt(1),
MonthlyQuantity: q,
ProductFilter: &schema.ProductFilter{
VendorName: strPtr("ibm"),
Region: strPtr(r.Location),
Service: &r.Service,
AttributeFilters: []*schema.AttributeFilter{
{Key: "planName", Value: &r.Plan},
},
},
PriceFilter: &schema.PriceFilter{
Unit: strPtr("CONTAINER_HOURS"),
},
}
}

func GetSysdigApiCallCostComponent(r *ResourceInstance) *schema.CostComponent {
var q *decimal.Decimal
if r.Monitoring_APICall != nil {
q = decimalPtr(decimal.NewFromFloat(*r.Monitoring_APICall))
}
return &schema.CostComponent{
Name: "Additional API Calls",
Unit: "API Calls",
UnitMultiplier: decimal.NewFromInt(1),
MonthlyQuantity: q,
ProductFilter: &schema.ProductFilter{
VendorName: strPtr("ibm"),
Region: strPtr(r.Location),
Service: &r.Service,
AttributeFilters: []*schema.AttributeFilter{
{Key: "planName", Value: &r.Plan},
},
},
PriceFilter: &schema.PriceFilter{
Unit: strPtr("API_CALL_HOURS"),
},
}
}

func GetSysdigNodeHourCostComponent(r *ResourceInstance) *schema.CostComponent {
var q *decimal.Decimal
if r.Monitoring_NodeHour != nil {
q = decimalPtr(decimal.NewFromFloat(*r.Monitoring_NodeHour))
}
return &schema.CostComponent{
Name: "Base Node Hour",
Unit: "Node Hours",
UnitMultiplier: decimal.NewFromInt(1),
MonthlyQuantity: q,
ProductFilter: &schema.ProductFilter{
VendorName: strPtr("ibm"),
Region: strPtr(r.Location),
Service: &r.Service,
AttributeFilters: []*schema.AttributeFilter{
{Key: "planName", Value: &r.Plan},
},
},
PriceFilter: &schema.PriceFilter{
Unit: strPtr("NODE_HOURS"),
},
}
}

func GetSysdigCostComponenets(r *ResourceInstance) []*schema.CostComponent {

if r.Plan == "lite" {
costComponent := &schema.CostComponent{
Name: "Lite plan",
UnitMultiplier: decimal.NewFromInt(1),
MonthlyQuantity: decimalPtr(decimal.NewFromInt(1)),
}
costComponent.SetCustomPrice(decimalPtr(decimal.NewFromInt(0)))
return []*schema.CostComponent{costComponent}
} else {
return []*schema.CostComponent{
GetSysdigTimeseriesCostComponent(r),
GetSysdigContainerCostComponent(r),
GetSysdigApiCallCostComponent(r),
GetSysdigNodeHourCostComponent(r),
}
}
}

func GetActivityTrackerCostComponents(r *ResourceInstance) []*schema.CostComponent {
var q *decimal.Decimal
if r.ActivityTracker_GigabyteMonths != nil {
Expand Down
122 changes: 122 additions & 0 deletions internal/resources/ibm/resource_instance_sysdig-monitor.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
package ibm

import (
"github.com/infracost/infracost/internal/schema"
"github.com/shopspring/decimal"
)

func GetSysdigTimeseriesCostComponent(r *ResourceInstance) *schema.CostComponent {
var q *decimal.Decimal
if r.Monitoring_TimeSeriesHour != nil {
q = decimalPtr(decimal.NewFromFloat(*r.Monitoring_TimeSeriesHour))
}
return &schema.CostComponent{
Name: "Additional Time series",
Unit: "Time series hour",
UnitMultiplier: decimal.NewFromInt(1),
MonthlyQuantity: q,
ProductFilter: &schema.ProductFilter{
VendorName: strPtr("ibm"),
Region: strPtr(r.Location),
Service: &r.Service,
AttributeFilters: []*schema.AttributeFilter{
{Key: "planName", Value: &r.Plan},
},
},
PriceFilter: &schema.PriceFilter{
Unit: strPtr("TIME_SERIES_HOURS"),
},
}
}

func GetSysdigContainerCostComponent(r *ResourceInstance) *schema.CostComponent {
var q *decimal.Decimal
if r.Monitoring_ContainerHour != nil {
q = decimalPtr(decimal.NewFromFloat(*r.Monitoring_ContainerHour))
}
return &schema.CostComponent{
Name: "Additional Container Hours",
Unit: "Container Hours",
UnitMultiplier: decimal.NewFromInt(1),
MonthlyQuantity: q,
ProductFilter: &schema.ProductFilter{
VendorName: strPtr("ibm"),
Region: strPtr(r.Location),
Service: &r.Service,
AttributeFilters: []*schema.AttributeFilter{
{Key: "planName", Value: &r.Plan},
},
},
PriceFilter: &schema.PriceFilter{
Unit: strPtr("CONTAINER_HOURS"),
},
}
}

func GetSysdigApiCallCostComponent(r *ResourceInstance) *schema.CostComponent {
var q *decimal.Decimal
if r.Monitoring_APICall != nil {
q = decimalPtr(decimal.NewFromFloat(*r.Monitoring_APICall))
}
return &schema.CostComponent{
Name: "Additional API Calls",
Unit: "API Calls",
UnitMultiplier: decimal.NewFromInt(1),
MonthlyQuantity: q,
ProductFilter: &schema.ProductFilter{
VendorName: strPtr("ibm"),
Region: strPtr(r.Location),
Service: &r.Service,
AttributeFilters: []*schema.AttributeFilter{
{Key: "planName", Value: &r.Plan},
},
},
PriceFilter: &schema.PriceFilter{
Unit: strPtr("API_CALL_HOURS"),
},
}
}

func GetSysdigNodeHourCostComponent(r *ResourceInstance) *schema.CostComponent {
var q *decimal.Decimal
if r.Monitoring_NodeHour != nil {
q = decimalPtr(decimal.NewFromFloat(*r.Monitoring_NodeHour))
}
return &schema.CostComponent{
Name: "Node Hours",
Unit: "Node Hours",
UnitMultiplier: decimal.NewFromInt(1),
MonthlyQuantity: q,
ProductFilter: &schema.ProductFilter{
VendorName: strPtr("ibm"),
Region: strPtr(r.Location),
Service: &r.Service,
AttributeFilters: []*schema.AttributeFilter{
{Key: "planName", Value: &r.Plan},
},
},
PriceFilter: &schema.PriceFilter{
Unit: strPtr("NODE_HOURS"),
},
}
}

func GetSysdigCostComponenets(r *ResourceInstance) []*schema.CostComponent {

if r.Plan == "lite" {
costComponent := &schema.CostComponent{
Name: "Lite plan",
UnitMultiplier: decimal.NewFromInt(1),
MonthlyQuantity: decimalPtr(decimal.NewFromInt(1)),
}
costComponent.SetCustomPrice(decimalPtr(decimal.NewFromInt(0)))
return []*schema.CostComponent{costComponent}
} else {
return []*schema.CostComponent{
GetSysdigTimeseriesCostComponent(r),
GetSysdigContainerCostComponent(r),
GetSysdigApiCallCostComponent(r),
GetSysdigNodeHourCostComponent(r),
}
}
}
Loading