Skip to content

Commit 8ece7fb

Browse files
authored
docs: analysis results - handling empty array (argoproj#1481)
Signed-off-by: Hui Kang <[email protected]>
1 parent 9a9b0cd commit 8ece7fb

File tree

1 file changed

+48
-1
lines changed

1 file changed

+48
-1
lines changed

docs/features/analysis.md

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,9 @@ spec:
645645
value: "Bearer {{ args.api-token }}"
646646
```
647647

648-
## Handling Metric Results - NaN and Infinity
648+
## Handling Metric Results
649+
650+
### NaN and Infinity
649651
Metric providers can sometimes return values of NaN (not a number) and infinity. Users can edit the `successCondition` and `failureCondition` fields
650652
to handle these cases accordingly.
651653

@@ -754,3 +756,48 @@ status:
754756
startedAt: "2021-02-10T00:15:26Z"
755757
```
756758

759+
### Empty array
760+
761+
Metric providers can sometimes return empty array, e.g., no data returned from prometheus query.
762+
763+
Here are two examples where a metric result of empty array is considered successful and failed respectively.
764+
765+
```yaml
766+
apiVersion: argoproj.io/v1alpha1
767+
kind: AnalysisRun
768+
...
769+
successCondition: len(result) == 0 || result >= 0.95
770+
status:
771+
metricResults:
772+
- count: 1
773+
measurements:
774+
- finishedAt: "2021-09-08T19:15:49Z"
775+
phase: Successful
776+
startedAt: "2021-09-08T19:15:49Z"
777+
value: '[]'
778+
name: success-rate
779+
phase: Successful
780+
successful: 1
781+
phase: Successful
782+
startedAt: "2021-09-08T19:15:49Z"
783+
```
784+
785+
```yaml
786+
apiVersion: argoproj.io/v1alpha1
787+
kind: AnalysisRun
788+
...
789+
successCondition: len(result) > 0 && result >= 0.95
790+
status:
791+
metricResults:
792+
- count: 1
793+
measurements:
794+
- finishedAt: "2021-09-08T19:19:44Z"
795+
phase: Failed
796+
startedAt: "2021-09-08T19:19:44Z"
797+
value: '[]'
798+
name: success-rate
799+
phase: Failed
800+
successful: 1
801+
phase: Failed
802+
startedAt: "2021-09-08T19:19:44Z"
803+
```

0 commit comments

Comments
 (0)