Set the OS name in the metrics protobuf file

There are cases where the developer is not building a product so
the metadata information is not being set. For now, set the OS
name so we can track which OS the user is using it.

Fixes: b/163118212
Test: m nothing and checked the blueprint
Change-Id: I9b521eee2d266b50625aa8e916ddaacb4e2feaea
Merged-In: I9b521eee2d266b50625aa8e916ddaacb4e2feaea
This commit is contained in:
Patrice Arruda 2020-08-07 17:55:23 +00:00
parent f53a655b75
commit 55b5e42581
1 changed files with 2 additions and 2 deletions

View File

@ -17,6 +17,7 @@ package metrics
import ( import (
"io/ioutil" "io/ioutil"
"os" "os"
"runtime"
"time" "time"
"android/soong/ui/metrics/metrics_proto" "android/soong/ui/metrics/metrics_proto"
@ -94,8 +95,6 @@ func (m *Metrics) SetMetadataMetrics(metadata map[string]string) {
m.metrics.HostArch = m.getArch(v) m.metrics.HostArch = m.getArch(v)
case "HOST_2ND_ARCH": case "HOST_2ND_ARCH":
m.metrics.Host_2NdArch = m.getArch(v) m.metrics.Host_2NdArch = m.getArch(v)
case "HOST_OS":
m.metrics.HostOs = proto.String(v)
case "HOST_OS_EXTRA": case "HOST_OS_EXTRA":
m.metrics.HostOsExtra = proto.String(v) m.metrics.HostOsExtra = proto.String(v)
case "HOST_CROSS_OS": case "HOST_CROSS_OS":
@ -137,6 +136,7 @@ func (m *Metrics) Serialize() (data []byte, err error) {
// exports the output to the file at outputPath // exports the output to the file at outputPath
func (m *Metrics) Dump(outputPath string) (err error) { func (m *Metrics) Dump(outputPath string) (err error) {
m.metrics.HostOs = proto.String(runtime.GOOS)
data, err := m.Serialize() data, err := m.Serialize()
if err != nil { if err != nil {
return err return err