Let's say I have a Python app that makes use of Open Telemtry distributed tracing:
from flask import Flask, jsonify, request
import tracer, connector, logger, metricer
app = Flask(__name__)
metricer.instrument(app)
tracer.instrument(app)
logger.instrument(app)
@app.route('/api/v1/participants', methods=["GET"])
def get_participants():
with tracer.start_span("dbquery"):
try:
participants = connector.query()
return jsonify(participants)
except:
logger.log("DB query has failed")
return "Internal Server Error", 500
if __name__ == "__main__":
app.run(host='0.0.0.0', port=8080, debug=False)
How can I get the trace ID in this case? I want to log it to the logfile.
Thx