From ed4bee544e7983093b61f15630d79da4a2456a16 Mon Sep 17 00:00:00 2001 From: Etienne Perot Date: Tue, 21 Feb 2023 16:39:43 -0800 Subject: [PATCH] Add more per-sandbox metadata fields. This includes important configuration dimensions, as well as performance-sensitive characteristics of the host it is running on. PiperOrigin-RevId: 511338632 --- runsc/config/config.go | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/runsc/config/config.go b/runsc/config/config.go index d28ecba7d..90e16844a 100644 --- a/runsc/config/config.go +++ b/runsc/config/config.go @@ -20,6 +20,7 @@ package config import ( "fmt" "path/filepath" + "runtime" "strconv" "strings" "time" @@ -373,11 +374,15 @@ type BundleName string // MetricMetadata returns key-value pairs that are useful to include in metrics // exported about the sandbox this config represents. func (c *Config) MetricMetadata() map[string]string { - metadata := make(map[string]string) - metadata["platform"] = c.Platform - metadata["network"] = c.Network.String() - metadata["coretags"] = strconv.FormatBool(c.EnableCoreTags) - return metadata + return map[string]string{ + "platform": c.Platform, + "network": c.Network.String(), + "numcores": strconv.Itoa(runtime.NumCPU()), + "coretags": strconv.FormatBool(c.EnableCoreTags), + "overlay": c.Overlay2.String(), + "gofermode": "default", + "cpuarch": runtime.GOARCH, + } } // FileAccessType tells how the filesystem is accessed.