formatter

package
v0.0.0-...-aaba22b Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2025 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Formatter

type Formatter interface {
	// Return body and subject of a bug for new found culprit.
	GetCulpritSubjectAndBody(ctx context.Context, culprit *pb.Culprit, subscription *sub_pb.Subscription) (string, string, error)

	// Return body and subject of a bug for reporting a new anomaly group.
	GetReportSubjectAndBody(ctx context.Context, anomalyGroup *ag.AnomalyGroup, subscription *sub_pb.Subscription, anomalyList []*pb.Anomaly) (string, string, error)
}

Formatter controls how the notification looks like

type MarkdownFormatter

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

MarkdownFormatter implement Formatter.

func NewMarkdownFormatter

func NewMarkdownFormatter(commitURLTemplate string, instanceConfig *config.InstanceConfig) (*MarkdownFormatter, error)

NewMarkdownFormatter return a new MarkdownFormatter.

func (MarkdownFormatter) GetCulpritSubjectAndBody

func (f MarkdownFormatter) GetCulpritSubjectAndBody(ctx context.Context, culprit *pb.Culprit,
	subscription *sub_pb.Subscription) (string, string, error)

FormatNewCulprit implements Formatter.

func (MarkdownFormatter) GetReportSubjectAndBody

func (f MarkdownFormatter) GetReportSubjectAndBody(ctx context.Context, anomalyGroup *ag.AnomalyGroup,
	subscription *sub_pb.Subscription, anomalyList []*pb.Anomaly) (string, string, error)

FormatNewReportSubjectAndBody implements Formatter

type NoopFormatter

type NoopFormatter struct {
}

NoopFormatter implements Formatter by doing nothing.

func NewNoopFormatter

func NewNoopFormatter() *NoopFormatter

NewNoopFormatter returns a new EmailService instance.

func (*NoopFormatter) GetCulpritSubjectAndBody

func (f *NoopFormatter) GetCulpritSubjectAndBody(ctx context.Context, culprit *pb.Culprit,
	subscription *sub_pb.Subscription) (string, string, error)

GetCulpritSubjectAndBody implements Formatter.

func (*NoopFormatter) GetReportSubjectAndBody

func (f *NoopFormatter) GetReportSubjectAndBody(ctx context.Context, anomalyGroup *ag.AnomalyGroup,
	subscription *sub_pb.Subscription, anomalyList []*pb.Anomaly) (string, string, error)

GetReportSubjectAndBody implements Formatter.

type ReportTemplateContext

type ReportTemplateContext struct {
	// The anomaly group newly found.
	AnomalyGroup *ag.AnomalyGroup

	// The subcsription based on which the anomaly group is created.
	Subscription *sub_pb.Subscription

	// The anomalies with the most significant performance change.
	TopAnomalies []*pb.Anomaly

	// The url of the current instance
	HostUrl string
}

type TemplateContext

type TemplateContext struct {
	// Commit is the Commit the regression was found at.
	Commit *pb.Commit

	// CommitURL is a URL that points to the above Commit.
	// e.g.
	CommitUrl string

	// Subscription is the configuration which tells where/how to file the bug
	Subscription *sub_pb.Subscription
}

TemplateContext is used in expanding the message templates.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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