Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save nicholasamorim/382fc6957a6a2157e985daaf441764a3 to your computer and use it in GitHub Desktop.
Save nicholasamorim/382fc6957a6a2157e985daaf441764a3 to your computer and use it in GitHub Desktop.
Minimal example on tracing requests library
import requests
from jaeger_client import Config
from opentracing_instrumentation.client_hooks import install_all_patches
def init_tracer():
install_all_patches()
config = Config(
config={ # usually read from some yaml config
"sampler": {"type": "const", "param": 1},
"reporter_batch_size": 1,
},
service_name='myservice',
validate=True,
)
tracer = config.initialize_tracer()
return tracer
init_tracer()
resp = requests.get('https://google.com')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment