Include client identity in OTel traces
If a client isn't emitting telemetry, the traces from the device server will show a call, but we won't know where it came from. Tango knows the client identity, so include this in device traces, when available.
New span attributes:
-
tango.client_ident.location(Theclient_ipfield) tango.client_ident.pidtango.client_ident.langtango.client_ident.java_main_classtango.client_ident.java_ident
The client_ip field can be quite a range of things:
giop:tcp:127.0.0.1:59938giop:unix:/tmp/omni-user/000064413-1747007653giop:tcp:[2001:2013:2e1a:a200:80a:e436:a21c:01e9]:59190collocated client (c++ to c++ call)
Notes:
- Individual fields are put into span attributes to simplify searching.
- We extract the PID from Java class info.
The Java UUID fields are not included, as they aren't that useful. The string format of client_ident already omits this information.- The
get_client_identmethod can crash if called from a non-omnithread. We check this, and also update DeviceTestContext to use an omnithread. - Related to the previous point, the identity information isn't available in user handlers for Asyncio and Gevent green mode device servers - test updated to check this. However, the telemetry trace wrapper is called before adding the call to the event loop, so it can record this information.
- Fixed old API calls in
prototyping.py.
A better place to do this is in cppTango, so once it is implemented there we can remove it from PyTango.
Edited by Anton Joubert