confusion regarding kong.tracing:active_span() API #14254
-
I have a custom plugin that has access and header_filter phase defined. Whenever I try to to get the active span using the Here's my Jaeger UI view of the trace, all the custom attributes I'm trying to add to the active_span all of those are getting added to the root span (kong). I am a bit unsure how this is supposed to work.. Is it even possible to add some custom attributes to an existing span? like e.g. (kong.access.plugin.proxy-cache). I just don't want to create some new spans to add some attributes, there'll be too many duplicates... |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 2 replies
-
From the code it seems like the tracing span is set to be the active span, but it doesn't look like from the plugin itself that span is returned, somehow it get's released to the parent span. 🤔 |
Beta Was this translation helpful? Give feedback.
-
okay, found it.... this is fixed in 3.9.0 f2adaed .... But personally it looks like could've been backported. I am currently on 3.3.1, that's a huge jump for me to 3.9.0. @samugi , does it sound okay to backport it? I can create a PR if you want... |
Beta Was this translation helpful? Give feedback.
-
@khaled4vokalz hi, thanks for opening this discussion. The commit you linked is actually something in between a fix and a change in behavior: the active_span() function was not affected as it was already working fine, however the spans were not set as active upon creation (which is allowed), and this resulted in the behavior you describe, where the only active span returned was the root span. Because of the small change in behavior, changes like this are usually not backported to avoid producing unexpected impact on users who might be relying on the existing behavior. I would recommend upgrading to the latest version of Kong in this case. |
Beta Was this translation helpful? Give feedback.
-
@samugi , But I guess what you're saying is right that, users may have already started depending on that. |
Beta Was this translation helpful? Give feedback.
-
Greetings, Count me among those that relied on |
Beta Was this translation helpful? Give feedback.
@khaled4vokalz hi, thanks for opening this discussion. The commit you linked is actually something in between a fix and a change in behavior: the active_span() function was not affected as it was already working fine, however the spans were not set as active upon creation (which is allowed), and this resulted in the behavior you describe, where the only active span returned was the root span.
Because of the small change in behavior, changes like this are usually not backported to avoid producing unexpected impact on users who might be relying on the existing behavior. I would recommend upgrading to the latest version of Kong in this case.
Let me know if you have any doubts. Thank you!