chromeperf

package
v0.0.0-...-13f153f Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: BSD-3-Clause Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AlertGroupAPIName = "alert_group"
	DetailsFuncName   = "details"
	MastersKey        = "masters"
	BotsKey           = "bots"
	BenchmarksKey     = "benchmarks"
	TestsKey          = "tests"
	Subtests1Key      = "subtests_1"
	Subtests2Key      = "subtests_2"
)
View Source
const (
	AnomalyAPIName   = "anomalies"
	AddFuncName      = "add"
	FindFuncName     = "find"
	FindTimeFuncName = "find_time"
	GetFuncName      = "get"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AlertGroupApiClient

type AlertGroupApiClient interface {
	// GetAlertGroupDetails returns the alert group details for the provided group key.
	GetAlertGroupDetails(ctx context.Context, groupKey string) (*AlertGroupDetails, error)
}

AlertGroupApiClient provides an interface to interact with the alert_group api in chromeperf.

func NewAlertGroupApiClient

func NewAlertGroupApiClient(ctx context.Context) (AlertGroupApiClient, error)

NewAlertGroupApiClient returns a new instance of AlertGroupApiClient

type AlertGroupDetails

type AlertGroupDetails struct {
	GroupId           string            `json:"group_id"`
	Anomalies         map[string]string `json:"anomalies"`
	StartCommitNumber int32             `json:"start_commit"`
	EndCommitNumber   int32             `json:"end_commit"`
}

AlertGroupDetails contains data received from the alert group api.

func (*AlertGroupDetails) GetQueryParams

func (alertGroup *AlertGroupDetails) GetQueryParams(ctx context.Context) map[string][]string

GetQueryParams returns the query parameters corresponding to the alert group data.

func (*AlertGroupDetails) GetQueryParamsPerTrace

func (alertGroup *AlertGroupDetails) GetQueryParamsPerTrace(ctx context.Context) []map[string][]string

GetQueryParamsPerTrace returns an array of query parameters where each element consists of query params for a specific anomaly

type Anomaly

type Anomaly struct {
	Id                  int     `json:"id"`
	TestPath            string  `json:"test_path"`
	BugId               int     `json:"bug_id"`
	StartRevision       int     `json:"start_revision"`
	EndRevision         int     `json:"end_revision"`
	IsImprovement       bool    `json:"is_improvement"`
	Recovered           bool    `json:"recovered"`
	State               string  `json:"state"`
	Statistics          string  `json:"statistic"`
	Unit                string  `json:"units"`
	DegreeOfFreedom     float64 `json:"degrees_of_freedom"`
	MedianBeforeAnomaly float64 `json:"median_before_anomaly"`
	MedianAfterAnomaly  float64 `json:"median_after_anomaly"`
	PValue              float64 `json:"p_value"`
	SegmentSizeAfter    int     `json:"segment_size_after"`
	SegmentSizeBefore   int     `json:"segment_size_before"`
	StdDevBeforeAnomaly float64 `json:"std_dev_before_anomaly"`
	TStatistics         float64 `json:"t_statistic"`
}

Anomaly defines the object return from Chrome Perf API.

type AnomalyApiClient

type AnomalyApiClient interface {
	// ReportRegression sends regression information to chromeperf.
	ReportRegression(ctx context.Context, testPath string, startCommitPosition int32, endCommitPosition int32, projectId string, isImprovement bool, botName string, internal bool, medianBefore float32, medianAfter float32) (*ReportRegressionResponse, error)

	// GetAnomalyFromUrlSafeKey returns the anomaly details based on the urlsafe key.
	GetAnomalyFromUrlSafeKey(ctx context.Context, key string) (startCommit int, endCommit int, queryParams map[string][]string, err error)

	// GetAnomalies retrieves anomalies for a given set of traces within the supplied commit positions.
	GetAnomalies(ctx context.Context, traceNames []string, startCommitPosition int, endCommitPosition int) (AnomalyMap, error)

	// GetAnomaliesTimeBased retrieves anomalies for a given set of traces within the supplied commit positions.
	GetAnomaliesTimeBased(ctx context.Context, traceNames []string, startTime time.Time, endTime time.Time) (AnomalyMap, error)

	// GetAnomaliesAroundRevision retrieves traces with anomalies that were generated around a specific commit
	GetAnomaliesAroundRevision(ctx context.Context, revision int) ([]AnomalyForRevision, error)
}

AnomalyApiClient provides interface to interact with chromeperf "anomalies" api

func NewAnomalyApiClient

func NewAnomalyApiClient(ctx context.Context) (AnomalyApiClient, error)

NewAnomalyApiClient returns a new AnomalyApiClient instance.

type AnomalyForRevision

type AnomalyForRevision struct {
	StartRevision int                 `json:"start_revision"`
	EndRevision   int                 `json:"end_revision"`
	Anomaly       Anomaly             `json:"anomaly"`
	Params        map[string][]string `json:"params"`
	TestPath      string              `json:"test_path"`
}

AnomalyForRevision defines struct to contain anomaly data for a specific revision

type AnomalyMap

type AnomalyMap map[string]CommitNumberAnomalyMap

AnomalyMap is a map of CommitNumberAnomalyMap, keyed by traceId.

type CommitNumberAnomalyMap

type CommitNumberAnomalyMap map[types.CommitNumber]Anomaly

CommitNumberAnomalyMap is a map of Anomaly, keyed by commit number.

type GetAnomaliesRequest

type GetAnomaliesRequest struct {
	Tests       []string `json:"tests,omitempty"`
	MaxRevision string   `json:"max_revision,omitempty"`
	MinRevision string   `json:"min_revision,omitempty"`
	Revision    int      `json:"revision,omitempty"`
}

GetAnomaliesRequest struct to request anomalies from the chromeperf api. The parameters can be one of below described. 1. Revision: Retrieves anomalies around that revision number. 2. Tests-MinRevision-MaxRevision: Retrieves anomalies for the given set of tests between the min and max revisions

type GetAnomaliesResponse

type GetAnomaliesResponse struct {
	Anomalies map[string][]Anomaly `json:"anomalies"`
}

type GetAnomaliesTimeBasedRequest

type GetAnomaliesTimeBasedRequest struct {
	Tests     []string  `json:"tests,omitempty"`
	StartTime time.Time `json:"start_time,omitempty"`
	EndTime   time.Time `json:"end_time,omitempty"`
}

type ReportRegressionRequest

type ReportRegressionRequest struct {
	StartRevision       int32   `json:"start_revision"`
	EndRevision         int32   `json:"end_revision"`
	ProjectID           string  `json:"project_id"`
	TestPath            string  `json:"test_path"`
	IsImprovement       bool    `json:"is_improvement"`
	BotName             string  `json:"bot_name"`
	Internal            bool    `json:"internal_only"`
	MedianBeforeAnomaly float32 `json:"median_before_anomaly"`
	MedianAfterAnomaly  float32 `json:"median_after_anomaly"`
}

ReportRegressionRequest provides a struct for the data that is sent over to chromeperf when a regression is detected.

type ReportRegressionResponse

type ReportRegressionResponse struct {
	AnomalyId    string `json:"anomaly_id"`
	AlertGroupId string `json:"alert_group_id"`
}

ReportRegressionResponse provides a struct to hold the response data returned by the add anomalies api.

type RevisionInfo

type RevisionInfo struct {
	Master        string `json:"master"`
	Bot           string `json:"bot"`
	Benchmark     string `json:"benchmark"`
	StartRevision int    `json:"start_revision"`
	EndRevision   int    `json:"end_revision"`
	Test          string `json:"test"`
	IsImprovement bool   `json:"is_improvement"`
	BugId         string `json:"bug_id"`
	ExploreUrl    string `json:"explore_url"`
}

RevisionInfo defines struct to contain revision information

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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