Python Open Telemtry - 获取跟踪 ID

问题描述

假设我有一个使用 Open Telemtry 分布式跟踪的 Python 应用程序:

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)

在这种情况下如何获取跟踪 ID?我想把它记录到日志文件中。

谢谢

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)