Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial draft for sending skaffold metrics using metadata event #3966

Merged
merged 6 commits into from Apr 23, 2020

Conversation

tejal29
Copy link
Member

@tejal29 tejal29 commented Apr 17, 2020

Fixes: #3967
Related: Relevant tracking issues, for context
Merge before/after: Dependent or prerequisite PRs

Description

In this Pr,

  1. Added a Skaffold Metadata proto
    • This proto contains Build, Deploy metadata like number of artifacts, builders and deployers used etc.
    • an additional kay value pair to stick any data required for analysis. (This is an experimental section and will be moved to a first class field

User facing changes (remove if N/A)
No.
For IDEs, Ides will now see skaffold metadata in MetaEvent

{"result":{"timestamp":"2020-04-17T18:22:46.325297Z","
event":{"metaEvent":{"entry":"Starting Skaffold: \u0026{Version:v1.6.0-82-gbfe9b97e4-dirty ConfigVersion:skaffold/v2beta2 GitVersion: GitCommit:bfe9b97e4ced1fb91e9cb768b49879a63202eaec GitTreeState:dirty BuildDate:2020-04-17T11:21:55Z GoVersion:go1.14.1 Compiler:gc Platform:darwin/amd64}","
metadata":{
  "build":{"numberOfArtifacts":1,"builders":[{"type":"DOCKER","count":1}],"type":"LOCAL"},
  "deploy":{"deployers":[{"type":"KUBECTL","count":1}],"cluster":"GKE"}}}}}}

Follow-up Work (remove if N/A)
yes! Will add unit tests.

@codecov
Copy link

codecov bot commented Apr 17, 2020

Codecov Report

❗ No coverage uploaded for pull request base (master@f70a96c). Click here to learn what that means.
The diff coverage is 92.77%.

Impacted Files Coverage Δ
cmd/skaffold/app/cmd/cmd.go 68.21% <ø> (ø)
pkg/skaffold/event/util.go 91.17% <91.17%> (ø)
pkg/skaffold/event/event.go 93.13% <100.00%> (ø)
pkg/skaffold/runner/new.go 70.00% <100.00%> (ø)
pkg/skaffold/deploy/helm.go 79.12% <0.00%> (ø)
pkg/skaffold/test/structure/structure.go 100.00% <0.00%> (ø)
pkg/skaffold/runner/runner.go 0.00% <0.00%> (ø)
pkg/skaffold/build/build.go 0.00% <0.00%> (ø)
pkg/skaffold/build/buildpacks/metadata.go 100.00% <0.00%> (ø)
pkg/skaffold/runner/cleanup.go 0.00% <0.00%> (ø)
... and 293 more

@tejal29 tejal29 force-pushed the add_metadata branch 2 times, most recently from 0ec0025 to aefa9e2 Compare April 17, 2020 21:26
Copy link
Contributor

@nkubala nkubala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like a good starting point! i suspect we'll want to add more information to these events but that can come later.

pkg/skaffold/event/event.go Outdated Show resolved Hide resolved
pkg/skaffold/event/event.go Outdated Show resolved Hide resolved
proto/skaffold.proto Outdated Show resolved Hide resolved
proto/skaffold.proto Outdated Show resolved Hide resolved
proto/skaffold.proto Outdated Show resolved Hide resolved
pkg/skaffold/event/event.go Show resolved Hide resolved
KUBECTL = 3;
}

enum ClusterType {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like we might want to list out some of the other common k8s cluster providers here. otherwise users are going to see "Cluster Type: Other" which doesn't seem that useful?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so for Privacy concerns, we can't make a distinction which "Other" or competitor cloud provider service users are using :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we differentiate with other opensource distributions? (k3d, microk8s, ...?)

pkg/skaffold/event/util.go Show resolved Hide resolved
@tejal29
Copy link
Member Author

tejal29 commented Apr 22, 2020

suspect we'll want to add more information to these events but that can come later.

yes. I am thinking of adding those as we see appropriate later in the free "key/value" map. Also, note for every field we add, we need to go trough approval process. For now, these should be apt for metrics we are interested in short term.

@tejal29 tejal29 closed this Apr 23, 2020
@tejal29 tejal29 reopened this Apr 23, 2020
Copy link
Member

@briandealwis briandealwis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. But do we also want to record the build command (dev, debug, build, deploy)?

"github.com/GoogleContainerTools/skaffold/proto"
)

func initializeMetadata(p latest.Pipeline, kubeContext string) *proto.Metadata {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WDYT of including a hash of the pipeline? That would let us tell if the user re-ran or if they made a change.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh this is an interesting idea. you could even just translate that to a isPipelineChange boolean or something.

Deployers: []*proto.DeployMetadata_Deployer{{Type: proto.DeployerType_KUSTOMIZE, Count: 1}},
},
},
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth adding a no-builders no-deployers case?

KUBECTL = 3;
}

enum ClusterType {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we differentiate with other opensource distributions? (k3d, microk8s, ...?)

@tejal29
Copy link
Member Author

tejal29 commented Apr 23, 2020

LGTM. But do we also want to record the build command (dev, debug, build, deploy)?

no. The IDEs will provide invokation details. MetaEvent will only provide information on Skaffold Pipeline Metadata.

@tejal29 tejal29 dismissed nkubala’s stale review April 23, 2020 18:43

addressed changes!

Copy link
Contributor

@nkubala nkubala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I think @briandealwis had some good ideas for enhancements though. those can come in follow up PRs though

Copy link
Contributor

@balopat balopat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to provide proper notices for anything metrics related

@tejal29 tejal29 merged commit eab0d15 into GoogleContainerTools:master Apr 23, 2020
@tejal29 tejal29 deleted the add_metadata branch April 15, 2021 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants