Skip to content

Commit b279dfe

Browse files
committed
add global variables
1 parent 8c70e8c commit b279dfe

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

sourceplusplus/control/ContextReceiver.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import threading
33
import time
44
import traceback
5+
56
from skywalking import config, agent
67
from skywalking.protocol.common.Common_pb2 import KeyStringValuePair
78
from skywalking.protocol.logging.Logging_pb2 import LogData, LogDataBody, TextLog, TraceContext, LogTags
@@ -102,12 +103,20 @@ def apply_breakpoint(live_breakpoint_id, globals, locals):
102103
context: SpanContext = get_context()
103104

104105
with context.new_local_span(op=operation) as span:
105-
for key in locals:
106-
var = try_find(key, globals, locals)
106+
for key, value in globals.items():
107+
tag = StringTag(json.dumps({
108+
key: str(value), # todo: don't str everything
109+
"@class": str(type(value)),
110+
"@identity": id(value)
111+
}))
112+
tag.key = "spp.global-variable:" + live_breakpoint.id + ":" + key
113+
span.tag(tag)
114+
115+
for key, value in locals.items():
107116
tag = StringTag(json.dumps({
108-
key: str(var), # todo: don't str everything
109-
"@class": str(type(var)),
110-
"@identity": id(var)
117+
key: str(value), # todo: don't str everything
118+
"@class": str(type(value)),
119+
"@identity": id(value)
111120
}))
112121
tag.key = "spp.local-variable:" + live_breakpoint.id + ":" + key
113122
span.tag(tag)

0 commit comments

Comments
 (0)