Documentation ¶
Overview ¶
Package notify is a package for sending notifications.
Index ¶
- func URLFromCommitRange(commit, previousCommit provider.Commit, commitRangeURLTemplate string) string
- type ChromePerfNotifier
- func (n *ChromePerfNotifier) ExampleSend(ctx context.Context, alert *alerts.Alert) error
- func (n *ChromePerfNotifier) RegressionFound(ctx context.Context, commit, previousCommit provider.Commit, ...) (string, error)
- func (n *ChromePerfNotifier) RegressionMissing(ctx context.Context, commit, previousCommit provider.Commit, ...) error
- func (n *ChromePerfNotifier) UpdateNotification(ctx context.Context, commit, previousCommit provider.Commit, ...) error
- type EmailTransport
- func (e EmailTransport) SendNewRegression(ctx context.Context, alert *alerts.Alert, body, subject string) (string, error)
- func (e EmailTransport) SendRegressionMissing(ctx context.Context, threadingReference string, alert *alerts.Alert, ...) error
- func (e EmailTransport) UpdateRegressionNotification(ctx context.Context, alert *alerts.Alert, body, notificationId string) error
- type Formatter
- type HTMLFormatter
- type IssueTrackerTransport
- func (t *IssueTrackerTransport) SendNewRegression(ctx context.Context, alert *alerts.Alert, body, subject string) (string, error)
- func (t *IssueTrackerTransport) SendRegressionMissing(ctx context.Context, threadingReference string, alert *alerts.Alert, ...) error
- func (t *IssueTrackerTransport) UpdateRegressionNotification(ctx context.Context, alert *alerts.Alert, body, notificationId string) error
- type MarkdownFormatter
- type NoopTransport
- func (e NoopTransport) SendNewRegression(ctx context.Context, alert *alerts.Alert, body, subject string) (string, error)
- func (e NoopTransport) SendRegressionMissing(ctx context.Context, threadingReference string, alert *alerts.Alert, ...) error
- func (e NoopTransport) UpdateRegressionNotification(ctx context.Context, alert *alerts.Alert, body, notificationId string) error
- type NotificationDataProvider
- type Notifier
- type TemplateContext
- type Transport
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ChromePerfNotifier ¶
type ChromePerfNotifier struct {
// contains filtered or unexported fields
}
ChromeperfNotifier struct used to send regression data to chromeperf.
func NewChromePerfNotifier ¶
func NewChromePerfNotifier(ctx context.Context, anomalyApiClient chromeperf.AnomalyApiClient) (*ChromePerfNotifier, error)
NewChromePerfNotifier returns a new ChromePerfNotifier instance.
func (*ChromePerfNotifier) ExampleSend ¶
ExampleSend is for dummy data. Do nothing!
func (*ChromePerfNotifier) RegressionFound ¶
func (n *ChromePerfNotifier) RegressionFound( ctx context.Context, commit, previousCommit provider.Commit, alert *alerts.Alert, cl *clustering2.ClusterSummary, frame *frame.FrameResponse, regressionID string) (string, error)
RegressionFound implements notify.Notifier. Invoked when a new regression is detected.
func (*ChromePerfNotifier) RegressionMissing ¶
func (n *ChromePerfNotifier) RegressionMissing( ctx context.Context, commit, previousCommit provider.Commit, alert *alerts.Alert, cl *clustering2.ClusterSummary, frame *frame.FrameResponse, threadingReference string) error
RegressionMissing implements notify.Notifier. Invoked when a previous regression is recovered.
func (*ChromePerfNotifier) UpdateNotification ¶
func (n *ChromePerfNotifier) UpdateNotification(ctx context.Context, commit, previousCommit provider.Commit, alert *alerts.Alert, cl *clustering2.ClusterSummary, frame *frame.FrameResponse, notificationId string) error
UpdateRegressionNotification implements Transport.
type EmailTransport ¶
type EmailTransport struct {
// contains filtered or unexported fields
}
EmailTransport implements Transport using emailclient.
func NewEmailTransport ¶
func NewEmailTransport() EmailTransport
NewEmailTransport returns a new EmailService instance.
func (EmailTransport) SendNewRegression ¶
func (e EmailTransport) SendNewRegression(ctx context.Context, alert *alerts.Alert, body, subject string) (string, error)
SendNewRegression implements Transport.
func (EmailTransport) SendRegressionMissing ¶
func (e EmailTransport) SendRegressionMissing(ctx context.Context, threadingReference string, alert *alerts.Alert, body, subject string) error
SendRegressionMissing implements Transport.
func (EmailTransport) UpdateRegressionNotification ¶
func (e EmailTransport) UpdateRegressionNotification(ctx context.Context, alert *alerts.Alert, body, notificationId string) error
UpdateRegressionNotification implements Transport.
type Formatter ¶
type Formatter interface { // Return body and subject. FormatNewRegression(ctx context.Context, commit, previousCommit provider.Commit, alert *alerts.Alert, cl *clustering2.ClusterSummary, URL string, frame *frame.FrameResponse) (string, string, error) FormatRegressionMissing(ctx context.Context, commit, previousCommit provider.Commit, alert *alerts.Alert, cl *clustering2.ClusterSummary, URL string, frame *frame.FrameResponse) (string, string, error) }
Formatter has implementations for both HTML and Markdown.
type HTMLFormatter ¶
type HTMLFormatter struct {
// contains filtered or unexported fields
}
HTMLFormatter implements Formatter.
func NewHTMLFormatter ¶
func NewHTMLFormatter(commitRangeURITemplate string) HTMLFormatter
NewHTMLFormatter returns a new HTMLFormatter.
func (HTMLFormatter) FormatNewRegression ¶
func (h HTMLFormatter) FormatNewRegression(ctx context.Context, commit, previousCommit provider.Commit, alert *alerts.Alert, cl *clustering2.ClusterSummary, URL string, frame *frame.FrameResponse) (string, string, error)
FormatNewRegression implements Formatter.
func (HTMLFormatter) FormatRegressionMissing ¶
func (h HTMLFormatter) FormatRegressionMissing(ctx context.Context, commit, previousCommit provider.Commit, alert *alerts.Alert, cl *clustering2.ClusterSummary, URL string, frame *frame.FrameResponse) (string, string, error)
FormatRegressionMissing implements Formatter.
type IssueTrackerTransport ¶
type IssueTrackerTransport struct {
// contains filtered or unexported fields
}
IssueTrackerTransport implements Transport using the issue tracker API.
func NewIssueTrackerTransport ¶
func NewIssueTrackerTransport(ctx context.Context, cfg *config.NotifyConfig) (*IssueTrackerTransport, error)
NewIssueTrackerTransport returns a new IssueTrackerTransport.
func (*IssueTrackerTransport) SendNewRegression ¶
func (t *IssueTrackerTransport) SendNewRegression(ctx context.Context, alert *alerts.Alert, body, subject string) (string, error)
SendNewRegression implements Transport.
func (*IssueTrackerTransport) SendRegressionMissing ¶
func (t *IssueTrackerTransport) SendRegressionMissing(ctx context.Context, threadingReference string, alert *alerts.Alert, body, subject string) error
SendRegressionMissing implements Transport.
func (*IssueTrackerTransport) UpdateRegressionNotification ¶
func (t *IssueTrackerTransport) UpdateRegressionNotification(ctx context.Context, alert *alerts.Alert, body, notificationId string) error
UpdateRegressionNotification updates the bug with a comment containing the details specified.
type MarkdownFormatter ¶
type MarkdownFormatter struct {
// contains filtered or unexported fields
}
MarkdownFormatter implement Formatter.
func NewMarkdownFormatter ¶
func NewMarkdownFormatter(commitRangeURITemplate string, notifyConfig *config.NotifyConfig) (MarkdownFormatter, error)
NewMarkdownFormatter return a new MarkdownFormatter.
func (MarkdownFormatter) FormatNewRegression ¶
func (h MarkdownFormatter) FormatNewRegression(ctx context.Context, commit, previousCommit provider.Commit, alert *alerts.Alert, cl *clustering2.ClusterSummary, URL string, frame *frame.FrameResponse) (string, string, error)
FormatNewRegression implements Formatter.
func (MarkdownFormatter) FormatRegressionMissing ¶
func (h MarkdownFormatter) FormatRegressionMissing(ctx context.Context, commit, previousCommit provider.Commit, alert *alerts.Alert, cl *clustering2.ClusterSummary, URL string, frame *frame.FrameResponse) (string, string, error)
FormatRegressionMissing implements Formatter.
type NoopTransport ¶
type NoopTransport struct { }
NoopTransport implements Transport by doing nothing.
func NewNoopTransport ¶
func NewNoopTransport() NoopTransport
NewNoopTransport returns a new EmailService instance.
func (NoopTransport) SendNewRegression ¶
func (e NoopTransport) SendNewRegression(ctx context.Context, alert *alerts.Alert, body, subject string) (string, error)
SendNewRegression implements Transport.
func (NoopTransport) SendRegressionMissing ¶
func (e NoopTransport) SendRegressionMissing(ctx context.Context, threadingReference string, alert *alerts.Alert, body, subject string) error
SendRegressionMissing implements Transport.
func (NoopTransport) UpdateRegressionNotification ¶
func (e NoopTransport) UpdateRegressionNotification(ctx context.Context, alert *alerts.Alert, body, notificationId string) error
UpdateRegressionNotification implements Transport.
type NotificationDataProvider ¶
type NotificationDataProvider interface { // GetNotificationDataRegressionFound returns a notificationData object for the given regression metadata. GetNotificationDataRegressionFound(context.Context, common.RegressionMetadata) (*common.NotificationData, error) // GetNotificationDataRegressionMissing returns a notificationData object for the given regression metadata. GetNotificationDataRegressionMissing(context.Context, common.RegressionMetadata) (*common.NotificationData, error) }
NotificationDataProvider provides an interface to be used to perform notification data related operations.
type Notifier ¶
type Notifier interface { // RegressionFound sends a notification for the given cluster found at the given commit. RegressionFound(ctx context.Context, commit, previousCommit provider.Commit, alert *alerts.Alert, cl *clustering2.ClusterSummary, frame *frame.FrameResponse, regressionID string) (string, error) // RegressionMissing sends a notification that a previous regression found for // the given cluster found at the given commit has disappeared after more data // has arrived. RegressionMissing(ctx context.Context, commit, previousCommit provider.Commit, alert *alerts.Alert, cl *clustering2.ClusterSummary, frame *frame.FrameResponse, threadingReference string) error // ExampleSend sends an example for dummy data for the given alerts.Config. ExampleSend(ctx context.Context, alert *alerts.Alert) error UpdateNotification(ctx context.Context, commit, previousCommit provider.Commit, alert *alerts.Alert, cl *clustering2.ClusterSummary, frame *frame.FrameResponse, notificationId string) error }
Notifier provides an interface for regression notification functions
type TemplateContext ¶
type TemplateContext struct { // URL is the root URL of the Perf instance. URL string // ViewOnDashboard is the URL to view the regressing traces on the explore // page. ViewOnDashboard string // PreviousCommit is the previous commit the regression was found at. // // All commits that might be blamed for causing the regression // are in the range `(PreviousCommit, Commit]`, that is inclusive of // Commit but exclusive of PreviousCommit. PreviousCommit provider.Commit // Commit is the commit the regression was found at. Commit provider.Commit // CommitURL is a URL that points to the above Commit. The value of this URL // can be controlled via the `--commit_range_url` flag. CommitURL string // Alert is the configuration for the alert that found the regression. Alert *alerts.Alert // Cluster is all the information found about the regression. Cluster *clustering2.ClusterSummary // ParamSet for all the matching traces. ParamSet paramtools.ReadOnlyParamSet }
TemplateContext is used in expanding the message templates.
type Transport ¶
type Transport interface { SendNewRegression(ctx context.Context, alert *alerts.Alert, body, subject string) (threadingReference string, err error) SendRegressionMissing(ctx context.Context, threadingReference string, alert *alerts.Alert, body, subject string) (err error) UpdateRegressionNotification(ctx context.Context, alert *alerts.Alert, body, notificationId string) (err error) }
Transport has implementations for email, issuetracker, and the noop implementation.