Skip to content

Instantly share code, notes, and snippets.

@mmarchini
Last active October 23, 2017 16:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mmarchini/cb3b7aeab3276e45d9f46a60abaeebeb to your computer and use it in GitHub Desktop.
Save mmarchini/cb3b7aeab3276e45d9f46a60abaeebeb to your computer and use it in GitHub Desktop.
Python StapSDT example
from time import sleep
import stapsdt
# Create a Provider, which we'll use to register probes
provider = stapsdt.Provider("pythonapp")
# Register your first probe with two arguments by passing its types
probe = provider.add_probe(
"firstProbe", stapsdt.ArgTypes.uint64, stapsdt.ArgTypes.int32)
# Enable provider (needed to fire probes later)
provider.load()
while True:
print("Trying to fire probe...")
# Try to fire probe
if probe.fire("My little probe", 42):
# This will only run if the probe was enabled by an external tool
print("Probe fired!")
sleep(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment