Documentation ¶
Index ¶
- Variables
- func DetectProjectCostAnomalies(c *cli.Context, p model.Params) error
- func QueryPastDays(fqDatasetTableID string, start, end time.Time) string
- func QueryWeeklyIntervalCostAverage(fqDatasetTableID string, projectID string, weeks int, since time.Time) string
- type AnomalyDetector
- type AnomalyEvent
- type DailyCost
- type JuricaJade
- type ProjectStats
- type ProjectStatsReport
- type SundaySky
Constants ¶
This section is empty.
Variables ¶
View Source
var BestSundaySky = SundaySky{1.25, 2.0, 10, 30} // article uses 3.5 for stddev
View Source
var StandardJuricaJade = JuricaJade{1.25, 2.0, 10, 30} // article SundaySky uses 3.5 for stddev
Functions ¶
func DetectProjectCostAnomalies ¶
DetectProjectCostAnomalies collects 30 days of costs per project to detect a cost Write a report to [DetectProjectCostAnomalies.json] if at lease one anomaly was found.
func QueryPastDays ¶
QueryPastDays returns the query that collects daily cost records between start and end (both including).
Types ¶
type AnomalyDetector ¶ added in v0.6.0
type AnomalyDetector interface { IsAnomaly(stats *ProjectStats) bool String() string WindowDays() int WithStddevThreshold(t float64) AnomalyDetector ChargesPercentage(stats *ProjectStats) float64 }
type AnomalyEvent ¶ added in v0.6.0
type AnomalyEvent struct { EventID string `bigquery:"event_id" ` EventCreationTime time.Time `bigquery:"event_creation_time" ` ProjectID string `bigquery:"project_id" ` ProjectName string `bigquery:"project_name" ` Charges string `bigquery:"charges" ` ChargesPercentage string `bigquery:"charges_percentage" ` Credits string `bigquery:"credits" ` Mean string `bigquery:"mean" ` StandardDeviation string `bigquery:"stddev" ` DetectionDay time.Time `bigquery:"detection_day" ` Detector string `bigquery:"detector" ` }
type DailyCost ¶
type DailyCost struct { Day time.Time `biguery:"consumption_day" json:"consumption_day" ` ProjectName string `bigquery:"project_name" json:"project_name" ` ProjectID string `bigquery:"project_id" json:"project_id" ` Charges float64 `bigquery:"charges" json:"charges"` Credits float64 `bigquery:"credits" json:"credits"` }
type JuricaJade ¶ added in v0.9.2
type JuricaJade struct {
// contains filtered or unexported fields
}
func (JuricaJade) ChargesPercentage ¶ added in v0.9.2
func (s JuricaJade) ChargesPercentage(stats *ProjectStats) float64
pre: bounds of .Daily is checked
func (JuricaJade) IsAnomaly ¶ added in v0.9.2
func (s JuricaJade) IsAnomaly(stats *ProjectStats) bool
func (JuricaJade) String ¶ added in v0.9.2
func (s JuricaJade) String() string
func (JuricaJade) WindowDays ¶ added in v0.9.2
func (s JuricaJade) WindowDays() int
func (JuricaJade) WithStddevThreshold ¶ added in v0.9.2
func (s JuricaJade) WithStddevThreshold(f float64) AnomalyDetector
type ProjectStats ¶
type ProjectStatsReport ¶ added in v0.1.1
type ProjectStatsReport struct { LastDay DailyCost `json:"last_day" ` ChargesPercentage float64 `json:"charges_percentage" ` Mean float64 `json:"mean" ` StandardDeviation float64 `json:"stddev" ` Detector string `json:"detector" ` WeeklyMean float64 `json:"weekly_mean" ` WeeklyStandardDeviation float64 `json:"weekly_stddev" ` }
type SundaySky ¶
type SundaySky struct {
// contains filtered or unexported fields
}
https://github.com/SundaySky/cost-anomaly-detector
func (SundaySky) ChargesPercentage ¶ added in v0.9.2
func (s SundaySky) ChargesPercentage(stats *ProjectStats) float64
pre: bounds of .Daily is checked
func (SundaySky) IsAnomaly ¶
func (s SundaySky) IsAnomaly(stats *ProjectStats) bool
func (SundaySky) WindowDays ¶ added in v0.9.2
func (SundaySky) WithStddevThreshold ¶ added in v0.9.2
func (s SundaySky) WithStddevThreshold(f float64) AnomalyDetector
Click to show internal directories.
Click to hide internal directories.