From 39a265d3d601430ec919c77fbc8acc4c4ee8b4f1 Mon Sep 17 00:00:00 2001 From: Jan-Niklas Tille Date: Wed, 17 Apr 2024 15:37:17 +0200 Subject: [PATCH] move start span below routes --- labs/manual-instrumentation-traces/solution/src/app.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/labs/manual-instrumentation-traces/solution/src/app.py b/labs/manual-instrumentation-traces/solution/src/app.py index 6c56e2c..4ad82af 100644 --- a/labs/manual-instrumentation-traces/solution/src/app.py +++ b/labs/manual-instrumentation-traces/solution/src/app.py @@ -26,8 +26,8 @@ def restore_context_on_teardown(err): if previous_ctx_token: context.detach(previous_ctx_token) -@tracer.start_as_current_span("users") @app.route('/users', methods=['GET']) +@tracer.start_as_current_span("users") def get_user(): user, status = db.get_user(123) data = {} @@ -49,8 +49,8 @@ def do_stuff(): url = "http://httpbin:80/anything" _response = requests.get(url, headers=headers) -@tracer.start_as_current_span("index") @app.route('/') +@tracer.start_as_current_span("index") def index(): span = get_current_span() span.set_attributes( @@ -67,4 +67,4 @@ def index(): if __name__ == "__main__": db = ChaosClient(client=FakerClient()) - app.run(host="0.0.0.0", debug = True) \ No newline at end of file + app.run(host="0.0.0.0", debug = True)