I am using a io.opentracing.Span to add tracing to a service.
Inside one of the more nested functions, I want to access information that has already been added to the span using span.setTag(key:String, value:String) by the rest of the setup. When debugging one test case, I can see the span's tags attribute, which contains all infos I require.
So far I have looked for functions and attributes that Span provides, but have found nothing that allows me read access to those tags values.
Is there a way to get tag values?
The Span is an interface and it does not include getting the tags unfortunately (I also wanted to check they are set correctly elsewhere in the code).
I saw in my case the implementation was an OTSpan (from Open Tracing) but I couldn't cast to it.
The only solution I could think of so far was to enumerate the fields of the implementation object with reflection and read the respective field value (don't forget to allow access to a private field). The exact field name could vary between implementations.