MCPcopy Create free account
hub / github.com/baidu/EasyFaaS / getRuntimeConfiguration

Method getRuntimeConfiguration

pkg/controller/invoke.go:279–311  ·  view source on GitHub ↗
(ctx *InvokeContext)

Source from the content-addressed store, hash-verified

277}
278
279func (controller *Controller) getRuntimeConfiguration(ctx *InvokeContext) (hitCache bool, err error) {
280 if ctx.RunOptions.RecommendedOptions.Features.EnableMetrics {
281 ctx.Metrics.StepStart(StageGetRuntimeConfiguration)
282 ctx.Metrics.StepStart(StageGetRuntimeConfigurationHitCache)
283 defer func() {
284 if hitCache {
285 ctx.Metrics.StepDone(StageGetRuntimeConfigurationHitCache)
286 ctx.Metrics.ScrapStage(StageGetRuntimeConfiguration)
287 } else {
288 ctx.Metrics.StepDone(StageGetRuntimeConfiguration)
289 ctx.Metrics.ScrapStage(StageGetRuntimeConfigurationHitCache)
290 }
291 ctx.Metrics.SetLabel(getConfigurationHitCacheLabel, strconv.FormatBool(hitCache))
292 }()
293 }
294
295 ctx.Logger.V(9).Info("get runtime configuration")
296 hitCache = false
297
298 namep := ctx.Function.Configuration.Runtime
299 if namep == nil {
300 return hitCache, innerErr.NewServiceException("runtime name is nil pointer", nil)
301 }
302 name := *namep
303
304 input := &api.GetRuntimeConfigurationInput{
305 RuntimeName: name,
306 Authorization: ctx.Authorization,
307 RequestID: ctx.RequestID,
308 }
309 ctx.Runtime, hitCache, err = ctx.Clients.DataStorer.GetRuntimeConfiguration(input)
310 return hitCache, err
311}
312
313func (controller *Controller) getRuntime(ctx *InvokeContext) (err error) {
314 runtimeT := api.RuntimeViaUnknown

Callers 1

DoMethod · 0.95

Calls 7

StepStartMethod · 0.80
ScrapStageMethod · 0.80
SetLabelMethod · 0.80
VMethod · 0.80
InfoMethod · 0.65
StepDoneMethod · 0.45

Tested by

no test coverage detected