这是indexloc提供的服务,不要输入任何密码
Skip to content
This repository was archived by the owner on Feb 13, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build/validate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ if [ "$GOGENERATEDIFF" != '' ]; then
fi

echo -e "\nRunning go test bosun.org/..."
go test bosun.org/...
go test -v bosun.org/...
GOTESTRESULT=$?
if [ "$GOTESTRESULT" != 0 ]; then
BUILDMSG="${BUILDMSG}tests fail."
Expand Down
20 changes: 10 additions & 10 deletions cmd/bosun/conf/conf.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ type Alert struct {
UnjoinedOK bool `json:",omitempty"`
Log bool
RunEvery int
returnType eparse.FuncType
returnType models.FuncType

template string
squelch []string
Expand Down Expand Up @@ -934,7 +934,7 @@ func (c *Conf) loadAlert(s *parse.SectionNode) {
c.errorf("neither crit or warn specified")
}
var tags eparse.Tags
var ret eparse.FuncType
var ret models.FuncType
if a.Crit != nil {
ctags, err := a.Crit.Root.Tags()
if err != nil {
Expand Down Expand Up @@ -1188,7 +1188,7 @@ func (c *Conf) NewExpr(s string) *expr.Expr {
c.error(err)
}
switch exp.Root.Return() {
case eparse.TypeNumberSet, eparse.TypeScalar:
case models.TypeNumberSet, models.TypeScalar:
break
default:
c.errorf("expression must return a number")
Expand Down Expand Up @@ -1306,28 +1306,28 @@ func (c *Conf) Funcs() map[string]eparse.Func {
if err != nil {
return nil, err
}
if a.returnType != eparse.TypeNumberSet {
if a.returnType != models.TypeNumberSet {
return nil, fmt.Errorf("alert requires a number-returning expression (got %v)", a.returnType)
}
return e.Root.Tags()
}

funcs := map[string]eparse.Func{
"alert": {
Args: []eparse.FuncType{eparse.TypeString, eparse.TypeString},
Return: eparse.TypeNumberSet,
Args: []models.FuncType{models.TypeString, models.TypeString},
Return: models.TypeNumberSet,
Tags: tagAlert,
F: c.alert,
},
"lookup": {
Args: []eparse.FuncType{eparse.TypeString, eparse.TypeString},
Return: eparse.TypeNumberSet,
Args: []models.FuncType{models.TypeString, models.TypeString},
Return: models.TypeNumberSet,
Tags: lookupTags,
F: lookup,
},
"lookupSeries": {
Args: []eparse.FuncType{eparse.TypeSeriesSet, eparse.TypeString, eparse.TypeString},
Return: eparse.TypeNumberSet,
Args: []models.FuncType{models.TypeSeriesSet, models.TypeString, models.TypeString},
Return: models.TypeNumberSet,
Tags: lookupSeriesTags,
F: lookupSeries,
},
Expand Down
11 changes: 3 additions & 8 deletions cmd/bosun/conf/notify.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"bosun.org/_third_party/github.com/jordan-wright/email"
"bosun.org/collect"
"bosun.org/metadata"
"bosun.org/models"
"bosun.org/slog"
"bosun.org/util"
)
Expand All @@ -25,7 +26,7 @@ func init() {
"The number of email notifications that Bosun failed to send.")
}

func (n *Notification) Notify(subject, body string, emailsubject, emailbody []byte, c *Conf, ak string, attachments ...*Attachment) {
func (n *Notification) Notify(subject, body string, emailsubject, emailbody []byte, c *Conf, ak string, attachments ...*models.Attachment) {
if len(n.Email) > 0 {
go n.DoEmail(emailsubject, emailbody, c, ak, attachments...)
}
Expand Down Expand Up @@ -93,13 +94,7 @@ func (n *Notification) DoGet(ak string) {
}
}

type Attachment struct {
Data []byte
Filename string
ContentType string
}

func (n *Notification) DoEmail(subject, body []byte, c *Conf, ak string, attachments ...*Attachment) {
func (n *Notification) DoEmail(subject, body []byte, c *Conf, ak string, attachments ...*models.Attachment) {
e := email.NewEmail()
e.From = c.EmailFrom
for _, a := range n.Email {
Expand Down
2 changes: 1 addition & 1 deletion cmd/bosun/database/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ type DataAccess interface {
Metadata() MetadataDataAccess
Search() SearchDataAccess
Errors() ErrorDataAccess
State() StateDataAccess
Silence() SilenceDataAccess
Incidents() IncidentDataAccess
}

type MetadataDataAccess interface {
Expand Down
128 changes: 0 additions & 128 deletions cmd/bosun/database/incident_data.go

This file was deleted.

Loading