故障排除
了解如何排查跟踪设置的问题。
如果您需要帮助管理事务,可以阅读更多内容。如果您需要额外的帮助,可以在 GitHub 上提问。付费计划的客户还可以联系支持。
目前,每个标签的最大字符限制为 200 个字符。超过 200 个字符的标签将被截断,可能会丢失重要信息。为了保留这些数据,您可以将数据拆分到多个标签中。
例如,一个超过 200 个字符的标签请求:
https://empowerplant.io/api/0/projects/ep/setup_form/?user_id=314159265358979323846264338327&tracking_id=EasyAsABC123OrSimpleAsDoReMi&product_name=PlantToHumanTranslator&product_id=161803398874989484820458683436563811772030917980576
上述超过 200 个字符的请求将被截断为:
https://empowerplant.io/api/0/projects/ep/setup_form/?user_id=314159265358979323846264338327&tracking_id=EasyAsABC123OrSimpleAsDoReMi&product_name=PlantToHumanTranslator&product_id=1618033988749894848
相反,使用 span.set_tag
和 span.set_data
可以通过结构化元数据保留此查询的详细信息。这可以通过 base_url
、endpoint
和 parameters
来完成:
Copied
import sentry_sdk
# ...
base_url = "https://empowerplant.io"
endpoint = "/api/0/projects/ep/setup_form"
parameters = {
"user_id": 314159265358979323846264338327,
"tracking_id": "EasyAsABC123OrSimpleAsDoReMi",
"product_name": PlantToHumanTranslator,
"product_id": 161803398874989484820458683436563811772030917980576,
}
with sentry_sdk.start_span(op="request", transaction="setup form") as span:
span.set_tag("base_url", base_url)
span.set_tag("endpoint", endpoint)
span.set_data("parameters", parameters)
make_request(
"{base_url}/{endpoint}/".format(
base_url=base_url,
endpoint=endpoint,
),
data=parameters
)
# ...