File tree Expand file tree Collapse file tree 2 files changed +11
-7
lines changed
src/clusterfuzz/_internal Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -199,7 +199,10 @@ def format_record(record: logging.LogRecord) -> str:
199199 os .getenv ('TASK_PAYLOAD' ),
200200 'name' :
201201 record .name ,
202- 'pid' : os .getpid (),
202+ 'pid' :
203+ os .getpid (),
204+ 'task_id' :
205+ os .getenv ('CF_TASK_ID' , 'null' ),
203206 }
204207
205208 initial_payload = os .getenv ('INITIAL_TASK_PAYLOAD' )
@@ -404,8 +407,6 @@ def cloud_label_filter(record):
404407 json .dumps (
405408 getattr (record , 'location' , {'Error' : True }),
406409 default = _handle_unserializable ),
407- 'task_id' :
408- os .getenv ('CF_TASK_ID' , 'null' ),
409410 })
410411 return True
411412
Original file line number Diff line number Diff line change @@ -136,11 +136,11 @@ class FormatRecordTest(unittest.TestCase):
136136 """Test format_record."""
137137
138138 def setUp (self ):
139- helpers .patch (self ,
140- [ 'clusterfuzz._internal.metrics.logs.update_entry_with_exc' ,
141- 'os.getpid' ])
139+ helpers .patch (self , [
140+ 'clusterfuzz._internal.metrics.logs.update_entry_with_exc' , 'os.getpid'
141+ ])
142142 helpers .patch_environ (self )
143-
143+ os . environ [ 'CF_TASK_ID' ] = 'job-1337'
144144 self .maxDiff = None
145145 self .mock .getpid .return_value = 1337
146146
@@ -176,6 +176,7 @@ def test_format_record(self):
176176 'fuzz_target' : 'fuzz_target1' ,
177177 'name' : 'logger_name' ,
178178 'pid' : 1337 ,
179+ 'task_id' : 'job-1337' ,
179180 'extras' : {
180181 'a' : 1 ,
181182 },
@@ -200,6 +201,7 @@ def test_no_extras(self):
200201 'bot_name' : 'linux-bot' ,
201202 'task_payload' : 'fuzz fuzzer1 job1' ,
202203 'name' : 'logger_name' ,
204+ 'task_id' : 'job-1337' ,
203205 'pid' : 1337 ,
204206 'location' : {
205207 'path' : 'path' ,
@@ -224,6 +226,7 @@ def test_worker_bot_name(self):
224226 'worker_bot_name' : 'worker' ,
225227 'task_payload' : 'fuzz fuzzer1 job1' ,
226228 'name' : 'logger_name' ,
229+ 'task_id' : 'job-1337' ,
227230 'pid' : 1337 ,
228231 'location' : {
229232 'path' : 'path' ,
You can’t perform that action at this time.
0 commit comments