Skip to content

Commit 1bca882

Browse files
committed
Oops.
1 parent 4096d93 commit 1bca882

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Individual probes can be created directly by calling `attach_to(target)`:
2525
>>> myclass().add13(arg=5)
2626
18
2727
>>> p = diagnose.probes.attach_to("path.to.module.myclass.add13")
28-
>>> p.instruments["foo"] = diagnose.LogInstrument("foo", "arg", internal=False)
28+
>>> p.instruments["foo"] = diagnose.LogInstrument("foo", "arg")
2929
>>> p.start()
3030
>>> myclass().add13(arg=5)
3131
Probe (foo) = 5
@@ -56,7 +56,7 @@ Later, you can define instruments:
5656
"type": "log",
5757
"name": "myapp.method",
5858
"value": "result",
59-
"internal": False,
59+
"event": "return",
6060
"custom": {},
6161
},
6262
"lifespan": 10,

src/diagnose/managers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class InstrumentManager(object):
3737
* lastmodified: the datetime when the spec was last changed
3838
* lifespan: an int; the number of minutes from lastmodified before
3939
the instrument should expire.
40-
* instrument: a dict of Instrument params (type, name, value, internal, custom).
40+
* instrument: a dict of Instrument params (type, name, value, event, custom).
4141
The "expires" param is calculated from lastmodified + lifespan.
4242
* applied: a dict of {process_id: info} pairs, where "info" is a dict with:
4343
* lm: the "lastmodified" datetime of the instrument when
@@ -96,7 +96,7 @@ def _apply(self):
9696
)
9797
modified = True
9898
else:
99-
for key in ("name", "value", "internal", "custom"):
99+
for key in ("name", "value", "event", "custom"):
100100
if getattr(I, key) != doc["instrument"][key]:
101101
setattr(I, key, doc["instrument"][key])
102102
modified = True

src/diagnose/probes.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,6 @@ def probe_wrapper(*args, **kwargs):
201201
"kwargs": kwargs,
202202
"frame": sys._getframe(),
203203
}
204-
if hotspots.enabled:
205-
_locals["hotspots"] = hotspots
206204
# Add positional args to locals by name.
207205
for i, argname in enumerate(varnames[: len(args)]):
208206
_locals[argname] = args[i]
@@ -223,6 +221,7 @@ def probe_wrapper(*args, **kwargs):
223221

224222
if hotspots.enabled:
225223
hotspots.finish()
224+
_locals["hotspots"] = hotspots
226225

227226
if instruments_by_event["return"]:
228227
end = time.time()

0 commit comments

Comments
 (0)