Skip to content

Commit

Permalink
improve error logs for prober
Browse files Browse the repository at this point in the history
Signed-off-by: Hector Fernandez <[email protected]>
  • Loading branch information
hectorj2f committed Dec 5, 2023
1 parent 7e15745 commit 68a442d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cmd/prober/write.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,14 @@ func rekorWriteEndpoint(ctx context.Context, cert *x509.Certificate, priv *ecdsa
defer resp.Body.Close()
exportDataToPrometheus(resp, rekorURL, endpoint, POST, latency)

if resp.StatusCode != http.StatusOK {
return fmt.Errorf("invalid status code when checking an entry in rekor: %s", resp.Status)
}
// If entry was added successfully, we should verify it
var logEntry models.LogEntry
err = json.NewDecoder(resp.Body).Decode(&logEntry)
if err != nil {
return fmt.Errorf("unmarshal: %w", err)
return fmt.Errorf("error decoding the log entry with body '%v' and error: %w", resp.Body, err)
}
var logEntryAnon models.LogEntryAnon
for _, e := range logEntry {
Expand Down

0 comments on commit 68a442d

Please sign in to comment.