From 17da5c79cf9e9ccdff6566983cb892ec10a35fb9 Mon Sep 17 00:00:00 2001 From: Isaac Duarte Date: Thu, 4 Feb 2021 15:42:52 -0500 Subject: [PATCH] track the platform type at the launch level --- pkg/skaffold/instrumentation/export.go | 1 + pkg/skaffold/instrumentation/export_test.go | 5 ++++- pkg/skaffold/instrumentation/types.go | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/skaffold/instrumentation/export.go b/pkg/skaffold/instrumentation/export.go index 244952957d3..94531e509bb 100644 --- a/pkg/skaffold/instrumentation/export.go +++ b/pkg/skaffold/instrumentation/export.go @@ -150,6 +150,7 @@ func createMetrics(ctx context.Context, meter skaffoldMeter) { label.String("arch", meter.Arch), label.String("command", meter.Command), label.String("error", strconv.Itoa(int(meter.ErrorCode))), + label.String("platform_type", meter.PlatformType), randLabel, } diff --git a/pkg/skaffold/instrumentation/export_test.go b/pkg/skaffold/instrumentation/export_test.go index de2a24f3c7c..84168b79070 100644 --- a/pkg/skaffold/instrumentation/export_test.go +++ b/pkg/skaffold/instrumentation/export_test.go @@ -230,9 +230,10 @@ func checkOutput(t *testutil.T, meters []skaffoldMeter, b []byte) { devIterations := make(map[interface{}]int) deployers := make(map[interface{}]int) enumFlags := make(map[interface{}]int) + platform := make(map[interface{}]int) testMaps := []map[interface{}]int{ - osCount, versionCount, archCount, durationCount, commandCount, errorCount, builders, devIterations, deployers} + platform, osCount, versionCount, archCount, durationCount, commandCount, errorCount, builders, devIterations, deployers} for _, meter := range meters { osCount[meter.OS]++ @@ -241,6 +242,7 @@ func checkOutput(t *testutil.T, meters []skaffoldMeter, b []byte) { archCount[meter.Arch]++ commandCount[meter.Command]++ errorCount[meter.ErrorCode]++ + platform[meter.PlatformType]++ for k, v := range meter.EnumFlags { n := FlagsPrefix + strings.ReplaceAll(k, "-", "_") @@ -277,6 +279,7 @@ func checkOutput(t *testutil.T, meters []skaffoldMeter, b []byte) { archCount[l.Labels["arch"]]-- osCount[l.Labels["os"]]-- versionCount[l.Labels["version"]]-- + platform[l.Labels["platform_type"]]-- e, _ := strconv.Atoi(l.Labels["error"]) if e == int(proto.StatusCode_OK) { errorCount[proto.StatusCode(e)]-- diff --git a/pkg/skaffold/instrumentation/types.go b/pkg/skaffold/instrumentation/types.go index 200682b9462..00f137e3fff 100644 --- a/pkg/skaffold/instrumentation/types.go +++ b/pkg/skaffold/instrumentation/types.go @@ -45,7 +45,7 @@ type skaffoldMeter struct { // Arch Architecture running Skaffold e.g. amd64, arm64, etc. Arch string - // PlatformType Where Skaffold is deploying to (sync, build, or Google Cloud Build). + // PlatformType Where Skaffold is deploying to (local, cluster, or Google Cloud Build). PlatformType string // Deployers All the deployers used in the Skaffold execution.