Skip to content

Commit

Permalink
track the platform type at the launch level
Browse files Browse the repository at this point in the history
  • Loading branch information
IsaacPD committed Feb 4, 2021
1 parent 719d74f commit 17da5c7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions pkg/skaffold/instrumentation/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}

Expand Down
5 changes: 4 additions & 1 deletion pkg/skaffold/instrumentation/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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]++
Expand All @@ -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, "-", "_")
Expand Down Expand Up @@ -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)]--
Expand Down
2 changes: 1 addition & 1 deletion pkg/skaffold/instrumentation/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 17da5c7

Please sign in to comment.