-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
feat(influx): extend CLI with versoin and user-agent #18344
Conversation
f44e345
to
3aa8f1c
Compare
var ( | ||
version = "dev" | ||
commit = "none" | ||
date = time.Now().UTC().Format(time.RFC3339) |
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.
Fly-by comment: this isn't the build date (as noted in the PR description); it's the time that the influx
process was started.
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.
you're right. I borrowed this from the influxd binary here:
https://github.com/influxdata/influxdb/blob/master/cmd/influxd/main.go#L27
just noticed I dont' have the fmt.Sprintf
, but that shouldn't matter yah?
It looks like the date isn't provided as an LD flag either, so that definitely can change 🤔. What do you think is the best way forward here?
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.
Agreed the fmt.Sprint
isn't necessary; time.Format
already returns a string.
I think setting the date at link time is the correct approach.
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.
Looks like we do set the date as a linker flag in goreleaser after all:
Line 19 in d21fce5
ldflags: -s -w -X main.version={{.Version}} -X main.commit={{.ShortCommit}} -X main.date={{.Date}} |
influxdb/.goreleaser-nightly.yml
Line 19 in d21fce5
ldflags: -s -w -X main.version={{.Version}} -X main.commit={{.ShortCommit}} -X main.date={{.Date}} |
Any tooling we have to inspect the resulting date would know that version == "dev"
indicates the date would be meaningless.
Nothing to change here after all.
Closes: #18336
Closes: #14821
Acceptance Criteria
User-Agent
headerUser-Agent
header should look likeUser-Agent: influx/$VERSION (<system-information>) Sha/$SHA Date/$BUILD_DATE