Documentation
¶
Index ¶
- type DynamoDBPricing
- type Engine
- func (e *Engine) ByRoute(ctx context.Context, limit int) ([]RouteCost, error)
- func (e *Engine) ByService(ctx context.Context) ([]ServiceCost, error)
- func (e *Engine) ByTenant(ctx context.Context, limit int) ([]TenantCost, error)
- func (e *Engine) RequestCost(entry dataplane.RequestEntry) float64
- func (e *Engine) Trend(ctx context.Context, window, bucketSize time.Duration) ([]TimeBucket, error)
- type LambdaPricing
- type PricingConfig
- type RouteCost
- type S3Pricing
- type SQSPricing
- type ServiceCost
- type TenantCost
- type TimeBucket
- type TransferPricing
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DynamoDBPricing ¶
type DynamoDBPricing = config.DynamoDBPricing
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine computes costs for recorded requests using configurable pricing.
func New ¶
func New(requests dataplane.RequestReader, pricing PricingConfig) *Engine
New creates a cost Engine with the given request reader and pricing config.
func (*Engine) ByRoute ¶
ByRoute returns costs aggregated by service+method+path, sorted by TotalCost descending.
func (*Engine) ByService ¶
func (e *Engine) ByService(ctx context.Context) ([]ServiceCost, error)
ByService returns costs aggregated by service, sorted by TotalCost descending.
func (*Engine) ByTenant ¶
ByTenant returns costs aggregated by tenant ID, sorted by TotalCost descending. Entries with empty TenantID are skipped.
func (*Engine) RequestCost ¶
func (e *Engine) RequestCost(entry dataplane.RequestEntry) float64
RequestCost computes the estimated cost of a single request entry.
type LambdaPricing ¶
type LambdaPricing = config.LambdaPricing
Type aliases for config pricing types so cost-package callers do not need to import config directly, and existing code referencing these types continues to compile without change.
type PricingConfig ¶
type PricingConfig = config.PricingConfig
PricingConfig is an alias for config.PricingConfig so callers can use cost.PricingConfig without importing the config package directly.
func DefaultPricingConfig ¶
func DefaultPricingConfig() PricingConfig
DefaultPricingConfig returns a PricingConfig with standard AWS pricing. It delegates to config.DefaultPricingConfig so pricing defaults are defined in a single place.
type RouteCost ¶
type RouteCost struct {
Service string `json:"service"`
Method string `json:"method"`
Path string `json:"path"`
RequestCount int64 `json:"requestCount"`
TotalCost float64 `json:"totalCost"`
AvgCost float64 `json:"avgCost"`
}
RouteCost represents the aggregated cost for a specific route (service + method + path).
type SQSPricing ¶
type SQSPricing = config.SQSPricing
type ServiceCost ¶
type ServiceCost struct {
Service string `json:"service"`
RequestCount int64 `json:"requestCount"`
TotalCost float64 `json:"totalCost"`
AvgCost float64 `json:"avgCost"`
}
ServiceCost represents the aggregated cost for a single AWS service.
type TenantCost ¶
type TenantCost struct {
TenantID string `json:"tenantId"`
RequestCount int64 `json:"requestCount"`
TotalCost float64 `json:"totalCost"`
AvgCost float64 `json:"avgCost"`
}
TenantCost represents the aggregated cost for a specific tenant.
type TimeBucket ¶
type TimeBucket struct {
Start time.Time `json:"start"`
End time.Time `json:"end"`
TotalCost float64 `json:"totalCost"`
RequestCount int64 `json:"requestCount"`
}
TimeBucket represents aggregated cost within a time window.
type TransferPricing ¶
type TransferPricing = config.TransferPricing