From 430e283c16235d4fa7927dd6d747898853d5dfd5 Mon Sep 17 00:00:00 2001 From: Jessie Liu Date: Tue, 7 Jan 2025 17:58:22 +0000 Subject: [PATCH 1/2] add experiment flag for health monitoring --- launcher/container_runner.go | 11 +++++++++-- launcher/internal/experiments/experiments.go | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/launcher/container_runner.go b/launcher/container_runner.go index ba79e4d3..6042c5f1 100644 --- a/launcher/container_runner.go +++ b/launcher/container_runner.go @@ -129,8 +129,15 @@ func NewRunner(ctx context.Context, cdClient *containerd.Client, token oauth2.To return nil, err } - if err := enableMonitoring(launchSpec.MonitoringEnabled, logger); err != nil { - return nil, err + if launchSpec.MonitoringEnabled == spec.All && !launchSpec.Experiments.EnableHealthMonitoring { + logger.Info("Health monitoring experiment is not enabled - falling back to memory-only.") + if err := enableMonitoring(spec.MemoryOnly, logger); err != nil { + return nil, err + } + } else { + if err := enableMonitoring(launchSpec.MonitoringEnabled, logger); err != nil { + return nil, err + } } logger.Info(fmt.Sprintf("Launch Policy : %+v\n", launchPolicy)) diff --git a/launcher/internal/experiments/experiments.go b/launcher/internal/experiments/experiments.go index 6547b0f5..c7ef10d4 100644 --- a/launcher/internal/experiments/experiments.go +++ b/launcher/internal/experiments/experiments.go @@ -13,6 +13,7 @@ import ( type Experiments struct { EnableTestFeatureForImage bool EnableTempFSMount bool + EnableHealthMonitoring bool } // New takes a filepath, opens the file, and calls ReadJsonInput with the contents From c96077cb888f201dd09bcaad2aeff10455749ace Mon Sep 17 00:00:00 2001 From: Jessie Liu Date: Tue, 7 Jan 2025 19:11:03 +0000 Subject: [PATCH 2/2] fix log comment --- launcher/container_runner.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launcher/container_runner.go b/launcher/container_runner.go index 6042c5f1..ba380b1c 100644 --- a/launcher/container_runner.go +++ b/launcher/container_runner.go @@ -130,7 +130,7 @@ func NewRunner(ctx context.Context, cdClient *containerd.Client, token oauth2.To } if launchSpec.MonitoringEnabled == spec.All && !launchSpec.Experiments.EnableHealthMonitoring { - logger.Info("Health monitoring experiment is not enabled - falling back to memory-only.") + logger.Info("Health Monitoring experiment is not enabled - falling back to memory-only.") if err := enableMonitoring(spec.MemoryOnly, logger); err != nil { return nil, err }