github.com/oam-dev/kubevela@v1.9.11/charts/vela-core/templates/defwithtemplate/check-metrics.yaml (about)

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