Skip to content

Commit

Permalink
feat: default title and body for notifications (#535)
Browse files Browse the repository at this point in the history
* feat: default title and body for notifications

* feat: add permalink to the template

* chore: notification | improve default titles and messages

* feat: use of markdown in notification messages

* chore: remove public endpoint flag.

* feat: add uptime and latency to check in notification template

* feat: display labels for checks and components in default notification
message

* chore: go mod tidy on hack

* chore: update template

* chore: add agent details to check templates

* chore: go mod tidy on hack

* feat: add check error and message

[skip ci]

* chore: use getters from duty

[skip ci]

* chore: use more cached getters

[skip ci]

* chore: address review comment

* chore: bump duty
  • Loading branch information
adityathebe authored Sep 11, 2023
1 parent 97049b1 commit b056221
Show file tree
Hide file tree
Showing 14 changed files with 380 additions and 357 deletions.
1 change: 1 addition & 0 deletions api/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
type Event struct {
ID uuid.UUID `gorm:"default:generate_ulid()"`
Name string `json:"name"`
CreatedAt time.Time `json:"created_at"`
Properties types.JSONStringMap `json:"properties"`
Error string `json:"error"`
Attempts int `json:"attempts"`
Expand Down
15 changes: 10 additions & 5 deletions api/global.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,16 @@ type ContextUser struct {

const UserIDHeaderKey = "X-User-ID"

var SystemUserID *uuid.UUID
var CanaryCheckerPath string
var ApmHubPath string
var Kubernetes kubernetes.Interface
var Namespace string
var (
SystemUserID *uuid.UUID
CanaryCheckerPath string
ApmHubPath string
Kubernetes kubernetes.Interface
Namespace string

// Full URL of the mission control web UI.
PublicWebURL string
)

// type alias because the name "Context" collides with gocontext
// and embedding both wouldn't have been possible.
Expand Down
16 changes: 8 additions & 8 deletions api/responders.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ type IncidentResponders struct {
}

type Responder struct {
ID uuid.UUID `json:"id,omitempty"`
Type string `json:"type"`
Properties types.JSONStringMap `json:"properties" gorm:"type:jsonstringmap;<-:false"`
ExternalID string `json:"external_id,omitempty"`
IncidentID uuid.UUID `json:"incident_id,omitempty"`
Incident Incident `json:"incident,omitempty"`
TeamID uuid.UUID `json:"team_id,omitempty"`
Team Team `json:"team,omitempty"`
ID uuid.UUID `json:"id,omitempty"`
Type string `json:"type"`
Properties types.JSONMap `json:"properties" gorm:"<-:false"`
ExternalID string `json:"external_id,omitempty"`
IncidentID uuid.UUID `json:"incident_id,omitempty"`
Incident Incident `json:"incident,omitempty"`
TeamID uuid.UUID `json:"team_id,omitempty"`
Team Team `json:"team,omitempty"`
}

type NotificationSpec struct {
Expand Down
3 changes: 1 addition & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ var Root = &cobra.Command{

var dev bool
var httpPort, metricsPort, devGuiPort int
var publicEndpoint = "http://localhost:8080"
var configDb, authMode, kratosAPI, kratosAdminAPI, postgrestURI string
var clerkJWKSURL, clerkOrgID string
var disablePostgrest bool
Expand All @@ -48,7 +47,7 @@ func ServerFlags(flags *pflag.FlagSet) {
flags.IntVar(&devGuiPort, "devGuiPort", 3004, "Port used by a local npm server in development mode")
flags.IntVar(&metricsPort, "metricsPort", 8081, "Port to expose a health dashboard ")
flags.BoolVar(&dev, "dev", false, "Run in development mode")
flags.StringVar(&publicEndpoint, "public-endpoint", "http://localhost:8080", "Public endpoint that this instance is exposed under")
flags.StringVar(&api.PublicWebURL, "public-endpoint", "http://localhost:3000", "Public endpoint this instance is exposed under")
flags.StringVar(&api.ApmHubPath, "apm-hub", "http://apm-hub:8080", "APM Hub URL")
flags.StringVar(&configDb, "config-db", "http://config-db:8080", "Config DB URL")
flags.StringVar(&kratosAPI, "kratos-api", "http://kratos-public:80", "Kratos API service")
Expand Down
2 changes: 1 addition & 1 deletion cmd/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ var Serve = &cobra.Command{
PreRun: PreRun,
Run: func(cmd *cobra.Command, args []string) {
// PostgREST needs to know how it is exposed to create the correct links
db.HttpEndpoint = publicEndpoint + "/db"
db.HttpEndpoint = api.PublicWebURL + "/db"
if authMode != "" {
db.PostgresDBAnonRole = "postgrest_api"
}
Expand Down
2 changes: 2 additions & 0 deletions events/event_queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@ func (t *SyncEventConsumer) Handle(ctx *api.Context) error {
}
}

// FIXME: When this fails we only roll it back and the attempt is never increased.
// Also, error is never saved.
return tx.Commit().Error
}

Expand Down
Loading

0 comments on commit b056221

Please sign in to comment.