Question of the span decorator
See original GitHub issueHi, I am confused with this code, why context.with
use context.active
?
In my opinion it will cause parentSpan
always be the rootSpan
without context.with
in the code.
const currentSpan = trace.getSpan(context.active());
const tracer = trace.getTracer('default')
return context.with(trace.setSpan(context.active(), currentSpan), () => {
// ...
});
I think it should be
const tracer = trace.getTracer('default')
const span = tracer.startSpan(
name || `${target.constructor.name}.${propertyKey}`,
);
return context.with(trace.setSpan(context.active(), span), () => {
// ...
});
For example
class Test {
@Span()
f1() {
// ...
}
@Span()
f2() {
this.f1();
}
}
current Span
decorator won’t let f1
be the child of f2
Thanks for your help.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Would be helpful to have function decorators for transactions ...
The current context managers for starting transactions and marking spans are great. However, there have been a few cases where having decorators for ......
Read more >Zend Framework Zend_Form Decorators: <span> Inside ...
I have tried and, ultimately, failed to achieve this myself using the same approach. It would seem that the easiest way to do...
Read more >TV or Not TV? It's Not Even an Honest Decorating Question ...
Judging from the typical shelter magazine or decorating book, you'd think the lucky few who occupy those to-die-for homes never watch TV.
Read more >box-decoration-break - CSS: Cascading Style Sheets | MDN
The box-decoration-break CSS property specifies how an element's fragments should be rendered when broken across multiple lines, columns, ...
Read more >Question modifiers - Docassemble
The decoration modifier adds an icon to the right of the question text. In the example above, kids has been defined in an...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Howdy! I will take a look at it today, sorry about the delay!
@pragmaticivan i cant say if it only happens when not using controllers, but in my case yes.
It’s not called by “rest” or “graphql” but it’s part of AWS SQS in our case. So there is no instrumentation from controllers, but there is instrumentation by the aws-sdk (the first two spans on my previous comment with image).