Skip to content

Commit

Permalink
fix: PR Fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Matthew Clarke <mclarke@spotify.com>
  • Loading branch information
mclarke47 committed Jul 9, 2024
1 parent d3804cc commit 98df9ed
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
10 changes: 5 additions & 5 deletions metricproviders/prometheus/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,17 +136,17 @@ func (p *Provider) GarbageCollect(run *v1alpha1.AnalysisRun, metric v1alpha1.Met
return nil
}

func sampleValuesToFloatSlice(SampleValues []model.SampleValue) []float64 {
results := make([]float64, 0, len(SampleValues))
for _, s := range SampleValues {
func sampleValuesToFloatSlice(sampleValues []model.SampleValue) []float64 {
results := make([]float64, 0, len(sampleValues))
for _, s := range sampleValues {
results = append(results, float64(s))
}
return results
}

func sampleValuesToResultStr(SampleValues []model.SampleValue) string {
func sampleValuesToResultStr(sampleValues []model.SampleValue) string {
results := []string{}
for _, s := range SampleValues {
for _, s := range sampleValues {
results = append(results, s.String())
}
return fmt.Sprintf("[%s]", strings.Join(results, ","))
Expand Down
8 changes: 3 additions & 5 deletions utils/evaluate/evaluate.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,8 @@ func EvalTime(expression string) (time.Time, error) {
var err error

env := map[string]any{
"asInt": asInt,
"asFloat": asFloat,
"isNaN": math.IsNaN,
"isInf": isInf,
"isNaN": math.IsNaN,
"isInf": isInf,
}

unwrapFileErr := func(e error) error {
Expand All @@ -88,7 +86,7 @@ func EvalTime(expression string) (time.Time, error) {
case time.Time:
return val, nil
default:
return time.Time{}, fmt.Errorf("expected string, but got %T", val)
return time.Time{}, fmt.Errorf("expected time.Time, but got %T", val)

Check warning on line 89 in utils/evaluate/evaluate.go

View check run for this annotation

Codecov / codecov/patch

utils/evaluate/evaluate.go#L88-L89

Added lines #L88 - L89 were not covered by tests
}
}

Expand Down

0 comments on commit 98df9ed

Please sign in to comment.