Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tags to the Service Entry Span in Middleware #4155

Open
SJrX opened this issue Mar 12, 2024 · 1 comment
Open

Add tags to the Service Entry Span in Middleware #4155

SJrX opened this issue Mar 12, 2024 · 1 comment

Comments

@SJrX
Copy link

SJrX commented Mar 12, 2024

I might just be doing things wrong but I have a restify app which has a bunch of middleware (hooks), that the tracer supports. When I add tags:

tracer.scope().active()?.addTags({
                'foo': 'bar'
              });

The tags get added to the span for the middleware. I understand this is desirable in many cases but it'd also be nice to just add some tags to the parent span (or the Service Entry Span) especially because we have many middleware where the code just happens to be the best place to grab some information. In my initial implementation I found I hunted and pecked to find certain things depending on the middleware, when really I just want to stuff a bunch of fields in one span.

For now I just turned off middleware processing but ideally I'd like to have my cake and eat it to.

@dannytranlx
Copy link

dannytranlx commented May 15, 2024

You could try tracer.scope().active().context()._trace.started[0] to accomplish what you want, but obviously it relies on internal API which could change at any moment 😄 (works in 5.2.0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants