Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(232)

Unified Diff: cipd/client/cipd/client.go

Issue 2542513002: Add package and instance id to CIPD user agent. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cipd/client/cipd/client.go
diff --git a/cipd/client/cipd/client.go b/cipd/client/cipd/client.go
index 53bc31ad3efb18ef453457f29364c06d4a88164f..0d73e8d01b506696b8316749d8042eca098f43d1 100644
--- a/cipd/client/cipd/client.go
+++ b/cipd/client/cipd/client.go
@@ -74,9 +74,6 @@ const (
// TagAttachTimeout is how long to wait for an instance to be processed when attaching tags.
TagAttachTimeout = 3 * time.Minute
- // UserAgent is HTTP user agent string for CIPD client.
- UserAgent = "cipd 1.3"
-
// ServiceURL is URL of a backend to connect to by default.
ServiceURL = "https://chrome-infra-packages.appspot.com"
)
@@ -110,6 +107,19 @@ var (
ErrPackageNotFound = errors.New("no such package")
)
+var (
+ // UserAgent is HTTP user agent string for CIPD client.
+ UserAgent = "cipd 1.3"
+)
+
+func init() {
+ ver, err := version.GetStartupVersion()
+ if err != nil {
+ return
+ }
+ UserAgent += fmt.Sprintf(" (%s@%s)", ver.PackageName, ver.InstanceID)
+}
+
// UnixTime is time.Time that serializes to unix timestamp in JSON (represented
// as a number of seconds since January 1, 1970 UTC).
type UnixTime time.Time
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698