File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
instrumentation/opentelemetry-instrumentation-celery/tests Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -282,3 +282,27 @@ def test_task_id_from_protocol_v2(self):
282282
283283 task_id = utils .retrieve_task_id_from_message (context )
284284 self .assertEqual (task_id , "7e917b83-4018-431d-9832-73a28e1fb6c0" )
285+
286+ def test_origin_and_hostname_attributes (self ):
287+ """Test that 'origin' and 'hostname' are distinct attributes"""
288+ # Create a mock span
289+ span = mock .Mock ()
290+ span .is_recording .return_value = True
291+
292+ # Create a context with both 'origin' and 'hostname' keys
293+ context = {
294+ "origin" : "gen8@b98c7aca4628" ,
295+ "hostname" : "celery@7c2c2cd6a5b5" ,
296+ }
297+
298+ # Call the function
299+ utils .set_attributes_from_context (span , context )
300+
301+ # Verify that both attributes were set with their original keys
302+ span .set_attribute .assert_has_calls (
303+ [
304+ mock .call ("celery.origin" , "gen8@b98c7aca4628" ),
305+ mock .call ("celery.hostname" , "celery@7c2c2cd6a5b5" ),
306+ ],
307+ any_order = True ,
308+ )
You can’t perform that action at this time.
0 commit comments