Documentation ¶
Index ¶
- Constants
- Variables
- func CheckIndexes(ctx context.Context, db *mongo.Database, indexes []SystemIndexes) error
- func ClearLoginCache(user gimlet.User, all bool) error
- func FindAndDownloadTestResults(ctx context.Context, env cedar.Environment, taskOpts []TestResultsTaskOptions, ...) (TestResultsStats, []TestResult, error)
- func GenerateTestLog(ctx context.Context, bucket pail.Bucket, size, chunkSize int) ([]LogChunkInfo, []LogLine, error)
- func GetLoginCache(token string) (gimlet.User, bool, error)
- func GetOrAddUser(user gimlet.User) (gimlet.User, error)
- func GetUser(id string) (gimlet.User, bool, error)
- func MakeDBSender(e cedar.Environment) (send.Sender, error)
- func NewDBSender(e cedar.Environment, name string) (send.Sender, error)
- func NewLogIteratorReader(ctx context.Context, it LogIterator, opts LogIteratorReaderOptions) io.Reader
- func PutLoginCache(user gimlet.User) (string, error)
- type BatchJobController
- type BucketConfig
- type CAConfig
- type CedarConfig
- type ChangeDetectorConfig
- type Event
- type Events
- type EvergreenConfig
- type FileCompression
- type FileDataFormat
- type FileSchema
- type Iterator
- type LDAPConfig
- type Log
- func (l *Log) Append(ctx context.Context, lines []LogLine) error
- func (l *Log) Close(ctx context.Context, exitCode int) error
- func (l *Log) Download(ctx context.Context, timeRange TimeRange) (LogIterator, error)
- func (l *Log) Find(ctx context.Context) error
- func (l *Log) IsNil() bool
- func (l *Log) Remove(ctx context.Context) error
- func (l *Log) SaveNew(ctx context.Context) error
- func (l *Log) Setup(e cedar.Environment)
- type LogArtifactInfo
- type LogChunkInfo
- type LogFindOptions
- type LogFormat
- type LogInfo
- type LogIterator
- func NewBatchedLogIterator(bucket pail.Bucket, chunks []LogChunkInfo, batchSize int, timeRange TimeRange) LogIterator
- func NewMergingIterator(iterators ...LogIterator) LogIterator
- func NewParallelizedLogIterator(bucket pail.Bucket, chunks []LogChunkInfo, timeRange TimeRange) LogIterator
- func NewSerializedLogIterator(bucket pail.Bucket, chunks []LogChunkInfo, timeRange TimeRange) LogIterator
- type LogIteratorHeap
- func (h LogIteratorHeap) Len() int
- func (h LogIteratorHeap) Less(i, j int) bool
- func (h *LogIteratorHeap) Pop() interface{}
- func (h *LogIteratorHeap) Push(x interface{})
- func (h *LogIteratorHeap) SafePop() LogIterator
- func (h *LogIteratorHeap) SafePush(it LogIterator)
- func (h LogIteratorHeap) Swap(i, j int)
- type LogIteratorReaderOptions
- type LogLine
- type LogMetrics
- type LogRecord
- type LogSegment
- type LogSegments
- type LoggerParams
- type LoginCache
- type Logs
- type Metadata
- type MigrationStats
- type NaiveAuthConfig
- type NaiveUserConfig
- type OperationalFlags
- type PailType
- func (t PailType) Create(ctx context.Context, env cedar.Environment, bucket, prefix, permissions string, ...) (pail.Bucket, error)
- func (t PailType) CreatePresto(ctx context.Context, env cedar.Environment, prefix, permissions string, ...) (pail.Bucket, error)
- func (t PailType) GetDownloadURL(bucket, prefix, key string) string
- type ParquetTestResult
- type ParquetTestResults
- type ServiceAuthConfig
- type ServiceConfig
- type SlackConfig
- type SystemIndexes
- type SystemInformationRecord
- type SystemInformationRecords
- func (i *SystemInformationRecords) CountBetween(before, after time.Time) (int, error)
- func (i *SystemInformationRecords) CountHostname(host string) (int, error)
- func (i *SystemInformationRecords) FindBetween(before, after time.Time, limit int) error
- func (i *SystemInformationRecords) FindHostname(host string, limit int) error
- func (i *SystemInformationRecords) FindHostnameBetween(host string, before, after time.Time, limit int) error
- func (i *SystemInformationRecords) IsNil() bool
- func (i *SystemInformationRecords) Setup(e cedar.Environment)
- func (i *SystemInformationRecords) Size() int
- func (i *SystemInformationRecords) Slice() []*SystemInformationRecord
- type TestLogInfo
- type TestResult
- type TestResults
- func (t *TestResults) Append(ctx context.Context, results []TestResult) error
- func (t *TestResults) Close(ctx context.Context) error
- func (t *TestResults) Download(ctx context.Context) ([]TestResult, error)
- func (t *TestResults) Find(ctx context.Context) error
- func (t *TestResults) GetBucket(ctx context.Context) (pail.Bucket, error)
- func (t *TestResults) GetPrestoBucket(ctx context.Context) (pail.Bucket, error)
- func (t *TestResults) IsNil() bool
- func (t *TestResults) PrestoPartitionKey() string
- func (t *TestResults) Remove(ctx context.Context) error
- func (t *TestResults) SaveNew(ctx context.Context) error
- func (t *TestResults) Setup(e cedar.Environment)
- type TestResultsArtifactInfo
- type TestResultsFilterAndSortOptions
- type TestResultsInfo
- type TestResultsIterator
- type TestResultsSample
- type TestResultsSortBy
- type TestResultsStats
- type TestResultsTaskOptions
- type TimeRange
- type User
- func (u *User) CreateAPIKey() (string, error)
- func (u *User) DisplayName() string
- func (u *User) Email() string
- func (u *User) Find() error
- func (u *User) GetAPIKey() string
- func (u *User) GetAccessToken() string
- func (u *User) GetRefreshToken() string
- func (u *User) HasPermission(_ gimlet.PermissionOpts) bool
- func (u *User) IsNil() bool
- func (u *User) Roles() []string
- func (u *User) Save() error
- func (u *User) Setup(env cedar.Environment)
- func (u *User) UpdateLoginCache() (string, error)
- func (u *User) Username() string
Constants ¶
const ( TestResultsSortByStartKey = "start" TestResultsSortByDurationKey = "duration" TestResultsSortByTestNameKey = "test_name" TestResultsSortByStatusKey = "status" TestResultsSortByBaseStatusKey = "base_status" )
const ( // BatchJobControllerCollection is the name of the DB collection // for batch job controller documents. BatchJobControllerCollection = "batch_job_controllers" )
const ( // FailedTestsSampleSize is the maximum size for the failed test // results sample. FailedTestsSampleSize = 10 )
Variables ¶
var ( MigrationStatsMigratorIDKey = bsonutil.MustHaveTag(MigrationStats{}, "MigratorID") MigrationStatsStartedAtKey = bsonutil.MustHaveTag(MigrationStats{}, "StartedAt") MigrationStatsCompletedAtKey = bsonutil.MustHaveTag(MigrationStats{}, "CompletedAt") MigrationStatsVersionKey = bsonutil.MustHaveTag(MigrationStats{}, "Version") )
Functions ¶
func CheckIndexes ¶
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 ¶
ClearLoginCache removes users' tokens from cache. Passing true will ignore the user passed and clear all users.
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 ¶
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 ¶
GetOrAddUser gets a user from persistent storage, or if the user does not exist, to create and save it.
func GetUser ¶
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 NewDBSender ¶
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.
Types ¶
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 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 (*Event) Acknowledge ¶
func (*Event) Setup ¶
func (e *Event) Setup(env cedar.Environment)
type Events ¶
type Events struct {
// contains filtered or unexported fields
}
func (*Events) Setup ¶
func (e *Events) Setup(env cedar.Environment)
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 (*Log) Append ¶
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 ¶
Close "closes out" the log by populating the completed_at and info.exit_code fields. The environment should not be nil.
func (*Log) Download ¶
Download returns a LogIterator which iterates lines of the given log. The environment should not be nil.
func (*Log) SaveNew ¶
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.
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.
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) 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 ¶
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 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) 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) 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) 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 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) 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) IsolatedUpdateQuery ¶
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.
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 ¶
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 ServiceAuthConfig ¶
type ServiceAuthConfig struct {
Enabled bool `bson:"enabled" json:"enabled" yaml:"enabled"`
}
type ServiceConfig ¶
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 ¶
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 ¶
func (i *SystemInformationRecord) Setup(e cedar.Environment)
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 (*SystemInformationRecords) IsNil ¶
func (i *SystemInformationRecords) IsNil() bool
func (*SystemInformationRecords) Setup ¶
func (i *SystemInformationRecords) Setup(e cedar.Environment)
func (*SystemInformationRecords) Size ¶
func (i *SystemInformationRecords) Size() int
func (*SystemInformationRecords) Slice ¶
func (i *SystemInformationRecords) Slice() []*SystemInformationRecord
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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.
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 (*User) DisplayName ¶
func (*User) GetAccessToken ¶
func (*User) GetRefreshToken ¶
func (*User) HasPermission ¶
func (u *User) HasPermission(_ gimlet.PermissionOpts) bool
func (*User) Setup ¶
func (u *User) Setup(env cedar.Environment)
func (*User) UpdateLoginCache ¶
Source Files ¶
- batch_job_controller.go
- buildlogger.go
- buildlogger_storage.go
- config.go
- config_flags.go
- formats.go
- indexes.go
- iterator.go
- log.go
- log_iterator.go
- log_segments.go
- metadata.go
- migration_stats.go
- pail_storage.go
- sender.go
- system_info.go
- test_results.go
- test_results_iterator.go
- test_results_storage.go
- test_utils.go
- time_range.go
- users.go