File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed
Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -189,8 +189,8 @@ def test_minus_D_cat(self):
189189 self .assertIn ('Content-Length: 0' , request_fields_str )
190190 self .assertRegex (
191191 request_fields_str ,
192- 'User-Agent: .*gsutil/%s.*interactive/False command/cat' %
193- gslib .VERSION )
192+ 'User-Agent: .*gsutil/%s.*interactive/False invocation-id/[a-z0-9-].+ command/cat'
193+ % gslib .VERSION )
194194 elif self .test_api == ApiSelector .JSON :
195195 if six .PY2 :
196196 self .assertIn ("md5Hash: u'eB5eJF1ptWaXm4bijSPyxw=='" , stderr )
@@ -203,8 +203,9 @@ def test_minus_D_cat(self):
203203 stderr ,
204204 '.*GET.*b/%s/o/%s' % (key_uri .bucket_name , key_uri .object_name ))
205205 self .assertRegex (
206- stderr , 'Python/%s.gsutil/%s.*interactive/False command/cat' %
207- (platform .python_version (), gslib .VERSION ))
206+ stderr ,
207+ 'Python/%s.gsutil/%s.*interactive/False invocation-id/[a-z0-9-].+ command/cat'
208+ % (platform .python_version (), gslib .VERSION ))
208209
209210 if gslib .IS_PACKAGE_INSTALL :
210211 self .assertIn ('PACKAGED_GSUTIL_INSTALLS_DO_NOT_HAVE_CHECKSUMS' , stdout )
Original file line number Diff line number Diff line change 1616
1717import six
1818import sys
19+ import uuid
1920import gslib
2021from gslib .utils import system_util
2122from gslib .storage_url import StorageUrlFromString
@@ -36,6 +37,7 @@ def GetUserAgent(args, metrics_off=True):
3637 user_agent += ' (%s)' % sys .platform
3738 user_agent += ' analytics/%s' % ('disabled' if metrics_off else 'enabled' )
3839 user_agent += ' interactive/%s' % system_util .IsRunningInteractively ()
40+ user_agent += ' invocation-id/%s' % uuid .uuid4 ().hex
3941
4042 if len (args ) > 0 :
4143 user_agent += ' command/%s' % args [0 ]
You can’t perform that action at this time.
0 commit comments