Skip to content

Commit

Permalink
grafana: Fix value type in payload, add debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
deuill committed Oct 23, 2024
1 parent 796316c commit 5d89c8d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
8 changes: 6 additions & 2 deletions pkg/gateway/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,14 @@ func (g *Gateway) HandleHTTP() (string, http.HandlerFunc) {
h := func(w http.ResponseWriter, r *http.Request) {
r = r.WithContext(SetSecret(r.Context(), g.secret))
if msg, err := g.source.ParseHTTP(r); err != nil || len(msg) == 0 {
http.Error(w, fmt.Sprintf("failed processing incoming request: %s", err), http.StatusBadRequest)
msg := fmt.Sprintf("failed processing incoming request: %s", err)
http.Error(w, msg, http.StatusBadRequest)
g.logger.Debug(msg)
return
} else if err = g.destination.PushMessages(r.Context(), msg...); err != nil {
http.Error(w, fmt.Sprintf("failed pushing notification messages: %s", err), http.StatusBadRequest)
msg := fmt.Sprintf("failed pushing notification messages: %s", err)
http.Error(w, msg, http.StatusBadRequest)
g.logger.Debug(msg)
return
}
}
Expand Down
3 changes: 2 additions & 1 deletion pkg/source/grafana/grafana.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ type Alert struct {
Status string `json:"status"`
Labels map[string]string `json:"labels"`
Annotations map[string]string `json:"annotations"`
Values map[string]string `json:"valueString"`
Values map[string]string `json:"values"`
ValueString string `json:"valueString"`

StartsAt string `json:"startsAt"`
EndsAt string `json:"endsAt"`
Expand Down

0 comments on commit 5d89c8d

Please sign in to comment.