Documentation
¶
Index ¶
- Constants
- Variables
- func FormatCUEError(err error, messagePrefix string, entityType, entityName string, ...) error
- func GetBaseContextLabels(ctx process.Context) map[string]string
- func GetCommonLabels(contextLabels map[string]string) map[string]string
- func GetTraitTemplateKey(name string) string
- func GetWorkloadTemplateKey(name string) string
- type AbstractEngine
Constants ¶
const ( // OutputFieldName is the name of the struct contains the CR data OutputFieldName = velaprocess.OutputFieldName // OutputsFieldName is the name of the struct contains the map[string]CR data OutputsFieldName = velaprocess.OutputsFieldName // PatchFieldName is the name of the struct contains the patch of CR data PatchFieldName = "patch" // PatchOutputsFieldName is the name of the struct contains the patch of outputs CR data PatchOutputsFieldName = "patchOutputs" // ErrsFieldName check if errors contained in the cue ErrsFieldName = "errs" // TemplateContextPrefix is the base prefix for storing templates in context TemplateContextPrefix = "template-context-" )
const ( // AuxiliaryWorkload defines the extra workload obj from a workloadDefinition, // e.g. a workload composed by deployment and service, the service will be marked as AuxiliaryWorkload AuxiliaryWorkload = "AuxiliaryWorkload" )
Variables ¶
var CUERenderDuration = prometheus.NewHistogramVec(prometheus.HistogramOpts{ Name: "kubevela_cue_render_duration_seconds", Help: "End-to-end duration of CUE definition rendering (compat rewrite + compile + validate), by definition kind and status.", Buckets: []float64{0.0001, 0.0005, 0.001, 0.005, 0.01, 0.05, 0.1, 0.5, 1.0}, }, []string{"definition_kind", "status"})
CUERenderDuration measures the end-to-end duration of a definition Complete call, covering CUE version compatibility rewriting, compilation, and validation. Labels:
- definition_kind: definition type, e.g. "Component", "Trait"
- status: "ok" on success, "error" on failure
Buckets are tuned for the expected millisecond range of CUE compilation and validation. Use histogram_quantile() in PromQL to compute aggregated latency percentiles across replicas.
Functions ¶
func FormatCUEError ¶ added in v1.11.0
func FormatCUEError(err error, messagePrefix string, entityType, entityName string, val ...*cue.Value) error
FormatCUEError formats CUE errors in a user-friendly grouped format
func GetBaseContextLabels ¶ added in v1.6.0
GetBaseContextLabels get base context labels
func GetCommonLabels ¶
GetCommonLabels will convert context based labels to OAM standard labels
func GetTraitTemplateKey ¶ added in v1.11.0
GetTraitTemplateKey returns the context key for storing trait templates
func GetWorkloadTemplateKey ¶ added in v1.11.0
GetWorkloadTemplateKey returns the context key for storing workload templates
Types ¶
type AbstractEngine ¶
type AbstractEngine interface {
Complete(ctx process.Context, abstractTemplate string, params interface{}) error
Status(templateContext map[string]interface{}, request *health.StatusRequest) (*health.StatusResult, error)
GetTemplateContext(ctx process.Context, cli client.Client, accessor util.NamespaceAccessor) (map[string]interface{}, error)
}
AbstractEngine defines Definition's Render interface
func NewTraitAbstractEngine ¶
func NewTraitAbstractEngine(name string) AbstractEngine
NewTraitAbstractEngine create Trait Definition AbstractEngine
func NewWorkloadAbstractEngine ¶
func NewWorkloadAbstractEngine(name string) AbstractEngine
NewWorkloadAbstractEngine create Workload Definition AbstractEngine