Created
April 9, 2018 16:35
-
-
Save davidmlentz/c93986bd53a08960e597a7b4eb4294f1 to your computer and use it in GitHub Desktop.
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
# Adapted from http://webpy.org/docs/0.3/tutorial | |
import redis, random, web | |
urls = ( | |
'/', 'index' | |
) | |
from ddtrace import patch, Pin | |
# Patch the Redis library to automatically enable tracing: | |
patch(redis=True) | |
class index: | |
def GET(self): | |
client = redis.StrictRedis(host="127.0.0.1", port=6379) | |
# Give this service a name and a tag: | |
Pin.override(client, service='myredis', app_type='test', tags={'env':'myenv'}) | |
client.set('randomnumber', random.randint(1,9999)) | |
# Send a response with some content: | |
return str(client.get('randomnumber')) | |
if __name__ == "__main__": | |
app = web.application(urls, globals()) | |
app.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment