-
Notifications
You must be signed in to change notification settings - Fork 411
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
chore: span origin #9012
chore: span origin #9012
Conversation
ebdadbc
to
5a46550
Compare
2e42c8d
to
c126b7b
Compare
49ca44c
to
d0eca01
Compare
d0eca01
to
905177a
Compare
a37045d
to
1b3ac5d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good
@@ -22,3 +22,17 @@ class SpanKind(object): | |||
SERVER = "server" | |||
PRODUCER = "producer" | |||
CONSUMER = "consumer" | |||
|
|||
|
|||
EXIT_SPAN_TYPES = frozenset( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is that a complete list? what is the plan on how to maintain this list?
# the stack that belongs to user code. | ||
# TODO: Add a limit to the number of frames to capture | ||
seq = count(1) | ||
for frame in frame_stack(sys._getframe(1)): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did we decided to add the entire stack for exit spans?
if so, then how do we deal the frame numbering? currently is running numbers of user-code frames. but if we also report the entire stack, maybe those should match the frame depth?
ddtrace/debugging/_origin/span.py
Outdated
|
||
root = ddtrace.tracer.current_root_span() | ||
location = self.location | ||
if root is None or root.get_tag("_dd.entry_location.file") is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
java impl does something different, it add the tags to both the current active span and root span. not sure if we want to align that logic or not.
ddtrace/debugging/_origin/span.py
Outdated
root.set_tag_str("_dd.entry_location.type", location.module) | ||
root.set_tag_str("_dd.entry_location.method", location.name) | ||
|
||
if config._trace_span_origin_enriched: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why we take snapshot at entry and not on exit? I think it better to snapshot exit with locals and return values?
do we capture locals at the moment or just return here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
second, I think we also need to look at _dd.p.debug flag for the enriched snapshots.
ddtrace/debugging/_origin/span.py
Outdated
if is_user_code(frame_origin): | ||
print(frame_origin, "is user code") | ||
n = next(seq) | ||
span.set_tag_str(f"_dd.ld.code_origin.frames.{n}.file", str(frame_origin.resolve())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we have method/type information here as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, unless we query the garbage collector, which is expensive :(
994346e
to
169656b
Compare
Checklist
changelog/no-changelog
is set@DataDog/apm-tees
.Reviewer Checklist