Skip to content

Commit 0e40e41

Browse files
authored
Merge pull request #5 from sourceplusplus/live-meter
various fixes
2 parents 1a2e055 + 722f1a7 commit 0e40e41

File tree

6 files changed

+24
-11
lines changed

6 files changed

+24
-11
lines changed

build.gradle.kts

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ python {
1010

1111
tasks {
1212
register<Exec>("buildDist") {
13-
commandLine("sh", "-c", "python setup.py sdist")
13+
executable = "python3"
14+
args("setup.py", "sdist")
1415
}
1516

1617
register<Copy>("updateDockerFiles") {

e2e/Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ RUN pip install Flask
66
RUN pip install PyYAML
77
RUN pip install vertx-eventbus-client
88

9-
COPY sourceplusplus-0.1.3.tar.gz .
9+
COPY sourceplusplus-0.1.4.tar.gz .
1010

11-
RUN pip install sourceplusplus-0.1.3.tar.gz
11+
RUN pip install sourceplusplus-0.1.4.tar.gz
1212

1313
COPY E2ETest.py .
1414

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from setuptools import setup
33

44
setup(name='sourceplusplus',
5-
version='0.1.3',
5+
version='0.1.4',
66
description='Source++ Python Probe',
77
url='https://github.com/sourceplusplus/probe-python',
88
author='Source++',

sourceplusplus/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
__version__ = '0.1.3'
1+
__version__ = '0.1.4'
22
__name__ = 'Source++'
33
agent_name = 'Source++ Python Probe'

sourceplusplus/control/ContextReceiver.py

+17-5
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
@@ -90,6 +91,9 @@ def apply_log(live_log_id, globals, locals):
9091

9192

9293
def apply_breakpoint(live_breakpoint_id, globals, locals):
94+
globals.pop("SourcePlusPlus", None)
95+
locals.pop("ContextReceiver", None)
96+
9397
live_breakpoint: LiveBreakpoint = LiveInstrumentRemote.instruments[live_breakpoint_id][1]
9498
if live_breakpoint.throttle.is_rate_limited():
9599
return
@@ -100,12 +104,20 @@ def apply_breakpoint(live_breakpoint_id, globals, locals):
100104
context: SpanContext = get_context()
101105

102106
with context.new_local_span(op=operation) as span:
103-
for key in locals:
104-
var = try_find(key, globals, locals)
107+
for key, value in globals.items():
108+
tag = StringTag(json.dumps({
109+
key: str(value), # todo: don't str everything
110+
"@class": str(type(value)),
111+
"@identity": id(value)
112+
}))
113+
tag.key = "spp.global-variable:" + live_breakpoint.id + ":" + key
114+
span.tag(tag)
115+
116+
for key, value in locals.items():
105117
tag = StringTag(json.dumps({
106-
key: str(var), # todo: don't str everything
107-
"@class": str(type(var)),
108-
"@identity": id(var)
118+
key: str(value), # todo: don't str everything
119+
"@class": str(type(value)),
120+
"@identity": id(value)
109121
}))
110122
tag.key = "spp.local-variable:" + live_breakpoint.id + ":" + key
111123
span.tag(tag)

sourceplusplus/control/LiveInstrumentRemote.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def add_live_instrument(self, context: LiveInstrumentContext, instrument_type: L
3434
else:
3535
live_instrument = LiveMeter.from_json(i)
3636
bp = LiveInstrumentRemote.dbg.breakpoint(
37-
file=live_instrument.location.source,
37+
file=live_instrument.location.source[live_instrument.location.source.rfind("/") + 1:],
3838
line=live_instrument.location.line
3939
)
4040
LiveInstrumentRemote.instruments[live_instrument.id] = [bp, live_instrument]

0 commit comments

Comments
 (0)