Skip to content
This repository has been archived by the owner on May 8, 2024. It is now read-only.

Commit

Permalink
move start span below routes
Browse files Browse the repository at this point in the history
  • Loading branch information
jtl-novatec committed Apr 17, 2024
1 parent 7bd88e3 commit 39a265d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions labs/manual-instrumentation-traces/solution/src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}
Expand All @@ -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(
Expand All @@ -67,4 +67,4 @@ def index():

if __name__ == "__main__":
db = ChaosClient(client=FakerClient())
app.run(host="0.0.0.0", debug = True)
app.run(host="0.0.0.0", debug = True)

0 comments on commit 39a265d

Please sign in to comment.