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
This commit is contained in:
Etienne Perot
2023-02-21 16:45:00 -08:00
committed by gVisor bot
parent 87a0113a69
commit ed4bee544e
+10 -5
View File
@@ -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.