Add an additional keyword arg to RedisInstrumentor.intrument to ignore root spans 🌈 🙏
Hello everyone, I'm new to the OTEL community (and python 🌈 ( and writing github issues)).
I've been trying to instrument a python app with the RedisInstrumentor.
I have an issue with noisy redis spans in my collector. Ideally, I don't want to collect any spans without a parent_id attached.
It would be neat to be able to pass an additional keyword arg (something along the lines of trace_root_span) so that when the instrument method is called, it breaks out early and does not process any span where span.parent is None.
eg: RedisInstrumentor().instrument(request_hook=request_hook, response_hook=response_hook, trace_root_span: false)
I saw this neat configuration option in the ruby redis instrumentation which ignores spans without a parent id.
I thought I would be able to use the response_hook to ignore spans without a parent but I still saw spans in my collector as the response is returned here.
Additional context I may be missing something obvious and happy to close the issue (or try open a PR) if there is a way to do this via a response_hook 👍
Hello, welcome! We are always happy to have new people in our community :slightly_smiling_face:
If you feel like opening a PR, go ahead! This issue makes me wonder if we should have this as a feature for all instrumentations :thinking: