model

package
v0.0.0-...-6abc620 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: Apache-2.0 Imports: 42 Imported by: 7

Documentation

Index

Constants

View Source
const (
	TestResultsSortByStartKey      = "start"
	TestResultsSortByDurationKey   = "duration"
	TestResultsSortByTestNameKey   = "test_name"
	TestResultsSortByStatusKey     = "status"
	TestResultsSortByBaseStatusKey = "base_status"
)
View Source
const (
	// BatchJobControllerCollection is the name of the DB collection
	// for batch job controller documents.
	BatchJobControllerCollection = "batch_job_controllers"
)
View Source
const DefaultVer = 2
View Source
const (

	// FailedTestsSampleSize is the maximum size for the failed test
	// results sample.
	FailedTestsSampleSize = 10
)

Variables

View Source
var (
	MigrationStatsMigratorIDKey  = bsonutil.MustHaveTag(MigrationStats{}, "MigratorID")
	MigrationStatsStartedAtKey   = bsonutil.MustHaveTag(MigrationStats{}, "StartedAt")
	MigrationStatsCompletedAtKey = bsonutil.MustHaveTag(MigrationStats{}, "CompletedAt")
	MigrationStatsVersionKey     = bsonutil.MustHaveTag(MigrationStats{}, "Version")
)

Functions

func CheckIndexes

func CheckIndexes(ctx context.Context, db *mongo.Database, indexes []SystemIndexes) error

CheckIndexes checks that all the given indexes are in the DB. It does not check specifically for any index options (e.g. unique indexes).

func ClearLoginCache

func ClearLoginCache(user gimlet.User, all bool) error

ClearLoginCache removes users' tokens from cache. Passing true will ignore the user passed and clear all users.

func DumpPerformanceSeries

func DumpPerformanceSeries(ctx context.Context, stream <-chan events.Performance, metadata interface{}, output io.Writer) error

DumpPerformanceSeries takes a stream of PerformancePoints, converts them to FTDC data and writes that data to the provided writer.

FTDC makes it complicated to stream data directly from the input channel to the writer, and indeed, this implementation will not start writing to the output stream until the input stream is exhausted, but future work should allow us to avoid that detail.

func FindAndDownloadTestResults

func FindAndDownloadTestResults(ctx context.Context, env cedar.Environment, taskOpts []TestResultsTaskOptions, filterOpts *TestResultsFilterAndSortOptions) (TestResultsStats, []TestResult, error)

FindAndDownloadTestResults fetches the TestResults records for the given tasks and returns the downloaded test results filtered, sorted, and paginated. The environment should not be nil.

func GenerateTestLog

func GenerateTestLog(ctx context.Context, bucket pail.Bucket, size, chunkSize int) ([]LogChunkInfo, []LogLine, error)

GenerateTestLog is a convenience function to generate random logs with 100 character long lines of the given size and chunk size in the given bucket.

func GetLoginCache

func GetLoginCache(token string) (gimlet.User, bool, error)

GetUserLoginCache retrieves cached users by token.

It returns an error if and only if there was an error retrieving the user from the cache.

It returns (<user>, true, nil) if the user is present in the cache and is valid.

It returns (<user>, false, nil) if the user is present in the cache but has expired.

It returns (nil, false, nil) if the user is not present in the cache.

func GetOrAddUser

func GetOrAddUser(user gimlet.User) (gimlet.User, error)

GetOrAddUser gets a user from persistent storage, or if the user does not exist, to create and save it.

func GetUser

func GetUser(id string) (gimlet.User, bool, error)

GetUser gets a user by ID from persistent storage, and returns whether the returned user's token is valid or not.

func MakeDBSender

func MakeDBSender(e cedar.Environment) (send.Sender, error)

func MarkPerformanceResultsAsAnalyzed

func MarkPerformanceResultsAsAnalyzed(ctx context.Context, env cedar.Environment, performanceResultId PerformanceResultSeriesID) error

MarkPerformanceResultsAsAnalyzed marks the most recent mainline performance results with the given series ID as analyzed with the current date timestamp.

func NewDBSender

func NewDBSender(e cedar.Environment, name string) (send.Sender, error)

func NewLogIteratorReader

func NewLogIteratorReader(ctx context.Context, it LogIterator, opts LogIteratorReaderOptions) io.Reader

NewLogIteratorReader returns an io.Reader that reads the log lines from the log iterator.

func PutLoginCache

func PutLoginCache(user gimlet.User) (string, error)

PutLoginCache generates, saves, and returns a new token; the user's TTL is updated.

Types

type ArtifactInfo

type ArtifactInfo struct {
	Type        PailType        `bson:"type"`
	Bucket      string          `bson:"bucket"`
	Prefix      string          `bson:"prefix"`
	Path        string          `bson:"path"`
	Format      FileDataFormat  `bson:"format"`
	Compression FileCompression `bson:"compression"`
	Schema      FileSchema      `bson:"schema"`
	Tags        []string        `bson:"tags,omitempty"`
	CreatedAt   time.Time       `bson:"created_at"`
}

ArtifactInfo is a type that describes an object in some kind of offline storage, and is the bridge between pail-backed offline-storage and the cedar-based metadata storage.

The schema field describes the format of the data (raw, collapsed, interval summarizations, etc.) while the format field describes the encoding of the file.

func (*ArtifactInfo) GetDownloadURL

func (a *ArtifactInfo) GetDownloadURL() string

GetDownloadURL returns the link to download an the given artifact.

type BatchJobController

type BatchJobController struct {
	ID         string        `bson:"_id"`
	Collection string        `bson:"collection,omitempty"`
	BatchSize  int           `bson:"batch_size"`
	Iterations int           `bson:"iterations,omitempty"`
	Timeout    time.Duration `bson:"timeout,omitempty"`
	Version    int           `bson:"version"`
}

BatchJobController represents a set of handles for controlling automatic batch jobs run in Cedar without requiring a deploy/restart of the application.

func FindBatchJobController

func FindBatchJobController(ctx context.Context, env cedar.Environment, id string) (*BatchJobController, error)

FindBatchJobController searches the DB for the BatchJobController with the given ID.

type BucketConfig

type BucketConfig struct {
	AWSKey                string   `bson:"aws_key" json:"aws_key" yaml:"aws_key"`
	AWSSecret             string   `bson:"aws_secret" json:"aws_secret" yaml:"aws_secret"`
	BuildLogsBucket       string   `bson:"build_logs_bucket" json:"build_logs_bucket" yaml:"build_logs_bucket"`
	TestResultsBucket     string   `bson:"test_results_bucket" json:"test_results_bucket" yaml:"test_results_bucket"`
	TestResultsBucketType PailType `bson:"test_results_bucket_type" json:"test_results_bucket_type" yaml:"test_results_bucket_type"`

	PrestoRoleARN           string `bson:"presto_role_arn" json:"presto_role_arn" yaml:"presto_role_arn"`
	PrestoBucket            string `bson:"presto_bucket" json:"presto_bucket" yaml:"presto_bucket"`
	PrestoTestResultsPrefix string `bson:"presto_test_results_prefix" json:"presto_test_results_prefix" yaml:"presto_test_results_prefix"`
}

Credentials and other configuration information for pail Bucket usage.

type CAConfig

type CAConfig struct {
	CertDepot         certdepot.BootstrapDepotConfig `bson:"certdepot" json:"certdepot" yaml:"certdepot"`
	SSLExpireAfter    time.Duration                  `bson:"ssl_expire" json:"ssl_expire" yaml:"ssl_expire"`
	SSLRenewalBefore  time.Duration                  `bson:"ssl_renewal" json:"ssl_renewal" yaml:"ssl_renewal"`
	ServerCertVersion int                            `bson:"server_cert_version"`
}

type CedarConfig

type CedarConfig struct {
	ID             string                    `bson:"_id" json:"id" yaml:"id"`
	URL            string                    `bson:"url" json:"url" yaml:"url"`
	Evergreen      EvergreenConfig           `bson:"evergreen" json:"evergreen" yaml:"evergreen"`
	Splunk         send.SplunkConnectionInfo `bson:"splunk" json:"splunk" yaml:"splunk"`
	LoggerConfig   LoggerParams              `bson:"logger_config" json:"logger_config" yaml:"logger_config"`
	Slack          SlackConfig               `bson:"slack" json:"slack" yaml:"slack"`
	LDAP           LDAPConfig                `bson:"ldap" json:"ldap" yaml:"ldap"`
	ServiceAuth    ServiceAuthConfig         `bson:"service_auth" json:"service_auth" yaml:"service_auth"`
	NaiveAuth      NaiveAuthConfig           `bson:"naive_auth" json:"naive_auth" yaml:"naive_auth"`
	CA             CAConfig                  `bson:"ca" json:"ca" yaml:"ca"`
	Bucket         BucketConfig              `bson:"bucket" json:"bucket" yaml:"bucket"`
	Flags          OperationalFlags          `bson:"flags" json:"flags" yaml:"flags"`
	Service        ServiceConfig             `bson:"service" json:"service" yaml:"service"`
	ChangeDetector ChangeDetectorConfig      `bson:"change_detector" json:"change_detector" yaml:"change_detector"`
	// contains filtered or unexported fields
}

func LoadCedarConfig

func LoadCedarConfig(file string) (*CedarConfig, error)

func NewCedarConfig

func NewCedarConfig(env cedar.Environment) *CedarConfig

func (*CedarConfig) Find

func (c *CedarConfig) Find() error

func (*CedarConfig) IsNil

func (c *CedarConfig) IsNil() bool

func (*CedarConfig) Save

func (c *CedarConfig) Save() error

func (*CedarConfig) Setup

func (c *CedarConfig) Setup(e cedar.Environment)

type ChangeDetectorConfig

type ChangeDetectorConfig struct {
	Implementation string `bson:"implementation" json:"implementation" yaml:"implementation"`
	URI            string `bson:"uri" json:"uri" yaml:"uri"`
	User           string `bson:"user" json:"user" yaml:"user"`
	Token          string `bson:"token" json:"token" yaml:"token"`
}

type Event

type Event struct {
	ID           string      `bson:"_id" json:"id"`
	Component    string      `bson:"com" json:"component"`
	Message      string      `bson:"m" json:"message"`
	Payload      interface{} `bson:"data" json:"payload"`
	MessageType  string      `bson:"mtype" json:"type"`
	Timestamp    time.Time   `bson:"ts" json:"time"`
	Level        string      `bson:"l" json:"level"`
	Acknowledged bool        `bson:"ack" json:"acknowledged"`
	// contains filtered or unexported fields
}

Event is a translation of

func NewEvent

func NewEvent(m message.Composer) *Event

func (*Event) Acknowledge

func (e *Event) Acknowledge() error

func (*Event) Find

func (e *Event) Find() error

func (*Event) IsNil

func (e *Event) IsNil() bool

func (*Event) Save

func (e *Event) Save() error

func (*Event) Setup

func (e *Event) Setup(env cedar.Environment)

type Events

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

func (*Events) Count

func (e *Events) Count() (int, error)

func (*Events) CountLevel

func (e *Events) CountLevel(level string) (int, error)

func (*Events) FindLevel

func (e *Events) FindLevel(level string, limit int) error

func (*Events) IsNil

func (e *Events) IsNil() bool

func (*Events) Setup

func (e *Events) Setup(env cedar.Environment)

func (*Events) Size

func (e *Events) Size() int

func (*Events) Slice

func (e *Events) Slice() []*Event

type EvergreenConfig

type EvergreenConfig struct {
	URL               string `bson:"url" json:"url" yaml:"url"`
	AuthTokenCookie   string `bson:"auth_token_cookie" json:"auth_token_cookie" yaml:"auth_token_cookie"`
	HeaderKeyName     string `bson:"header_key_name" json:"header_key_name" yaml:"header_key_name"`
	HeaderUserName    string `bson:"header_user_name" json:"header_user_name" yaml:"header_user_name"`
	Domain            string `bson:"domain" json:"domain" yaml:"domain"`
	ServiceUserName   string `bson:"service_user_name" json:"service_user_name" yaml:"service_user_name"`
	ServiceUserAPIKey string `bson:"service_user_api_key" json:"service_user_api_key" yaml:"service_user_api_key"`
}

type FileCompression

type FileCompression string
const (
	FileUncompressed FileCompression = "none"
	FileTarGz        FileCompression = "targz"
	FileZip          FileCompression = "zip"
	FileGz           FileCompression = "gz"
	FileXz           FileCompression = "xz"
)

func (FileCompression) Validate

func (fc FileCompression) Validate() error

type FileDataFormat

type FileDataFormat string
const (
	FileFTDC FileDataFormat = "ftdc"
	FileBSON FileDataFormat = "bson"
	FileJSON FileDataFormat = "json"
	FileCSV  FileDataFormat = "csv"
	FileText FileDataFormat = "text"
)

func (FileDataFormat) Validate

func (ff FileDataFormat) Validate() error

type FileSchema

type FileSchema string
const (
	SchemaRawEvents       FileSchema = "raw-events"
	SchemaCollapsedEvents FileSchema = "collapsed-events"
	SchemaIntervalSummary FileSchema = "interval-summarization"
	SchemaHistogram       FileSchema = "histogram"
)

func (FileSchema) Validate

func (fs FileSchema) Validate() error

type Iterator

type Iterator interface {
	// Next returns true if the iterator has not yet been exhausted or
	// closed, false otherwise.
	Next(context.Context) bool
	// Exhausted returns true if the iterator has not yet been exhausted,
	// regardless if it has been closed or not.
	Exhausted() bool
	// Err returns any errors that are captured by the iterator.
	Err() error
	// Close closes the iterator. This function should be called once the
	// iterator is no longer needed.
	Close() error
}

Iterator represents a cursor for generic iteration over a sequence of items.

type LDAPConfig

type LDAPConfig struct {
	URL          string `bson:"url" json:"url" yaml:"url"`
	Port         string `bson:"port" json:"port" yaml:"port"`
	UserPath     string `bson:"path" json:"path" yaml:"path"`
	ServicePath  string `bson:"service_path" json:"service_path" yaml:"service_path"`
	UserGroup    string `bson:"user_group" json:"user_group" yaml:"user_group"`
	ServiceGroup string `bson:"service_group" json:"service_group" yaml:"service_group"`
}

LDAPConfig contains settings for interacting with an LDAP server.

type Log

type Log struct {
	ID          string          `bson:"_id,omitempty"`
	Info        LogInfo         `bson:"info,omitempty"`
	CreatedAt   time.Time       `bson:"created_at"`
	CompletedAt time.Time       `bson:"completed_at"`
	Artifact    LogArtifactInfo `bson:"artifact"`
	// contains filtered or unexported fields
}

Log describes metadata for a buildlogger log.

func CreateLog

func CreateLog(info LogInfo, artifactStorageType PailType) *Log

CreateLog is the entry point for creating a buildlogger Log.

func (*Log) Append

func (l *Log) Append(ctx context.Context, lines []LogLine) error

Append uploads a chunk of log lines to the offline blob storage bucket configured for the log. The environment should not be nil.

func (*Log) Close

func (l *Log) Close(ctx context.Context, exitCode int) error

Close "closes out" the log by populating the completed_at and info.exit_code fields. The environment should not be nil.

func (*Log) Download

func (l *Log) Download(ctx context.Context, timeRange TimeRange) (LogIterator, error)

Download returns a LogIterator which iterates lines of the given log. The environment should not be nil.

func (*Log) Find

func (l *Log) Find(ctx context.Context) error

Find searches the DB for the log. The enviromemt should not be nil.

func (*Log) IsNil

func (l *Log) IsNil() bool

IsNil returns if the log is populated or not.

func (*Log) Remove

func (l *Log) Remove(ctx context.Context) error

Remove removes the log from the DB. The environment should not be nil.

func (*Log) SaveNew

func (l *Log) SaveNew(ctx context.Context) error

SaveNew saves a new log to the DB, if a log with the same ID already exists an error is returned. The log should be populated and the environment should not be nil.

func (*Log) Setup

func (l *Log) Setup(e cedar.Environment)

Setup sets the environment for the log. The environment is required for numerous functions on Log.

type LogArtifactInfo

type LogArtifactInfo struct {
	Type    PailType `bson:"type"`
	Prefix  string   `bson:"prefix"`
	Version int      `bson:"version"`
	// This field is part of the version 0 LogArtifactInfo model, we are
	// keeping it for backwards compatibility.
	Chunks []LogChunkInfo `bson:"chunks,omitempty"`
}

LogArtifact describes a bucket of logs stored in some kind of offline blob storage. It is the bridge between pail-backed offline log storage and the cedar-based log metadata storage. The prefix field indicates the name of the "sub-bucket". The top level bucket is accesible via the cedar.Environment interface.

type LogChunkInfo

type LogChunkInfo struct {
	Key      string    `bson:"key"`
	NumLines int       `bson:"num_lines"`
	Start    time.Time `bson:"start"`
	End      time.Time `bson:"end"`
}

LogChunkInfo describes a chunk of log lines stored in pail-backed offline storage.

type LogFindOptions

type LogFindOptions struct {
	TimeRange       TimeRange
	Info            LogInfo
	Group           string
	EmptyTestName   bool
	LatestExecution bool
	Limit           int64
}

LogFindOptions describes the search criteria for the Find function on Logs.

type LogFormat

type LogFormat string

LogFormat is a type that describes the format of a log.

const (
	LogFormatUnknown LogFormat = "unknown"
	LogFormatText    LogFormat = "text"
	LogFormatJSON    LogFormat = "json"
	LogFormatBSON    LogFormat = "bson"
)

Valid log formats.

func (LogFormat) Validate

func (lf LogFormat) Validate() error

Validate the log format.

type LogInfo

type LogInfo struct {
	Project     string            `bson:"project,omitempty"`
	Version     string            `bson:"version,omitempty"`
	Variant     string            `bson:"variant,omitempty"`
	TaskName    string            `bson:"task_name,omitempty"`
	TaskID      string            `bson:"task_id,omitempty"`
	Execution   int               `bson:"execution"`
	TestName    string            `bson:"test_name,omitempty"`
	Trial       int               `bson:"trial"`
	ProcessName string            `bson:"proc_name,omitempty"`
	Format      LogFormat         `bson:"format,omitempty"`
	Tags        []string          `bson:"tags,omitempty"`
	Arguments   map[string]string `bson:"args,omitempty"`
	ExitCode    int               `bson:"exit_code, omitempty"`
	Mainline    bool              `bson:"mainline"`
	Schema      int               `bson:"schema,omitempty"`
}

LogInfo describes information unique to a single buildlogger log.

func (*LogInfo) ID

func (id *LogInfo) ID() string

ID creates a unique hash for a buildlogger log.

type LogIterator

type LogIterator interface {
	Iterator
	// Item returns the current LogLine item held by the iterator.
	Item() LogLine
	// Reverse returns a reversed copy of the iterator.
	Reverse() LogIterator
	// IsReversed returns true if the iterator is in reverse order and
	// false otherwise.
	IsReversed() bool
}

LogIterator is an interface that enables iterating over lines of buildlogger logs.

func NewBatchedLogIterator

func NewBatchedLogIterator(bucket pail.Bucket, chunks []LogChunkInfo, batchSize int, timeRange TimeRange) LogIterator

NewBatchedLog returns a LogIterator that fetches batches (size set by the caller) of chunks from blob storage in parallel while iterating over lines of a buildlogger log.

func NewMergingIterator

func NewMergingIterator(iterators ...LogIterator) LogIterator

NewMergeIterator returns a LogIterator that merges N buildlogger logs, passed in as LogIterators, respecting the order of each line's timestamp.

func NewParallelizedLogIterator

func NewParallelizedLogIterator(bucket pail.Bucket, chunks []LogChunkInfo, timeRange TimeRange) LogIterator

NewParallelizedLogIterator returns a LogIterator that fetches all chunks from blob storage in parallel while iterating over lines of a buildlogger log.

func NewSerializedLogIterator

func NewSerializedLogIterator(bucket pail.Bucket, chunks []LogChunkInfo, timeRange TimeRange) LogIterator

NewSerializedLogIterator returns a LogIterator that serially fetches chunks from blob storage while iterating over lines of a buildlogger log.

type LogIteratorHeap

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

LogIteratorHeap is a heap of LogIterator items.

func (LogIteratorHeap) Len

func (h LogIteratorHeap) Len() int

Len returns the size of the heap.

func (LogIteratorHeap) Less

func (h LogIteratorHeap) Less(i, j int) bool

Less returns true if the object at index i is less than the object at index j in the heap, false otherwise, when min is true. When min is false, the opposite is returned.

func (*LogIteratorHeap) Pop

func (h *LogIteratorHeap) Pop() interface{}

Pop returns the next object (as an empty interface) from the heap. Note that if the heap is empty this will panic.

func (*LogIteratorHeap) Push

func (h *LogIteratorHeap) Push(x interface{})

Push appends a new object of type LogIterator to the heap. Note that if x is not a LogIterator nothing happens.

func (*LogIteratorHeap) SafePop

func (h *LogIteratorHeap) SafePop() LogIterator

SafePop is a wrapper function around heap.Pop that converts the returned interface into a LogIterator object before returning it.

func (*LogIteratorHeap) SafePush

func (h *LogIteratorHeap) SafePush(it LogIterator)

SafePush is a wrapper function around heap.Push that ensures, during compile time, that the correct type of object is put in the heap.

func (LogIteratorHeap) Swap

func (h LogIteratorHeap) Swap(i, j int)

Swap swaps the objects at indexes i and j.

type LogIteratorReaderOptions

type LogIteratorReaderOptions struct {
	// Limit limits the number of lines read from the log. If equal to 0,
	// lines will be read until the iterator is exhausted. If TailN is
	// greater than 0, Limit will be ignored.
	Limit int
	// TailN is the number of lines to read from the tail of the log. If
	// equal to 0, the reader returned will read log lines in normal order.
	TailN int
	// PrintTime, when true, prints the timestamp of each log line along
	// with the line in the following format:
	//		[2006/01/02 15:04:05.000] This is a log line.
	PrintTime bool
	// PrintPriority, when true, prints the priority of each log line along
	// with the line in the following format:
	//		[P: 30] This is a log line.
	// If PrintTime is also set to true, priority will be printed first:
	//		[P:100] [2006/01/02 15:04:05.000] This is a log line.
	PrintPriority bool
	// SoftSizeLimit assists with pagination of long logs. When set the
	// reader will attempt to read as close to the limit as possible while
	// also reading every line for each timestamp reached. If TailN is set,
	// this will be ignored.
	SoftSizeLimit int
}

LogIteratorReaderOptions describes the options for creating a LogIteratorReader.

type LogLine

type LogLine struct {
	Priority  level.Priority
	Timestamp time.Time
	Data      string
}

LogLine describes a buildlogger log line. This is an intermediary type that passes data from RPC calls to the upload phase and is used as the return item for the LogIterator.

type LogMetrics

type LogMetrics struct {
	NumberLines       int            `bson:"lines"`
	UniqueLetters     int            `bson:"letters"`
	LetterFrequencies map[string]int `bson:"frequencies"`
}

type LogRecord

type LogRecord struct {
	LogID       string `bson:"_id"`
	URL         string `bson:"url"`
	LastSegment int    `bson:"seg"`
	Bucket      string `bson:"bucket"`
	KeyName     string `bson:"key"`
	Metadata    `bson:"metadata"`
	// contains filtered or unexported fields
}

func (*LogRecord) Find

func (l *LogRecord) Find() error

func (*LogRecord) IsNil

func (l *LogRecord) IsNil() bool

func (*LogRecord) Save

func (l *LogRecord) Save() error

func (*LogRecord) Setup

func (l *LogRecord) Setup(e cedar.Environment)

type LogSegment

type LogSegment struct {
	// common log information
	ID      string `bson:"_id"`
	LogID   string `bson:"log_id"`
	URL     string `bson:"url"`
	Segment int    `bson:"seg"`
	Bucket  string `bson:"bucket"`
	KeyName string `bson:"key"`

	// parsed out information
	Metrics LogMetrics `bson:"metrics"`

	Metadata `bson:"metadata"`
	// contains filtered or unexported fields
}

func (*LogSegment) Find

func (l *LogSegment) Find(logID string, segment int) error

func (*LogSegment) Insert

func (l *LogSegment) Insert() error

func (*LogSegment) IsNil

func (l *LogSegment) IsNil() bool

func (*LogSegment) Remove

func (l *LogSegment) Remove() error

func (*LogSegment) Save

func (l *LogSegment) Save() error

func (*LogSegment) Setup

func (l *LogSegment) Setup(e cedar.Environment)

type LogSegments

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

func (*LogSegments) Find

func (l *LogSegments) Find(logID string, sorted bool) error

func (*LogSegments) IsNil

func (l *LogSegments) IsNil() bool

func (*LogSegments) Setup

func (l *LogSegments) Setup(e cedar.Environment)

func (*LogSegments) Size

func (l *LogSegments) Size() int

func (*LogSegments) Slice

func (l *LogSegments) Slice() []LogSegment

type LoggerParams

type LoggerParams struct {
	BufferCount          int           `bson:"buffer_count" json:"buffer_count" yaml:"buffer_count"`
	BufferDuration       time.Duration `bson:"buffer_duration" json:"buffer_duration" yaml:"buffer_duration"`
	IncomingBufferFactor int           `bson:"incoming_buffer_factor" json:"incoming_buffer_factor" yaml:"incoming_buffer_factor"`
	UseAsync             bool          `bson:"use_async" json:"use_async" yaml:"use_async"`
}

type LoginCache

type LoginCache struct {
	Token string    `bson:"token"`
	TTL   time.Time `bson:"ttl"`
}

type Logs

type Logs struct {
	Logs []Log `bson:"results"`
	// contains filtered or unexported fields
}

Logs describes a set of buildlogger logs, typically related by some criteria.

func (*Logs) Find

func (l *Logs) Find(ctx context.Context, opts LogFindOptions) error

Find returns the logs matching the given search criteria. The environment should not be nil.

func (*Logs) IsNil

func (l *Logs) IsNil() bool

IsNil returns if the logs are populated or not.

func (*Logs) Merge

func (l *Logs) Merge(ctx context.Context) (LogIterator, error)

Merge merges the buildlogger logs, respecting the order of each line's timestamp. The logs should be populated and the environment should not be nil. When reverse is true, the log lines are returned in reverse order.

func (*Logs) Setup

func (l *Logs) Setup(e cedar.Environment)

Setup sets the environment for the logs. The environment is required for numerous methods on Logs.

type Metadata

type Metadata struct {
	ModificationCount int            `bson:"nmod"`
	Version           int            `bson:"sver"`
	Units             map[string]int `bson:"units"`
}

Metadata sub-documents are embedded in models to provide modification counters to ensure that updates don't overwrite interleaved changes to documents.

func (*Metadata) Handle

func (m *Metadata) Handle(err error) error

func (*Metadata) IsolatedUpdateQuery

func (m *Metadata) IsolatedUpdateQuery(metaDataKey string, id interface{}) map[string]interface{}

type MetricType

type MetricType string
const (
	MetricTypeMean         MetricType = "mean"
	MetricTypeMedian       MetricType = "median"
	MetricTypeMax          MetricType = "max"
	MetricTypeMin          MetricType = "min"
	MetricTypeSum          MetricType = "sum"
	MetricTypeStdDev       MetricType = "standard-deviation"
	MetricTypePercentile99 MetricType = "percentile-99th"
	MetricTypePercentile90 MetricType = "percentile-90th"
	MetricTypePercentile95 MetricType = "percentile-95th"
	MetricTypePercentile80 MetricType = "percentile-80th"
	MetricTypePercentile50 MetricType = "percentile-50th"
	MetricTypeThroughput   MetricType = "throughput"
	MetricTypeLatency      MetricType = "latency"
)

func (MetricType) Validate

func (t MetricType) Validate() error

type MigrationStats

type MigrationStats struct {
	MigratorID  string     `bson:"migrator_id"`
	StartedAt   *time.Time `bson:"started_at"`
	CompletedAt *time.Time `bson:"completed_at"`
	Version     int        `bson:"version"`
}

MigrationStats represents statistics for batched migration jobs. It typically should be used as a temporary sub-document within the relevant documents in question.

type NaiveAuthConfig

type NaiveAuthConfig struct {
	AppAuth bool              `bson:"app_auth" json:"app_auth" yaml:"app_auth"`
	Users   []NaiveUserConfig `bson:"users" json:"users" yaml:"users"`
}

type NaiveUserConfig

type NaiveUserConfig struct {
	ID           string   `bson:"_id" json:"id" yaml:"id"`
	Name         string   `bson:"name" json:"name" yaml:"name"`
	EmailAddress string   `bson:"email" json:"email" yaml:"email"`
	Password     string   `bson:"password" json:"password" yaml:"password"`
	Key          string   `bson:"key" json:"key" yaml:"key"`
	AccessRoles  []string `bson:"roles" json:"roles" yaml:"roles"`
	Invalid      bool     `bson:"invalid" json:"invalid" yaml:"invalid"`
}

type OperationalFlags

type OperationalFlags struct {
	DisableInternalMetricsReporting bool `bson:"disable_internal_metrics_reporting" json:"disable_internal_metrics_reporting" yaml:"disable_internal_metrics_reporting"`
	DisableSignalProcessing         bool `bson:"disable_signal_processing" json:"disable_signal_processing" yaml:"disable_signal_processing"`
	// contains filtered or unexported fields
}

func (*OperationalFlags) SetDisableInternalMetricsReporting

func (f *OperationalFlags) SetDisableInternalMetricsReporting(v bool) error

func (*OperationalFlags) SetDisableSignalProcessing

func (f *OperationalFlags) SetDisableSignalProcessing(v bool) error

func (*OperationalFlags) SetFalse

func (f *OperationalFlags) SetFalse(name string) error

func (*OperationalFlags) SetTrue

func (f *OperationalFlags) SetTrue(name string) error

type PailType

type PailType string

PailType describes the name of the blob storage backing a pail Bucket implementation.

const (
	PailS3    PailType = "s3"
	PailLocal PailType = "local"
)

func (PailType) Create

func (t PailType) Create(ctx context.Context, env cedar.Environment, bucket, prefix, permissions string, compress bool) (pail.Bucket, error)

Create returns a Pail Bucket backed by PailType.

func (PailType) CreatePresto

func (t PailType) CreatePresto(ctx context.Context, env cedar.Environment, prefix, permissions string, compress bool) (pail.Bucket, error)

CreatePresto returns a Pail Bucket backed by PailType specifically for buckets in our Presto ecosystem.

func (PailType) GetDownloadURL

func (t PailType) GetDownloadURL(bucket, prefix, key string) string

GetDownloadURL returns, if applicable, the download URL for the object at the given bucket/prefix/key location.

type ParquetTestResult

type ParquetTestResult struct {
	TestName        string       `parquet:"name=test_name"`
	DisplayTestName *string      `parquet:"name=display_test_name"`
	GroupID         *string      `parquet:"name=group_id"`
	Trial           int32        `parquet:"name=trial"`
	Status          string       `parquet:"name=status"`
	LogInfo         *TestLogInfo `parquet:"name=log_info"`
	TaskCreateTime  time.Time    `parquet:"name=task_create_time, timeunit=MILLIS"`
	TestStartTime   time.Time    `parquet:"name=test_start_time, timeunit=MILLIS"`
	TestEndTime     time.Time    `parquet:"name=test_end_time, timeunit=MILLIS"`

	// Legacy test log fields.
	LogTestName *string `parquet:"name=log_test_name"`
	LogURL      *string `parquet:"name=log_url"`
	RawLogURL   *string `parquet:"name=raw_log_url"`
	LineNum     *int32  `parquet:"name=line_num"`
}

ParquetTestResult describes a single test result to be stored in Apache Parquet file format.

type ParquetTestResults

type ParquetTestResults struct {
	Version         string              `parquet:"name=version"`
	Variant         string              `parquet:"name=variant"`
	TaskName        string              `parquet:"name=task_name"`
	DisplayTaskName *string             `parquet:"name=display_task_name"`
	TaskID          string              `parquet:"name=task_id"`
	DisplayTaskID   *string             `parquet:"name=display_task_id"`
	Execution       int32               `parquet:"name=execution"`
	RequestType     string              `parquet:"name=request_type"`
	CreatedAt       time.Time           `parquet:"name=created_at, timeunit=MILLIS"`
	Results         []ParquetTestResult `parquet:"name=results"`
}

ParquetTestResults describes a set of test results from a task execution to be stored in Apache Parquet format.

type PerfAnalysis

type PerfAnalysis struct {
	ProcessedAt time.Time `bson:"processed_at" json:"processed_at" yaml:"processed_at"`
}

PerfAnalysis contains information about when the associated performance result was analyzed for change points.

type PerfFindOptions

type PerfFindOptions struct {
	Interval    TimeRange
	Info        PerformanceResultInfo
	MaxDepth    int
	GraphLookup bool
	Limit       int
	Skip        int
	Sort        []string
}

PerfFindOptions describe the search criteria for the Find function on PerformanceResults.

type PerfRollupValue

type PerfRollupValue struct {
	Name          string      `bson:"name"`
	Value         interface{} `bson:"val"`
	Version       int         `bson:"version"`
	MetricType    MetricType  `bson:"type"`
	UserSubmitted bool        `bson:"user"`
}

PerfRollupValue describes a single "rollup", see PerfRollups for more information.

type PerfRollups

type PerfRollups struct {
	Stats       []PerfRollupValue `bson:"stats"`
	ProcessedAt time.Time         `bson:"processed_at"`
	// contains filtered or unexported fields
}

PerfRollups describes the "rolled up", or calculated metrics from time series data collected in a given performance test, of a performance result.

func (*PerfRollups) Add

func (r *PerfRollups) Add(ctx context.Context, rollup PerfRollupValue) error

Add attempts to append a rollup to an existing set of rollups in a performance result.

func (*PerfRollups) GetFloat

func (r *PerfRollups) GetFloat(name string) (float64, error)

func (*PerfRollups) GetInt

func (r *PerfRollups) GetInt(name string) (int, error)

func (*PerfRollups) GetInt32

func (r *PerfRollups) GetInt32(name string) (int32, error)

func (*PerfRollups) GetInt64

func (r *PerfRollups) GetInt64(name string) (int64, error)

func (*PerfRollups) Map

func (r *PerfRollups) Map() map[string]int64

func (*PerfRollups) MapFloat

func (r *PerfRollups) MapFloat() map[string]float64

func (*PerfRollups) Setup

func (r *PerfRollups) Setup(env cedar.Environment)

type PerformanceArguments

type PerformanceArguments map[string]int32

PerformanceArguments wraps map[string]int32 and implements the bson.ValueMarshler interface in order to have a unified ordering of keys. BSON objects are only equal if the key/value pairs match AND are in the same order. Since maps are not ordered but still marshalled into BSON objects, marshalling two equal Go maps into BSON can result in two BSON objects that are not equal. By implementing the bson.ValueMarshaler interface, we are able to first sort the keys of the map and convert the key/value pairs into a bson.D object, where ordered is preserved.

See: `https://docs.mongodb.com/manual/reference/bson-type-comparison-order/#objects` for more information.

func (PerformanceArguments) MarshalBSONValue

func (args PerformanceArguments) MarshalBSONValue() (bsontype.Type, []byte, error)

func (PerformanceArguments) String

func (args PerformanceArguments) String() string

type PerformanceResult

type PerformanceResult struct {
	ID          string                `bson:"_id,omitempty"`
	Info        PerformanceResultInfo `bson:"info,omitempty"`
	CreatedAt   time.Time             `bson:"created_at"`
	CompletedAt time.Time             `bson:"completed_at"`
	Version     int                   `bson:"version,omitempty"`

	// The source timeseries data is stored in a remote location,
	// we'll probably need to store an identifier so we know which
	// service to use to access that data. We'd then summarize
	// that data and store it in the document.
	//
	// The structure has a both a schema to describe the layout
	// the data (e.g. raw, results,) format (e.g. bson/ftdc/json),
	// and tags to describe the source (e.g. user submitted,
	// generated.)
	Artifacts            []ArtifactInfo `bson:"artifacts"`
	FailedRollupAttempts int            `bson:"failed_rollup_attempts"`

	Rollups  PerfRollups  `bson:"rollups"`
	Analysis PerfAnalysis `bson:"analysis"`
	// contains filtered or unexported fields
}

PerformanceResult describes a single result of a performance test from Evergreen.

func CreatePerformanceResult

func CreatePerformanceResult(info PerformanceResultInfo, source []ArtifactInfo, rollups []PerfRollupValue) *PerformanceResult

CreatePerformanceResult is the entry point for creating a performance result.

func (*PerformanceResult) AppendArtifacts

func (result *PerformanceResult) AppendArtifacts(ctx context.Context, artifacts []ArtifactInfo) error

AppendArtifacts appends new artifacts to an existing performance result. The environment should not be nil.

func (*PerformanceResult) Close

func (result *PerformanceResult) Close(ctx context.Context, completedAt time.Time) error

Close "closes out" the performance result by populating the completed_at field. The envirnment should not be nil.

func (PerformanceResult) CreateUnanalyzedSeries

func (result PerformanceResult) CreateUnanalyzedSeries() UnanalyzedPerformanceSeries

CreateUnanalyzedSeries converts the PerformanceResult into an UnanalyzedPerformanceSeries for communication with the signal processing service.

func (*PerformanceResult) Find

func (result *PerformanceResult) Find(ctx context.Context) error

Find searches the DB for the performance result. The environment should not be nil.

func (*PerformanceResult) IncFailedRollupAttempts

func (result *PerformanceResult) IncFailedRollupAttempts(ctx context.Context) error

IncFailedRollupAttempts increments the failed_rollup_attempts field by 1. The environment should not be nil.

func (*PerformanceResult) IsNil

func (result *PerformanceResult) IsNil() bool

IsNil returns if the performance result is populated or not.

func (*PerformanceResult) MergeRollups

func (r *PerformanceResult) MergeRollups(ctx context.Context, rollups []PerfRollupValue) error

MergeRollups merges rollups to existing rollups in a performance result. The environment should not be nil.

func (*PerformanceResult) Remove

func (result *PerformanceResult) Remove(ctx context.Context) (int, error)

Remove removes the performance result from the DB. The environment should not be nil.

func (*PerformanceResult) SaveNew

func (result *PerformanceResult) SaveNew(ctx context.Context) error

SaveNew saves a new performance result to the DB, if a result with the same ID already exists an error is returned. The result should be populated and the environment should not be nil.

func (*PerformanceResult) Setup

func (result *PerformanceResult) Setup(e cedar.Environment)

Setup sets the environment for the performance result. The environment is required for numerous functions on PerformanceResult.

type PerformanceResultInfo

type PerformanceResultInfo struct {
	Project   string               `bson:"project,omitempty"`
	Version   string               `bson:"version,omitempty"`
	Variant   string               `bson:"variant,omitempty"`
	Order     int                  `bson:"order,omitempty"`
	TaskName  string               `bson:"task_name,omitempty"`
	TaskID    string               `bson:"task_id,omitempty"`
	Execution int                  `bson:"execution"`
	TestName  string               `bson:"test_name,omitempty"`
	Trial     int                  `bson:"trial"`
	Parent    string               `bson:"parent,omitempty"`
	Tags      []string             `bson:"tags,omitempty"`
	Arguments PerformanceArguments `bson:"args,omitempty"`
	Mainline  bool                 `bson:"mainline"`
	Schema    int                  `bson:"schema,omitempty"`
}

PerformanceResultInfo describes information unique to a single performance result.

func (*PerformanceResultInfo) ID

func (id *PerformanceResultInfo) ID() string

ID creates a unique hash for a performance result.

type PerformanceResultSeriesID

type PerformanceResultSeriesID struct {
	Project     string               `bson:"project"`
	Variant     string               `bson:"variant"`
	Task        string               `bson:"task"`
	Test        string               `bson:"test"`
	Measurement string               `bson:"measurement"`
	Arguments   PerformanceArguments `bson:"args"`
}

PerformanceResultSeriesID represents the set of fields used identify a series of performance results for change point detection.

func (PerformanceResultSeriesID) String

func (p PerformanceResultSeriesID) String() string

String creates a string representation of a performance result series ID.

type PerformanceResults

type PerformanceResults struct {
	Results []PerformanceResult `bson:"results"`
	// contains filtered or unexported fields
}

PerformanceResults describes a set of performance results, typically related by some criteria.

func (*PerformanceResults) Find

Find returns the performance results that are started/completed and matching the given criteria.

func (*PerformanceResults) FindOutdatedRollups

func (r *PerformanceResults) FindOutdatedRollups(ctx context.Context, name string, version int, after time.Time, failureLimit int) error

FindOutdatedRollups returns performance results with missing or outdated rollup information for the given `name` and `version`.

func (*PerformanceResults) IsNil

func (r *PerformanceResults) IsNil() bool

IsNil returns if the performance results are populated or not.

func (*PerformanceResults) Setup

func (r *PerformanceResults) Setup(e cedar.Environment)

Setup sets the environment for the performance results. The environment is required for numerous functions on PerformanceResults.

type ServiceAuthConfig

type ServiceAuthConfig struct {
	Enabled bool `bson:"enabled" json:"enabled" yaml:"enabled"`
}

type ServiceConfig

type ServiceConfig struct {
	AppServers  []string `bson:"app_servers" json:"app_servers" yaml:"app_servers"`
	CORSOrigins []string `bson:"cors_origins" json:"cors_origins" yaml:"cors_origins"`
}

type SlackConfig

type SlackConfig struct {
	Options *send.SlackOptions `bson:"options" json:"options" yaml:"options"`
	Token   string             `bson:"token" json:"token" yaml:"token"`
	Level   string             `bson:"level" json:"level" yaml:"level"`
}

type SystemIndexes

type SystemIndexes struct {
	Keys       bson.D
	Options    bson.D
	Collection string
}

SystemIndexes holds the keys, options and the collection for an index. See https://docs.mongodb.com/manual/reference/method/db.collection.createIndex for more info.

func GetRequiredIndexes

func GetRequiredIndexes() []SystemIndexes

GetRequiredIndexes returns required indexes for the Cedar DB. IMPORTANT: this should be updated whenever an index is created.

type SystemInformationRecord

type SystemInformationRecord struct {
	ID        string             `bson:"_id" json:"id"`
	Timestamp time.Time          `bson:"ts" json:"time"`
	Data      message.SystemInfo `bson:"sysinfo" json:"sysinfo"`
	Hostname  string             `bson:"hn" json:"hostname"`
	// contains filtered or unexported fields
}

func (*SystemInformationRecord) Find

func (i *SystemInformationRecord) Find() error

func (*SystemInformationRecord) IsNil

func (i *SystemInformationRecord) IsNil() bool

func (*SystemInformationRecord) Save

func (i *SystemInformationRecord) Save() error

func (*SystemInformationRecord) Setup

type SystemInformationRecords

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

func (*SystemInformationRecords) CountBetween

func (i *SystemInformationRecords) CountBetween(before, after time.Time) (int, error)

func (*SystemInformationRecords) CountHostname

func (i *SystemInformationRecords) CountHostname(host string) (int, error)

func (*SystemInformationRecords) FindBetween

func (i *SystemInformationRecords) FindBetween(before, after time.Time, limit int) error

func (*SystemInformationRecords) FindHostname

func (i *SystemInformationRecords) FindHostname(host string, limit int) error

func (*SystemInformationRecords) FindHostnameBetween

func (i *SystemInformationRecords) FindHostnameBetween(host string, before, after time.Time, limit int) error

func (*SystemInformationRecords) IsNil

func (i *SystemInformationRecords) IsNil() bool

func (*SystemInformationRecords) Setup

func (*SystemInformationRecords) Size

func (i *SystemInformationRecords) Size() int

func (*SystemInformationRecords) Slice

type TestLogInfo

type TestLogInfo struct {
	LogName       string    `parquet:"name=log_name" bson:"log_name"`
	LogsToMerge   []*string `parquet:"name=logs_to_merge" bson:"logs_to_merge,omitempty"`
	LineNum       int32     `parquet:"name=line_num" bson:"line_num"`
	RenderingType *string   `parquet:"name=rendering_type" bson:"rendering_type,omitempty"`
	Version       int32     `parquet:"name=version" bson:"version"`
}

TestLogInfo describes a metadata for a test result's log stored using Evergreen logging.

type TestResult

type TestResult struct {
	TaskID          string       `bson:"task_id"`
	Execution       int          `bson:"execution"`
	TestName        string       `bson:"test_name"`
	DisplayTestName string       `bson:"display_test_name,omitempty"`
	GroupID         string       `bson:"group_id,omitempty"`
	Trial           int          `bson:"trial"`
	Status          string       `bson:"status"`
	BaseStatus      string       `bson:"-"`
	LogInfo         *TestLogInfo `bson:"log_info,omitempty"`
	TaskCreateTime  time.Time    `bson:"task_create_time"`
	TestStartTime   time.Time    `bson:"test_start_time"`
	TestEndTime     time.Time    `bson:"test_end_time"`

	// Legacy test log fields.
	LogTestName string `bson:"log_test_name,omitempty"`
	LogURL      string `bson:"log_url,omitempty"`
	RawLogURL   string `bson:"raw_log_url,omitempty"`
	LineNum     int    `bson:"line_num"`
}

TestResult describes a single test result to be stored as a BSON object in some type of Pail bucket storage.

func (TestResult) GetDisplayName

func (t TestResult) GetDisplayName() string

GetDisplayName returns the human-readable name of the test.

type TestResults

type TestResults struct {
	ID          string                  `bson:"_id,omitempty"`
	Info        TestResultsInfo         `bson:"info"`
	CreatedAt   time.Time               `bson:"created_at"`
	CompletedAt time.Time               `bson:"completed_at"`
	Artifact    TestResultsArtifactInfo `bson:"artifact"`
	Stats       TestResultsStats        `bson:"stats"`
	// FailedTestsSample is the first X failing tests of the test results.
	// This is an optimization for Evergreen's UI features that display a
	// limited number of failing tests for a task.
	FailedTestsSample []string `bson:"failed_tests_sample"`
	// contains filtered or unexported fields
}

TestResults describes metadata for a task execution and its test results.

func CreateTestResults

func CreateTestResults(info TestResultsInfo, artifactStorageType PailType) *TestResults

CreateTestResults is an entry point for creating a new TestResults record.

func FindTestResults

func FindTestResults(ctx context.Context, env cedar.Environment, opts []TestResultsTaskOptions) ([]TestResults, error)

FindTestResults returns the TestResults records for the given tasks. The environment should not be nil.

func (*TestResults) Append

func (t *TestResults) Append(ctx context.Context, results []TestResult) error

Append uploads test results to the offline blob storage bucket configured for the task execution. The TestResults record should be populated and the environment should not be nil.

func (*TestResults) Close

func (t *TestResults) Close(ctx context.Context) error

Close "closes out" by populating the completed_at field. The environment should not be nil.

func (*TestResults) Download

func (t *TestResults) Download(ctx context.Context) ([]TestResult, error)

Download returns a TestResult slice with the corresponding results stored in the offline blob storage. The TestResults record should be populated and the environment should not be nil.

func (*TestResults) Find

func (t *TestResults) Find(ctx context.Context) error

Find searches the DB for the TestResults record. The environment should not be nil.

func (*TestResults) GetBucket

func (t *TestResults) GetBucket(ctx context.Context) (pail.Bucket, error)

GetBucket returns a bucket of all test results specified by the TestResults record it's called on. The environment should not be nil.

func (*TestResults) GetPrestoBucket

func (t *TestResults) GetPrestoBucket(ctx context.Context) (pail.Bucket, error)

GetPrestoBucket returns an S3 bucket of all test results specified by the TestResults record it's called on to be used with Presto. The environment should not be nil.

func (*TestResults) IsNil

func (t *TestResults) IsNil() bool

IsNil returns if the TestResults record is populated or not.

func (*TestResults) PrestoPartitionKey

func (t *TestResults) PrestoPartitionKey() string

PrestoPartitionKey returns the partition key for the S3 bucket in Presto.

func (*TestResults) Remove

func (t *TestResults) Remove(ctx context.Context) error

Remove removes the TestResults record from the DB. The environment should not be nil.

func (*TestResults) SaveNew

func (t *TestResults) SaveNew(ctx context.Context) error

SaveNew saves a new TestResults record to the DB, if a document with the same ID already exists an error is returned. The TestResults record should be populated and the environment should not be nil.

func (*TestResults) Setup

func (t *TestResults) Setup(e cedar.Environment)

Setup sets the environment. The environment is required for numerous functions on TestResults.

type TestResultsArtifactInfo

type TestResultsArtifactInfo struct {
	Type    PailType `bson:"type"`
	Prefix  string   `bson:"prefix"`
	Version int      `bson:"version"`
}

TestResultsArtifactInfo describes a bucket of test results for a given task execution stored in some kind of offline storage. It is the bridge between pail-backed offline test results storage and the cedar-based test results metadata storage. The prefix field indicates the name of the "sub-bucket". The top level bucket is accesible via the cedar.Environment interface.

type TestResultsFilterAndSortOptions

type TestResultsFilterAndSortOptions struct {
	TestName            string
	ExcludeDisplayNames bool
	Statuses            []string
	GroupID             string
	Sort                []TestResultsSortBy
	Limit               int
	Page                int
	BaseTasks           []TestResultsTaskOptions
	// contains filtered or unexported fields
}

TestResultsFilterAndSortOptions allow for filtering, sorting, and paginating a set of test results.

func (*TestResultsFilterAndSortOptions) Validate

func (o *TestResultsFilterAndSortOptions) Validate() error

type TestResultsInfo

type TestResultsInfo struct {
	Project         string `bson:"project"`
	Version         string `bson:"version"`
	Variant         string `bson:"variant"`
	TaskName        string `bson:"task_name"`
	DisplayTaskName string `bson:"display_task_name,omitempty"`
	TaskID          string `bson:"task_id"`
	DisplayTaskID   string `bson:"display_task_id,omitempty"`
	Execution       int    `bson:"execution"`
	RequestType     string `bson:"request_type"`
	Mainline        bool   `bson:"mainline"`
	Schema          int    `bson:"schema"`
}

TestResultsInfo describes information unique to a single task execution.

func (*TestResultsInfo) ID

func (id *TestResultsInfo) ID() string

ID creates a unique hash for a TestResults record.

type TestResultsIterator

type TestResultsIterator interface {
	Iterator
	// Item returns the current TestResult item held by the iterator.
	Item() TestResult
}

TestResultsIterator is an interface that enables iterating over test results.

func NewMultiTestResultsIterator

func NewMultiTestResultsIterator(its ...TestResultsIterator) TestResultsIterator

NewMultiTestResultsIterator returns a TestResultsIterator that iterates over over multiple TestResultsIterators.

func NewTestResultsIterator

func NewTestResultsIterator(bucket pail.Bucket) TestResultsIterator

NewTestResultsIterator returns a TestResultsIterator.

type TestResultsSample

type TestResultsSample struct {
	TaskID                  string
	Execution               int
	MatchingFailedTestNames []string
	TotalFailedTestNames    int
}

TestResultsSample contains test names culled from a test result's FailedTestsSample.

func FindFailedTestResultsSamples

func FindFailedTestResultsSamples(ctx context.Context, env cedar.Environment, taskOpts []TestResultsTaskOptions, regexFilters []string) ([]TestResultsSample, error)

FindFailedTestResultsSamples fetches the TestResults records for the given tasks and returns the filtered failed samples for each task. The environment should not be nil.

type TestResultsSortBy

type TestResultsSortBy struct {
	Key      string
	OrderDSC bool
}

TestResultsSortBy describes the properties by which to sort a set of test results.

type TestResultsStats

type TestResultsStats struct {
	TotalCount    int  `bson:"total_count"`
	FailedCount   int  `bson:"failed_count"`
	FilteredCount *int `bson:"-"`
}

TestResultsStats describes basic stats of the test results.

func FindTestResultsStats

func FindTestResultsStats(ctx context.Context, env cedar.Environment, opts []TestResultsTaskOptions) (TestResultsStats, error)

FindTestResultsStats fetches basic aggregated stats of the test results for the given tasks. The environment should not be nil.

type TestResultsTaskOptions

type TestResultsTaskOptions struct {
	TaskID    string
	Execution int
}

TestResultsTaskOptions specify the criteria for querying test results by task.

type TimeRange

type TimeRange struct {
	StartAt time.Time `bson:"start" json:"start" yaml:"start"`
	EndAt   time.Time `bson:"end" json:"end" yaml:"end"`
}

func GetTimeRange

func GetTimeRange(startAt time.Time, duration time.Duration) TimeRange

GetTimeRange builds a time range structure. If startAt is the zero time, then end defaults to the current time and the start time is determined by the duration. Otherwise the end time is determined using the duration.

func (TimeRange) Check

func (t TimeRange) Check(ts time.Time) bool

Check returns true if the given time is within the TimeRange (inclusive) and false otherwise.

func (TimeRange) Duration

func (t TimeRange) Duration() time.Duration

func (TimeRange) IsValid

func (t TimeRange) IsValid() bool

func (TimeRange) IsZero

func (t TimeRange) IsZero() bool

type UnanalyzedPerformanceSeries

type UnanalyzedPerformanceSeries struct {
	Project      string               `bson:"project"`
	Variant      string               `bson:"variant"`
	Task         string               `bson:"task"`
	Test         string               `bson:"test"`
	Measurements []string             `bson:"measurements"`
	Arguments    PerformanceArguments `bson:"args"`
}

UnanalyzedPerformanceSeries represents a set of series with the same project/variant/task/test/args combination and varying measurements that need to be analyzed by the signal processing service.

func GetAllPerformanceResultSeriesIDs

func GetAllPerformanceResultSeriesIDs(ctx context.Context, env cedar.Environment) ([]UnanalyzedPerformanceSeries, error)

GetAllPerformanceResultSeriesIDs finds all performance result series in the DB.

func GetUnanalyzedPerformanceSeries

func GetUnanalyzedPerformanceSeries(ctx context.Context, env cedar.Environment) ([]UnanalyzedPerformanceSeries, error)

GetUnanalyzedPerformanceSeries queries the DB and gets all the most recent mainline performance series that contain results that have not yet been analyzed.

func (UnanalyzedPerformanceSeries) CreateBaseSeriesID

CreateBaseSeriesID returns a PerformanceSeriesID without a measurement.

func (UnanalyzedPerformanceSeries) CreateSeriesIDs

CreateSeriesIDs unwinds the Measurements slice to create an individual PerformanceResultSeriesID for each measurement.

type User

type User struct {
	ID           string     `bson:"_id"`
	Display      string     `bson:"display_name"`
	EmailAddress string     `bson:"email"`
	CreatedAt    time.Time  `bson:"created_at"`
	APIKey       string     `bson:"apikey"`
	SystemRoles  []string   `bson:"roles,omitempty"`
	LoginCache   LoginCache `bson:"login_cache,omitempty"`
	// contains filtered or unexported fields
}

Stores user information in database, resulting in a cache for the user manager.

func (*User) CreateAPIKey

func (u *User) CreateAPIKey() (string, error)

func (*User) DisplayName

func (u *User) DisplayName() string

func (*User) Email

func (u *User) Email() string

func (*User) Find

func (u *User) Find() error

func (*User) GetAPIKey

func (u *User) GetAPIKey() string

func (*User) GetAccessToken

func (u *User) GetAccessToken() string

func (*User) GetRefreshToken

func (u *User) GetRefreshToken() string

func (*User) HasPermission

func (u *User) HasPermission(_ gimlet.PermissionOpts) bool

func (*User) IsNil

func (u *User) IsNil() bool

func (*User) Roles

func (u *User) Roles() []string

func (*User) Save

func (u *User) Save() error

func (*User) Setup

func (u *User) Setup(env cedar.Environment)

func (*User) UpdateLoginCache

func (u *User) UpdateLoginCache() (string, error)

func (*User) Username

func (u *User) Username() string

Jump to

Keyboard shortcuts

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