In my experience the approach matters a lot, I recently implemented Otel with Claude Code in a medium sized ~200k loc project:
- initially it wasn't working, plenty of parent/child relationships problems like described in the post
- so I designed a thin a wrapper and used sealed classes for events instead of dynamic spans + some light documentation
It took me like a day to implement tracing on the existing codebase, and for new features it works out of the box using the documentation.
At the end of the day, leveraging typing + documentation dramatically constrains LLMs to do a better job