anomalies

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 25, 2019 License: Apache-2.0 Imports: 15 Imported by: 2

Documentation

Index

Constants

View Source
const IndexPrefixAnomaliesDetection = "anomalies-detection"
View Source
const TemplateAnomaliesDetection = `
{
	"template": "*-` + IndexPrefixAnomaliesDetection + `",
	"version": 2,
	"mappings": {
		"` + TypeProductAnomaliesDetection + `": {
			"properties": {
				"account": {
					"type": "keyword"
				},
				"date": {
					"type": "date"
				},
				"product" : {
					"type": "keyword"
				},
				"abnormal" : {
					"type": "boolean"
				},
				"recurrent" : {
					"type": "boolean"
				},
				"cost": {
					"type": "object",
					"properties": {
						"value": {
							"type": "double"
						},
						"maxExpected": {
							"type": "double"
						}
					}
				}
			},
			"_all": {
				"enabled": false
			},
			"numeric_detection": false,
			"date_detection": false
		}
	}
}
`
View Source
const TemplateNameAnomaliesDetection = "anomalies-detection"
View Source
const TypeProductAnomaliesDetection = "product-anomalies-detection"

Variables

This section is empty.

Functions

func RunAnomaliesDetection

func RunAnomaliesDetection(account aws.AwsAccount, lastUpdate time.Time, ctx context.Context) (time.Time, error)

RunAnomaliesDetection run every anomaly detection algorithms and store results in ElasticSearch.

Types

type AnalyzedCost

type AnalyzedCost struct {
	Meta      AnalyzedCostEssentialMeta
	Cost      float64
	UpperBand float64
	Anomaly   bool
}

AnalyzedCost is returned by Bollinger Band algorithm and contains every necessary data for it. It also contains metadata, ignored by the algorithm.

type AnalyzedCostEssentialMeta

type AnalyzedCostEssentialMeta struct {
	AdditionalMeta interface{}
	Date           string
}

AnalyzedCostEssentialMeta is the mandatory metadata ignored by the algorithm and contains the Date and an additional metadata with specialized values.

type AnalyzedCostProductMeta

type AnalyzedCostProductMeta struct {
	Product string
}

AnalyzedCostProductMeta can be the additional metadata in AnalyzedCostEssentialMeta. It's used to detect product anomalies and store them in ElasticSearch with more info.

type AnalyzedCosts

type AnalyzedCosts []AnalyzedCost

type AnomalyEsQueryParams

type AnomalyEsQueryParams struct {
	DateBegin time.Time
	DateEnd   time.Time
	Account   string
	Index     string
}

AnomalyEsQueryParams will store the parsed query params

type ElasticSearchFunction

type ElasticSearchFunction func(
	account string,
	durationBegin time.Time,
	durationEnd time.Time,
	aggregationPeriod string,
	client *elastic.Client,
	index string,
) *elastic.SearchService

ElasticSearchFunction is a function passed to makeElasticSearchRequest, used to get results from ElasticSearch.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL