diff --git a/build.gradle.kts b/build.gradle.kts index 0a6a715..1adac2b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -10,7 +10,8 @@ python { tasks { register("buildDist") { - commandLine("sh", "-c", "python setup.py sdist") + executable = "python3" + args("setup.py", "sdist") } register("updateDockerFiles") { diff --git a/e2e/Dockerfile b/e2e/Dockerfile index bd15748..cd8efce 100644 --- a/e2e/Dockerfile +++ b/e2e/Dockerfile @@ -6,9 +6,9 @@ RUN pip install Flask RUN pip install PyYAML RUN pip install vertx-eventbus-client -COPY sourceplusplus-0.1.3.tar.gz . +COPY sourceplusplus-0.1.4.tar.gz . -RUN pip install sourceplusplus-0.1.3.tar.gz +RUN pip install sourceplusplus-0.1.4.tar.gz COPY E2ETest.py . diff --git a/setup.py b/setup.py index a8629f4..f9d5498 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup setup(name='sourceplusplus', - version='0.1.3', + version='0.1.4', description='Source++ Python Probe', url='https://github.com/sourceplusplus/probe-python', author='Source++', diff --git a/sourceplusplus/__init__.py b/sourceplusplus/__init__.py index 8a3c2fa..d441b7c 100644 --- a/sourceplusplus/__init__.py +++ b/sourceplusplus/__init__.py @@ -1,3 +1,3 @@ -__version__ = '0.1.3' +__version__ = '0.1.4' __name__ = 'Source++' agent_name = 'Source++ Python Probe' diff --git a/sourceplusplus/control/ContextReceiver.py b/sourceplusplus/control/ContextReceiver.py index 78ea715..b020ea6 100644 --- a/sourceplusplus/control/ContextReceiver.py +++ b/sourceplusplus/control/ContextReceiver.py @@ -2,6 +2,7 @@ import threading import time import traceback + from skywalking import config, agent from skywalking.protocol.common.Common_pb2 import KeyStringValuePair from skywalking.protocol.logging.Logging_pb2 import LogData, LogDataBody, TextLog, TraceContext, LogTags @@ -90,6 +91,9 @@ def apply_log(live_log_id, globals, locals): def apply_breakpoint(live_breakpoint_id, globals, locals): + globals.pop("SourcePlusPlus", None) + locals.pop("ContextReceiver", None) + live_breakpoint: LiveBreakpoint = LiveInstrumentRemote.instruments[live_breakpoint_id][1] if live_breakpoint.throttle.is_rate_limited(): return @@ -100,12 +104,20 @@ def apply_breakpoint(live_breakpoint_id, globals, locals): context: SpanContext = get_context() with context.new_local_span(op=operation) as span: - for key in locals: - var = try_find(key, globals, locals) + for key, value in globals.items(): + tag = StringTag(json.dumps({ + key: str(value), # todo: don't str everything + "@class": str(type(value)), + "@identity": id(value) + })) + tag.key = "spp.global-variable:" + live_breakpoint.id + ":" + key + span.tag(tag) + + for key, value in locals.items(): tag = StringTag(json.dumps({ - key: str(var), # todo: don't str everything - "@class": str(type(var)), - "@identity": id(var) + key: str(value), # todo: don't str everything + "@class": str(type(value)), + "@identity": id(value) })) tag.key = "spp.local-variable:" + live_breakpoint.id + ":" + key span.tag(tag) diff --git a/sourceplusplus/control/LiveInstrumentRemote.py b/sourceplusplus/control/LiveInstrumentRemote.py index 5d3d740..0003d8c 100644 --- a/sourceplusplus/control/LiveInstrumentRemote.py +++ b/sourceplusplus/control/LiveInstrumentRemote.py @@ -34,7 +34,7 @@ def add_live_instrument(self, context: LiveInstrumentContext, instrument_type: L else: live_instrument = LiveMeter.from_json(i) bp = LiveInstrumentRemote.dbg.breakpoint( - file=live_instrument.location.source, + file=live_instrument.location.source[live_instrument.location.source.rfind("/") + 1:], line=live_instrument.location.line ) LiveInstrumentRemote.instruments[live_instrument.id] = [bp, live_instrument]