-
Notifications
You must be signed in to change notification settings - Fork 64
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
Add event publishing to kne_cli and controller server #393
Conversation
Pull Request Test Coverage Report for Build 5471004216
💛 - Coveralls |
Now all of the functionality is in place, cmd line flags can now be supplied with a config file using viper:
This example sets the default values of the
|
Next step is to break into 3 PRs:
|
need to merge from main after #396 is merged |
/gcbrun |
deploy/deploy.go
Outdated
func (d *Deployment) Deploy(ctx context.Context, kubecfg string) (rerr error) { | ||
if d.ReportUsage { | ||
r, err := metrics.NewReporter(ctx, d.ReportUsageProjectID, d.ReportUsageTopicID) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put the entire thing in a method so you can say:
// reportUsage returns a function to defer by the caller.
//
// if d.ReportUsage {
// finish = d.reportUsage(ctx)
// defer finish(rerr)
// }
func (d *Deployment) reportUsage(ctx context.Context) func(error) {
r, err := metrics.NewReporter(ctx, d.ReportUsageProjectID, d.ReportUsageTopicID)
if err != nil {
log.Warningf("Unable to create metrics reporter: %v", err)
return func(_ error) {}
}
if id, err := r.ReportDeployClusterStart(ctx, d.event()); err != nil {
log.Warningf("Unable to report cluster deployment start event: %v", err)
return func(_ error) { r.Close() }
}
return func(rerr error) {
if err := r.ReportDeployClusterEnd(ctx, id, rerr); err != nil {
log.Warningf("Unable to report cluster deployment end event: %v", err)
}
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
/gcbrun |
/gcbrun |
/gcbrun |
* Add viper to read kne config * Add config file + pubsub reporting * Switch cli flag reading to use viper * fix unit test * fmt * Controller server can report usage * Fix unit tests for progress option * update deploy and topo libs * Use new metrics pkg * add unit test * Add section of readme explaining usage metrics reporting * Refactor to address comments * fix typo * update readme
No description provided.