github.com/oam-dev/kubevela@v1.9.11/vela-templates/definitions/internal/workflowstep/check-metrics.cue (about) 1 import ( 2 "vela/op" 3 ) 4 5 "check-metrics": { 6 type: "workflow-step" 7 labels: { 8 "catalog": "Delivery" 9 } 10 annotations: { 11 "category": "Application Delivery" 12 } 13 description: "Verify application's metrics" 14 } 15 template: { 16 check: op.#PromCheck & { 17 query: parameter.query 18 metricEndpoint: parameter.metricEndpoint 19 condition: parameter.condition 20 stepID: context.stepSessionID 21 duration: parameter.duration 22 failDuration: parameter.failDuration 23 } 24 25 fail: op.#Steps & { 26 if check.failed != _|_ { 27 if check.failed == true { 28 breakWorkflow: op.#Fail & { 29 message: check.message 30 } 31 } 32 } 33 } 34 35 wait: op.#ConditionalWait & { 36 continue: check.result 37 if check.message != _|_ { 38 message: check.message 39 } 40 } 41 42 parameter: { 43 // +usage=Query is a raw prometheus query to perform 44 query: string 45 // +usage=The HTTP address and port of the prometheus server 46 metricEndpoint?: "http://prometheus-server.o11y-system.svc:9090" | string 47 // +usage=Condition is an expression which determines if a measurement is considered successful. eg: >=0.95 48 condition: string 49 // +usage=Duration defines the duration of time required for this step to be considered successful. 50 duration?: *"5m" | string 51 // +usage=FailDuration is the duration of time that, if the check fails, will result in the step being marked as failed. 52 failDuration?: *"2m" | string 53 } 54 }