From 1209c25c964856328705ce18c825b7335425fb86 Mon Sep 17 00:00:00 2001 From: Prateek Agarwal Date: Sat, 3 Sep 2016 20:24:09 -0700 Subject: [PATCH 01/16] Fix the example for adding trace to a new_request --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index df24acc..d0efbfe 100644 --- a/README.rst +++ b/README.rst @@ -80,7 +80,7 @@ If you want to make an RPC and continue an existing trace, you can inject the cu text_carrier = {} opentracing_tracer.inject(span, opentracing.Format.TEXT_MAP, text_carrier) for k, v in text_carrier.iteritems(): - request.add_header(k,v) + new_request.add_header(k,v) ... # make request Examples From 6e2ba7a69073e4bc8e63605451f1aa813aa55ae9 Mon Sep 17 00:00:00 2001 From: Gregory Reshetniak Date: Tue, 8 May 2018 15:17:46 +0200 Subject: [PATCH 02/16] added working examples with Jaeger tracer --- example/client.py | 85 +++++++++++++++-------------------------------- example/server.py | 79 ++++++++++++++++++++++--------------------- 2 files changed, 66 insertions(+), 98 deletions(-) diff --git a/example/client.py b/example/client.py index 10bb7d5..4aeefbf 100644 --- a/example/client.py +++ b/example/client.py @@ -1,66 +1,35 @@ -from flask import Flask -from flask_opentracing import FlaskTracer -import lightstep.tracer -import opentracing -import urllib2 +import requests +import time +from opentracing_instrumentation.client_hooks import install_all_patches +from opentracing_instrumentation.request_context import get_current_span, span_in_context +from jaeger_client import Config +from opentracing.ext import tags +from opentracing.propagation import Format -app = Flask(__name__) +from os import environ -# one-time tracer initialization code -ls_tracer = lightstep.tracer.init_tracer(group_name="example client", access_token="{your_lightstep_token}") -# this tracer does not trace all requests, so the @tracer.trace() decorator must be used -tracer = FlaskTracer(ls_tracer) +JAEGER_HOST = environ.get('JAEGER_HOST') -@app.route("/") -def index(): - ''' - Index page, has no tracing. - ''' - return "Index Page" +WEBSERVER_HOST = environ.get('WEBSERVER_HOST') +config = Config(config={'sampler': {'type': 'const', 'param': 1}, + 'logging': True, + 'local_agent': {'reporting_host': JAEGER_HOST}}, + service_name="jaeger_opentracing_example") +tracer = config.initialize_tracer() -@app.route("/request/