model

package
v0.0.0-...-e560ebb Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2021 License: BSD-3-Clause Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// AlertKeySeparator separates fields in AlertJSONNonGrouping Key.
	AlertKeySeparator = "$!"
)

Variables

This section is empty.

Functions

func GenerateKeyDigest

func GenerateKeyDigest(key string) string

GenerateKeyDigest generates KeyDigest field from key for annotations.

Types

type AlertJSON

type AlertJSON struct {
	ID           string         `gae:"$id" json:"-"`
	Tree         *datastore.Key `gae:"$parent"`
	Date         time.Time
	Contents     []byte `gae:",noindex"`
	Resolved     bool
	AutoResolved bool
	ResolvedDate time.Time
}

AlertJSON is the JSON blob of an alert for a tree. TODO(crbug.com/1043371): Remove this when we disable automatic grouping.

type AlertJSONNonGrouping

type AlertJSONNonGrouping struct {
	ID           string         `gae:"$id" json:"-"`
	Tree         *datastore.Key `gae:"$parent"`
	Date         time.Time
	Contents     []byte `gae:",noindex"`
	Resolved     bool
	AutoResolved bool
	ResolvedDate time.Time
}

AlertJSONNonGrouping is the JSON blob of an alert for a tree.

func (*AlertJSONNonGrouping) GetStepName

func (a *AlertJSONNonGrouping) GetStepName() (string, error)

GetStepName retrieves step name for an alert.

type Annotation

type Annotation struct {
	Tree             *datastore.Key `gae:"$parent"`
	KeyDigest        string         `gae:"$id"`
	Key              string         `gae:",noindex" json:"key"`
	Bugs             []MonorailBug  `gae:",noindex" json:"bugs"`
	Comments         []Comment      `gae:",noindex" json:"comments"`
	SnoozeTime       int            `json:"snoozeTime"`
	GroupID          string         `gae:",noindex" json:"group_id"`
	ModificationTime time.Time
}

Annotation is any information sheriffs want to annotate an alert with. For example, a bug where the cause of the alert is being solved. TODO(crbug.com/1043371): Remove this when we disable automatic grouping.

func (*Annotation) Add

func (a *Annotation) Add(c context.Context, r io.Reader) (bool, error)

Add adds some data to an annotation. Returns true if a refresh of annotation metadata (currently monorail data) is required, and any errors encountered.

func (*Annotation) GetStepName

func (a *Annotation) GetStepName() (string, error)

GetStepName retrieves step name for an annotation.

func (*Annotation) IsGroupAnnotation

func (a *Annotation) IsGroupAnnotation() bool

IsGroupAnnotation returns whether an annotation is a group annotation or a normal annotation

func (*Annotation) Remove

func (a *Annotation) Remove(c context.Context, r io.Reader) (bool, error)

Remove removes some data to an annotation. Returns if a refreshe of annotation metadata (currently monorail data) is required, and any errors encountered.

type AnnotationNonGrouping

type AnnotationNonGrouping struct {
	Tree             *datastore.Key `gae:"$parent"`
	KeyDigest        string         `gae:"$id"`
	Key              string         `gae:",noindex" json:"key"`
	Bugs             []MonorailBug  `gae:",noindex" json:"bugs"`
	Comments         []Comment      `gae:",noindex" json:"comments"`
	SnoozeTime       int            `json:"snoozeTime"`
	GroupID          string         `gae:",noindex" json:"group_id"`
	ModificationTime time.Time
}

AnnotationNonGrouping is any information sheriffs want to annotate an alert with. For example, a bug where the cause of the alert is being solved.

type BuildBucketTree

type BuildBucketTree struct {
	TreeName     string         `json:"tree_name"`
	TreeBuilders []*TreeBuilder `json:"tree_builders"`
}

BuildBucketTree holds "tree" information about buildbucket builders.

type Comment

type Comment struct {
	Text string    `json:"text"`
	User string    `json:"user"`
	Time time.Time `json:"time"`
}

Comment is the format for the data in the Comments property of an Annotation

type MonorailBug

type MonorailBug struct {
	BugID     string `json:"id"`        // This should match monorail.Issue.id
	ProjectID string `json:"projectId"` // This should match monorail.Issue.projectId
}

MonorailBug stores data to differentiate bugs by projects.

type ResolveRequest

type ResolveRequest struct {
	Keys     []string `json:"keys"`
	Resolved bool     `json:"resolved"`
}

ResolveRequest is the format of the request to resolve alerts.

type ResolveResponse

type ResolveResponse struct {
	Tree     string   `json:"tree"`
	Keys     []string `json:"keys"`
	Resolved bool     `json:"resolved"`
}

ResolveResponse is the format of the response to resolve alerts.

type RevisionSummaryJSON

type RevisionSummaryJSON struct {
	ID       string         `gae:"$id" json:"-"`
	Tree     *datastore.Key `gae:"$parent"`
	Date     time.Time
	Contents []byte `gae:",noindex"`
}

RevisionSummaryJSON is the JSON blob of a RevisionSummary for a tree.

type Tree

type Tree struct {
	Name                       string   `gae:"$id" json:"name"`
	DisplayName                string   `json:"display_name"`
	AlertStreams               []string `json:"alert_streams,omitempty"`
	BugQueueLabel              string   `json:"bug_queue_label,omitempty"`
	HelpLink                   string   `json:"help_link,omitempty"`
	GerritProject              string   `json:"gerrit_project,omitempty"`
	GerritInstance             string   `json:"gerrit_instance,omitempty"`
	DefaultMonorailProjectName string   `json:"default_monorail_project_name,omitempty"`
	BuildBucketProjectFilter   string   `json:"bb_project_filter"`
}

Tree is a tree which sheriff-o-matic receives and groups alerts for.

type TreeBuilder

type TreeBuilder struct {
	Project  string   // buildbucket project name
	Bucket   string   // buildbucket bucket name
	Builders []string // buildbucket builder name
}

TreeBuilder is a builder that belongs to a particular tree or trees.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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