Last active
October 23, 2017 16:53
-
-
Save mmarchini/cb3b7aeab3276e45d9f46a60abaeebeb to your computer and use it in GitHub Desktop.
Python StapSDT example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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