regression

package
v0.0.0-...-03d6fc4 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2019 License: BSD-3-Clause Imports: 29 Imported by: 0

Documentation

Overview

Package regression provides for tracking Perf regressions.

Index

Constants

View Source
const (
	// MAX_FINISHED_PROCESS_AGE is the amount of time to keep a finished
	// ClusterRequestProcess around before deleting it.
	MAX_FINISHED_PROCESS_AGE = time.Minute

	// MAX_K is the largest K used for clustering.
	MAX_K = 100

	// MAX_RADIUS  is the maximum number of points on either side of a commit
	// that will be included in clustering. This cannot exceed COMMITS_PER_TILE.
	MAX_RADIUS = 50

	// SPARSE_BLOCK_SEARCH_MULT When searching for commits that have data in a
	// sparse data set, we'll request data in chunks of this many commits per
	// point we are looking for.
	SPARSE_BLOCK_SEARCH_MULT = 200

	CLUSTERING_REQUEST_TYPE_SINGLE ClusterRequestType = 0 // Do clustering at a single commit.
	CLUSTERING_REQUEST_TYPE_LAST_N ClusterRequestType = 1 // Do clustering over a range of dense commits.
)

Variables

View Source
var ErrNoClusterFound = errors.New("No Cluster.")

Functions

func FilterTail

func FilterTail(trace []float32, quantile float64, multiplier float64, slack float64) float32

FilterTail - Please see go/calmbench-trace-tail for how we filter the tail.

func NewSingleDataFrameIterator

func NewSingleDataFrameIterator(progress types.Progress, cidl *cid.CommitIDLookup, v vcsinfo.VCS, request *ClusterRequest, dfBuilder dataframe.DataFrameBuilder) *singleIterator

NewSingleDataFrameIterator creates a singeIterator instance.

func RegressionsForAlert

func RegressionsForAlert(ctx context.Context, cfg *alerts.Config, ps paramtools.ParamSet, clusterResponseProcessor ClusterResponseProcessor, numContinuous int, end time.Time, git *gitinfo.GitInfo, cidl *cid.CommitIDLookup, dfBuilder dataframe.DataFrameBuilder)

RegressionsForAlert looks for regressions to the given alert over the last 'numContinuous' commits with data and periodically calls clusterResponseProcessor with the results of checking each commit.

func ShortcutFromKeys

func ShortcutFromKeys(summary *clustering2.ClusterSummaries) error

ShortcutFromKeys stores a new shortcut for each cluster based on its Keys.

func StepFit

func StepFit(df *dataframe.DataFrame, k int, stddevThreshold float32, progress clustering2.Progress, interesting float32) (*clustering2.ClusterSummaries, error)

StepFit finds regressions by looking at each trace individually and seeing if that looks like a regression.

func Tail

func Tail(df *dataframe.DataFrame, k int, stddevThreshold float32, progress clustering2.Progress, interesting float32) (*clustering2.ClusterSummaries, error)

Tail finds regressions in calmbench data.

Types

type CidsWithDataInRange

type CidsWithDataInRange func(begin, end int) ([]*cid.CommitID, error)

CidsWithDataInRange is passed to calcCids, and returns all the commit ids in [begin, end) that have data.

type ClusterRequest

type ClusterRequest struct {
	Source      string             `json:"source"`
	Offset      int                `json:"offset"`
	Radius      int                `json:"radius"`
	Query       string             `json:"query"`
	K           int                `json:"k"`
	TZ          string             `json:"tz"`
	Algo        types.ClusterAlgo  `json:"algo"`
	Interesting float32            `json:"interesting"`
	Sparse      bool               `json:"sparse"`
	Type        ClusterRequestType `json:"type"`
	N           int32              `json:"n"`
	End         time.Time          `json:"end"`
}

ClusterRequest is all the info needed to start a clustering run.

func (*ClusterRequest) Id

func (c *ClusterRequest) Id() string

type ClusterRequestProcess

type ClusterRequestProcess struct {
	// contains filtered or unexported fields
}

ClusterRequestProcess handles the processing of a single ClusterRequest.

func (*ClusterRequestProcess) Response

func (p *ClusterRequestProcess) Response() *ClusterResponse

Response returns the ClusterResponse of the completed ClusterRequestProcess.

func (*ClusterRequestProcess) Responses

func (p *ClusterRequestProcess) Responses() []*ClusterResponse

Responses returns all the ClusterResponse's of the ClusterRequestProcess.

func (*ClusterRequestProcess) Run

Run does the work in a ClusterRequestProcess. It does not return until all the work is done or the request failed. Should be run as a Go routine.

func (*ClusterRequestProcess) Status

Status returns the ProcessingState and the message of a ClusterRequestProcess of the given 'id'.

type ClusterRequestType

type ClusterRequestType int

type ClusterResponse

type ClusterResponse struct {
	Summary *clustering2.ClusterSummaries `json:"summary"`
	Frame   *dataframe.FrameResponse      `json:"frame"`
}

ClusterResponse is the response from running clustering over a ClusterRequest.

func Run

func Run(ctx context.Context, req *ClusterRequest, git *gitinfo.GitInfo, cidl *cid.CommitIDLookup, dfBuilder dataframe.DataFrameBuilder, clusterResponseProcessor ClusterResponseProcessor) ([]*ClusterResponse, error)

Run takes a ClusterRequest and runs it to completion before returning the results.

type ClusterResponseProcessor

type ClusterResponseProcessor func([]*ClusterResponse)

ClusterResponseProcessor is a callback that is called with ClusterResponses as a ClusterRequest is being processed.

type ConfigProvider

type ConfigProvider func() ([]*alerts.Config, error)

ConfigProvider is a function that's called to return a slice of alerts.Config. It is passed to NewContinuous.

type Continuous

type Continuous struct {
	// contains filtered or unexported fields
}

Continuous is used to run clustering on the last numCommits commits and look for regressions.

func NewContinuous

func NewContinuous(git *gitinfo.GitInfo, cidl *cid.CommitIDLookup, provider ConfigProvider, store *Store, numCommits int, radius int, notifier *notify.Notifier, paramsProvider ParamsetProvider, dfBuilder dataframe.DataFrameBuilder) *Continuous

NewContinuous creates a new *Continuous.

provider - Produces the slice of alerts.Config's that determine the clustering to perform.
numCommits - The number of commits to run the clustering over.
radius - The number of commits on each side of a commit to include when clustering.

func (*Continuous) CurrentStatus

func (c *Continuous) CurrentStatus() Current

func (*Continuous) Run

func (c *Continuous) Run(ctx context.Context)

Run starts the continuous running of clustering over the last numCommits commits.

Note that it never returns so it should be called as a Go routine.

func (*Continuous) Untriaged

func (c *Continuous) Untriaged() (int, error)

type Current

type Current struct {
	Commit *cid.CommitDetail `json:"commit"`
	Alert  *alerts.Config    `json:"alert"`
}

Current state of looking for regressions, i.e. the current commit and alert being worked on.

type DSRegression

type DSRegression struct {
	TS      int64
	Triaged bool
	Body    string `datastore:",noindex"`
}

DSRegression is used for storing Regressions in Cloud Datastore.

type DataFrameIterator

type DataFrameIterator interface {
	Next() bool
	Value(ctx context.Context) (*dataframe.DataFrame, error)
}

DataFrameIterator is an iterator that produces DataFrames.

for it.Next() {
  df, err := it.Value(ctx)
  // Do something with df.
}

func NewDataFrameIterator

func NewDataFrameIterator(ctx context.Context, progress types.Progress, req *ClusterRequest, dfBuilder dataframe.DataFrameBuilder) (DataFrameIterator, error)

NewDataFrameIterator retuns a DataFrameIterator that produces a set of dataframes for the given ClusterRequest.

type DetailLookup

type DetailLookup func(c *cid.CommitID) (*cid.CommitDetail, error)

type ParamsetProvider

type ParamsetProvider func() paramtools.ParamSet

ParamsetProvider is a function that's called to return the current paramset. It is passed to NewContinuous.

type ProcessState

type ProcessState string
const (
	PROCESS_RUNNING ProcessState = "Running"
	PROCESS_SUCCESS ProcessState = "Success"
	PROCESS_ERROR   ProcessState = "Error"
)

type Regression

type Regression struct {
	Low        *clustering2.ClusterSummary `json:"low"`   // Can be nil.
	High       *clustering2.ClusterSummary `json:"high"`  // Can be nil.
	Frame      *dataframe.FrameResponse    `json:"frame"` // Describes the Low and High ClusterSummary's.
	LowStatus  TriageStatus                `json:"low_status"`
	HighStatus TriageStatus                `json:"high_status"`
}

Regression tracks the status of the Low and High regression clusters, if they exist for a given CommitID and alertid.

Note that Low and High can be nil if no regression has been found in that direction.

TODO(jcgregorio) Now that we can search for regressions using GroupBy it is possible that Frame will only be valid for Low or High. Fix by refactoring Regression.

func RegressionFromClusterResponse

func RegressionFromClusterResponse(ctx context.Context, resp *ClusterResponse, cfg *alerts.Config, cidl *cid.CommitIDLookup) (*cid.CommitDetail, *Regression, error)

RegressionFromClusterResponse returns the commit for the regression along with the *Regression.

func (*Regression) Merge

func (r *Regression) Merge(rhs *Regression) *Regression

Merge the results from rhs into this Regression.

func (*Regression) Triaged

func (r *Regression) Triaged() bool

Triaged returns true if triaged.

type Regressions

type Regressions struct {
	ByAlertID map[string]*Regression `json:"by_query"`
	// contains filtered or unexported fields
}

Regressions is a map[alertid]Regression and one Regressions is stored for each CommitID if any regressions are found.

func New

func New() *Regressions

func (*Regressions) JSON

func (r *Regressions) JSON() ([]byte, error)

JSON returns the Regressions serialized as JSON. Use this instead of serializing Regression directly as it holds the mutex while serializing.

func (*Regressions) SetHigh

func (r *Regressions) SetHigh(alertid string, df *dataframe.FrameResponse, high *clustering2.ClusterSummary) bool

SetHigh sets the cluster for a high regression.

Returns true if this is a new regression.

func (*Regressions) SetLow

SetLow sets the cluster for a low regression.

Returns true if this is a new regression.

func (*Regressions) TriageHigh

func (r *Regressions) TriageHigh(alertid string, tr TriageStatus) error

TriageHigh sets the triage status for the high cluster.

func (*Regressions) TriageLow

func (r *Regressions) TriageLow(alertid string, tr TriageStatus) error

TriageLow sets the triage status for the low cluster.

func (*Regressions) Triaged

func (r *Regressions) Triaged() bool

Triaged returns true if all clusters are triaged.

type RunningClusterRequests

type RunningClusterRequests struct {
	// contains filtered or unexported fields
}

RunningClusterRequests keeps track of all the ClusterRequestProcess's.

Once a ClusterRequestProcess is complete the results will be kept in memory for MAX_FINISHED_PROCESS_AGE before being deleted.

func NewRunningClusterRequests

func NewRunningClusterRequests(git *gitinfo.GitInfo, cidl *cid.CommitIDLookup, interesting float32, dfBuilder dataframe.DataFrameBuilder) *RunningClusterRequests

NewRunningClusterRequests return a new RunningClusterRequests.

func (*RunningClusterRequests) Add

Add starts a new running ClusterRequestProcess and returns the ID of the process to be used in calls to Status() and Response().

func (*RunningClusterRequests) Response

func (fr *RunningClusterRequests) Response(id string) (*ClusterResponse, error)

Response returns the ClusterResponse of the completed ClusterRequestProcess.

func (*RunningClusterRequests) Responses

func (fr *RunningClusterRequests) Responses(id string) ([]*ClusterResponse, error)

Responses returns the ClusterResponse's of the completed ClusterRequestProcess.

func (*RunningClusterRequests) Status

Status returns the ProcessingState and the message of a ClusterRequestProcess of the given 'id'.

type Status

type Status string

Status is used in TriageStatus.

const (
	NONE      Status = ""          // There is no regression.
	POSITIVE  Status = "positive"  // This change in performance is OK/expected.
	NEGATIVE  Status = "negative"  // This regression is a bug.
	UNTRIAGED Status = "untriaged" // The regression has not been triaged.
)

Status constants.

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store persists Regressions to/from an SQL database.

func NewStore

func NewStore() *Store

NewStore returns a new Store.

func (*Store) Range

func (s *Store) Range(begin, end int64) (map[string]*Regressions, error)

Range returns a map from cid.ID()'s to *Regressions that exist in the given time range

func (*Store) SetHigh

func (s *Store) SetHigh(cid *cid.CommitDetail, alertID string, df *dataframe.FrameResponse, high *clustering2.ClusterSummary) (bool, error)

SetHigh sets the cluster for a high regression at the given commit and alertID.

func (*Store) SetLow

func (s *Store) SetLow(cid *cid.CommitDetail, alertID string, df *dataframe.FrameResponse, low *clustering2.ClusterSummary) (bool, error)

SetLow sets the cluster for a low regression at the given commit and alertID.

func (*Store) TriageHigh

func (s *Store) TriageHigh(cid *cid.CommitDetail, alertID string, tr TriageStatus) error

TriageHigh sets the triage status for the high cluster at the given commit and alertID.

func (*Store) TriageLow

func (s *Store) TriageLow(cid *cid.CommitDetail, alertID string, tr TriageStatus) error

TriageLow sets the triage status for the low cluster at the given commit and alertID.

func (*Store) Untriaged

func (s *Store) Untriaged() (int, error)

Untriaged returns the number of untriaged regressions.

func (*Store) Write

func (s *Store) Write(regressions map[string]*Regressions, lookup DetailLookup) error

type Subset

type Subset string

Subset is the subset of regressions we are querying for.

const (
	ALL_SUBSET         Subset = "all"         // Include all regressions in a range.
	REGRESSIONS_SUBSET Subset = "regressions" // Only include regressions in a range that are alerting.
	UNTRIAGED_SUBSET   Subset = "untriaged"   // All untriaged alerting regressions regardless of range.
)

type TriageStatus

type TriageStatus struct {
	Status  Status `json:"status"`
	Message string `json:"message"`
}

Jump to

Keyboard shortcuts

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