runAsCheck runs a leaf node as a check, with telemetry span and optional scale-out.
( ctx context.Context, isLeaf func(*ModTreeNode) bool, tryScaleOut func(*ModTreeNode, context.Context) (bool, error), runLocally func(*ModTreeNode, context.Context) error, include, exclude []string, )
| 137 | |
| 138 | // runAsCheck runs a leaf node as a check, with telemetry span and optional scale-out. |
| 139 | func (node *ModTreeNode) runAsCheck( |
| 140 | ctx context.Context, |
| 141 | isLeaf func(*ModTreeNode) bool, |
| 142 | tryScaleOut func(*ModTreeNode, context.Context) (bool, error), |
| 143 | runLocally func(*ModTreeNode, context.Context) error, |
| 144 | include, exclude []string, |
| 145 | ) error { |
| 146 | return node.Run(ctx, |
| 147 | isLeaf, |
| 148 | func(ctx context.Context, n *ModTreeNode, clientMD *engine.ClientMetadata) (rerr error) { |
| 149 | // Try scale-out if enabled (will be false for scaled-out sessions) |
| 150 | if clientMD != nil && clientMD.EnableCloudScaleOut { |
| 151 | if ok, err := tryScaleOut(n, ctx); ok { |
| 152 | return err |
| 153 | } |
| 154 | } |
| 155 | ctx, span := Tracer(ctx).Start(ctx, n.PathString(), |
| 156 | telemetry.Reveal(), |
| 157 | trace.WithAttributes( |
| 158 | attribute.Bool(telemetry.UIRollUpLogsAttr, true), |
| 159 | attribute.Bool(telemetry.UIRollUpSpansAttr, true), |
| 160 | attribute.String(telemetry.CheckNameAttr, n.PathString()), |
| 161 | ), |
| 162 | ) |
| 163 | defer func() { |
| 164 | span.SetAttributes(attribute.Bool(telemetry.CheckPassedAttr, rerr == nil)) |
| 165 | telemetry.EndWithCause(span, &rerr) |
| 166 | }() |
| 167 | return runLocally(n, ctx) |
| 168 | }, |
| 169 | include, exclude) |
| 170 | } |
| 171 | |
| 172 | func (node *ModTreeNode) runGeneratorAsCheckLocally(ctx context.Context) error { |
| 173 | changes, err := node.runGeneratorLocally(ctx) |
no test coverage detected