Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: default title and body for notifications #535

Merged
merged 16 commits into from
Sep 11, 2023
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
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")
adityathebe marked this conversation as resolved.
Show resolved Hide resolved
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
Loading