Skip to content

Commit

Permalink
Oops.
Browse files Browse the repository at this point in the history
  • Loading branch information
aminusfu committed Jul 11, 2019
1 parent 4096d93 commit 1bca882
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Individual probes can be created directly by calling `attach_to(target)`:
>>> myclass().add13(arg=5)
18
>>> p = diagnose.probes.attach_to("path.to.module.myclass.add13")
>>> p.instruments["foo"] = diagnose.LogInstrument("foo", "arg", internal=False)
>>> p.instruments["foo"] = diagnose.LogInstrument("foo", "arg")
>>> p.start()
>>> myclass().add13(arg=5)
Probe (foo) = 5
Expand Down Expand Up @@ -56,7 +56,7 @@ Later, you can define instruments:
"type": "log",
"name": "myapp.method",
"value": "result",
"internal": False,
"event": "return",
"custom": {},
},
"lifespan": 10,
Expand Down
4 changes: 2 additions & 2 deletions src/diagnose/managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class InstrumentManager(object):
* lastmodified: the datetime when the spec was last changed
* lifespan: an int; the number of minutes from lastmodified before
the instrument should expire.
* instrument: a dict of Instrument params (type, name, value, internal, custom).
* instrument: a dict of Instrument params (type, name, value, event, custom).
The "expires" param is calculated from lastmodified + lifespan.
* applied: a dict of {process_id: info} pairs, where "info" is a dict with:
* lm: the "lastmodified" datetime of the instrument when
Expand Down Expand Up @@ -96,7 +96,7 @@ def _apply(self):
)
modified = True
else:
for key in ("name", "value", "internal", "custom"):
for key in ("name", "value", "event", "custom"):
if getattr(I, key) != doc["instrument"][key]:
setattr(I, key, doc["instrument"][key])
modified = True
Expand Down
3 changes: 1 addition & 2 deletions src/diagnose/probes.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,6 @@ def probe_wrapper(*args, **kwargs):
"kwargs": kwargs,
"frame": sys._getframe(),
}
if hotspots.enabled:
_locals["hotspots"] = hotspots
# Add positional args to locals by name.
for i, argname in enumerate(varnames[: len(args)]):
_locals[argname] = args[i]
Expand All @@ -223,6 +221,7 @@ def probe_wrapper(*args, **kwargs):

if hotspots.enabled:
hotspots.finish()
_locals["hotspots"] = hotspots

if instruments_by_event["return"]:
end = time.time()
Expand Down

0 comments on commit 1bca882

Please sign in to comment.