Skip to content
This repository has been archived by the owner on Jul 28, 2021. It is now read-only.

Commit

Permalink
Merge pull request #22 from keptn-contrib/patch/improve-error-msg
Browse files Browse the repository at this point in the history
Add NaN check for SLI value
  • Loading branch information
agrimmer authored Mar 5, 2020
2 parents 1d6a75f + 854b490 commit b526792
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"log"
"math"
"net/url"
"os"
"strings"
Expand Down Expand Up @@ -138,6 +139,13 @@ func retrieveMetrics(event cloudevents.Event) error {
Success: false,
Message: err.Error(),
})
} else if math.IsNaN(sliValue) {
sliResults = append(sliResults, &keptnevents.SLIResult{
Metric: indicator,
Value: 0,
Success: false,
Message: "SLI value is NaN",
})
} else {
sliResults = append(sliResults, &keptnevents.SLIResult{
Metric: indicator,
Expand Down

0 comments on commit b526792

Please sign in to comment.