-
Notifications
You must be signed in to change notification settings - Fork 184
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
[devbox] Add anonymized telemetry #40
Conversation
12977c2
to
c86b0f2
Compare
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.
I just want to make sure we're not prematurely architecting things with the middleware. It's a little tricky to follow as opposed to something like:
t := tracker.Track(...)
defer t.done()
// run the cobra stuff
boxcli/midcobra/telemetry.go
Outdated
|
||
return &telemetryMiddleware{ | ||
opts: *opts, | ||
disabled: noTrackEnvVar == "1" || noTrackEnvVar == "true" || opts.TelemetryKey == "", |
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.
strconv.ParseBool
will catch all the usual values.
@@ -10,6 +10,7 @@ builds: | |||
- -s -w -X go.jetpack.io/devbox/build.Version={{.Version}} | |||
- -s -w -X go.jetpack.io/devbox/build.Commit={{.Commit}} | |||
- -s -w -X go.jetpack.io/devbox/build.CommitDate={{.CommitDate}} | |||
- -s -w -X go.jetpack.io/devbox/build.TelemetryKey={{ .Env.TELEMETRY_KEY }} |
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.
Does this actually need to be kept secret? It'll still be visible in the binary. Can we just put it in a const instead of a linker flag?
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.
I'm gonna leave as is for this PR since it's already working, but we can hard-code it in a follow up clean up.
I'm open either way, last time I asked on Slack, folks leaned towards hiding this, so that's why I implemented this way.
Summary
Add anonymized telemetry to understand usage of devbox and further improve it. We allow users to opt-out via an environment variable.
To add telemetry I implemented a small "midcobra" framework, that make it possible to add "middlware" to cobra CLIs. The plan is to re-use the midcobra functionality in other binaries like
envsec
.How was it tested?
Built locally, ran, and checked telemetry logs.