Skip to content

Commit

Permalink
Enable reporting of normalized SLO endpoint in prober. (#401)
Browse files Browse the repository at this point in the history
Signed-off-by: Simon Kent <[email protected]>

Signed-off-by: Simon Kent <[email protected]>
  • Loading branch information
Simon Kent authored Oct 4, 2022
1 parent eceb1be commit 037af76
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
9 changes: 5 additions & 4 deletions cmd/prober/endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ var (
)

type ReadProberCheck struct {
Endpoint string `json:"endpoint"`
Method string `json:"method"`
Body string `json:"body"`
Queries map[string]string `json:"queries"`
Endpoint string `json:"endpoint"`
Method string `json:"method"`
Body string `json:"body"`
Queries map[string]string `json:"queries"`
SLOEndpoint string `json:"slo-endpoint"`
}

var RekorEndpoints = []ReadProberCheck{
Expand Down
10 changes: 9 additions & 1 deletion cmd/prober/prober.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,15 @@ func observeRequest(host string, r ReadProberCheck) error {
}
defer resp.Body.Close()

exportDataToPrometheus(resp, host, r.Endpoint, r.Method, latency)
// Report the normalized SLO endpoint to prometheus if
// one is specified. This allows us to report metrics for
// "/api/v1/log/entries/{entryUUID}" instead of
// "/api/v1/log/entries/<literal uuid>.
sloEndpoint := r.SLOEndpoint
if sloEndpoint == "" {
sloEndpoint = r.Endpoint
}
exportDataToPrometheus(resp, host, sloEndpoint, r.Method, latency)
return nil
}

Expand Down

0 comments on commit 037af76

Please sign in to comment.