crane
crane copied to clipboard
Empty response from prediction debug api interface
Describe the bug


https://github.com/gocrane/crane/blob/be21d25057cf3b779e31956457d68664b375c136/pkg/server/router.go#L61-L64
apiVersion: prediction.crane.io/v1alpha1
kind: TimeSeriesPrediction
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"prediction.crane.io/v1alpha1","kind":"TimeSeriesPrediction","metadata":{"annotations":{},"name":"tsp-nodes-percent","namespace":"default"},"spec":{"predictionMetrics":[{"algorithm":{"algorithmType":"percentile","percentile":{"histogram":{"bucketSize":"10","bucketSizeGrowthRatio":"1.5","epsilon":"1e-10","firstBucketSize":"40","halfLife":"12h","maxValue":"10000.0"},"minSampleWeight":"1.0","sampleInterval":"1m"}},"expressionQuery":{"expression":"1-avg(rate(node_cpu_seconds_total{mode=\"idle\"}[1m])) by (instance)"},"resourceIdentifier":"nodes-cpu","type":"ExpressionQuery"},{"algorithm":{"algorithmType":"percentile","percentile":{"histogram":{"bucketSize":"10","bucketSizeGrowthRatio":"1.5","epsilon":"1e-10","firstBucketSize":"40","halfLife":"12h","maxValue":"1000000.0"},"minSampleWeight":"1.0","sampleInterval":"1m"}},"expressionQuery":{"expression":"sum(node_memory_MemTotal_bytes{} - node_memory_MemAvailable_bytes{}) by (instance)"},"resourceIdentifier":"nodes-mem","type":"ExpressionQuery"}],"predictionWindowSeconds":600,"targetRef":{"kind":"Node","name":"10.100.100.102"}}}
creationTimestamp: "2022-07-21T14:55:02Z"
generation: 1
name: tsp-nodes-percent
namespace: default
resourceVersion: "1254800"
uid: 318f5711-f363-4a48-888c-c118c1c6ba72
spec:
predictionMetrics:
- algorithm:
algorithmType: percentile
percentile:
histogram:
bucketSize: "10"
bucketSizeGrowthRatio: "1.5"
epsilon: "1e-10"
firstBucketSize: "40"
halfLife: 12h
maxValue: "10000.0"
minSampleWeight: "1.0"
sampleInterval: 1m
expressionQuery:
expression: 1-avg(rate(node_cpu_seconds_total{mode="idle"}[1m])) by (instance)
resourceIdentifier: nodes-cpu
type: ExpressionQuery
- algorithm:
algorithmType: percentile
percentile:
histogram:
bucketSize: "10"
bucketSizeGrowthRatio: "1.5"
epsilon: "1e-10"
firstBucketSize: "40"
halfLife: 12h
maxValue: "1000000.0"
minSampleWeight: "1.0"
sampleInterval: 1m
expressionQuery:
expression: sum(node_memory_MemTotal_bytes{} - node_memory_MemAvailable_bytes{})
by (instance)
resourceIdentifier: nodes-mem
type: ExpressionQuery
predictionWindowSeconds: 600
targetRef:
kind: Node
name: 10.100.100.102
status:
conditions:
- lastTransitionTime: "2022-07-21T15:17:02Z"
message: ""
reason: PredictSucceed
status: "True"
type: Ready
predictionMetrics:
- prediction:
- samples:
- timestamp: 1658416620
value: "0.00000"
- timestamp: 1658416680
value: "0.00000"
- timestamp: 1658416740
value: "0.00000"
- timestamp: 1658416800
value: "0.00000"
- timestamp: 1658416860
value: "0.00000"
- timestamp: 1658416920
value: "0.00000"
- timestamp: 1658416980
value: "0.00000"
- timestamp: 1658417040
value: "0.00000"
- timestamp: 1658417100
value: "0.00000"
- timestamp: 1658417160
value: "0.00000"
- timestamp: 1658417220
value: "0.00000"
- timestamp: 1658417280
value: "0.00000"
- timestamp: 1658417340
value: "0.00000"
- timestamp: 1658417400
value: "0.00000"
- timestamp: 1658417460
value: "0.00000"
- timestamp: 1658417520
value: "0.00000"
- timestamp: 1658417580
value: "0.00000"
- timestamp: 1658417640
value: "0.00000"
- timestamp: 1658417700
value: "0.00000"
- timestamp: 1658417760
value: "0.00000"
- timestamp: 1658417820
value: "0.00000"
ready: true
resourceIdentifier: nodes-cpu
- prediction:
- samples:
- timestamp: 1658416620
value: "100.00000"
- timestamp: 1658416680
value: "100.00000"
- timestamp: 1658416740
value: "100.00000"
- timestamp: 1658416800
value: "100.00000"
- timestamp: 1658416860
value: "100.00000"
- timestamp: 1658416920
value: "100.00000"
- timestamp: 1658416980
value: "100.00000"
- timestamp: 1658417040
value: "100.00000"
- timestamp: 1658417100
value: "100.00000"
- timestamp: 1658417160
value: "100.00000"
- timestamp: 1658417220
value: "100.00000"
- timestamp: 1658417280
value: "100.00000"
- timestamp: 1658417340
value: "100.00000"
- timestamp: 1658417400
value: "100.00000"
- timestamp: 1658417460
value: "100.00000"
- timestamp: 1658417520
value: "100.00000"
- timestamp: 1658417580
value: "100.00000"
- timestamp: 1658417640
value: "100.00000"
- timestamp: 1658417700
value: "100.00000"
- timestamp: 1658417760
value: "100.00000"
- timestamp: 1658417820
value: "100.00000"
ready: true
resourceIdentifier: nodes-mem
Reproduce steps
- Use the latest images.
API Ref: https://www.postman.com/speeding-crater-505947/workspace/public/collection/14940923-8559deb0-9af9-4ace-bc64-14da3dd0c8f8?action=share&creator=14940923
Expected behavior
Should be return Prediction Metrics.
@yufeiyu
Thanks @zsnmwy for the issue. Looks like if there are more than ONE time series, this debug interface has some problems. I'll take a look at it.