如何使用sentry-sdk在html模板中获取Sentry参考ID?
由于 raven 已被弃用,我需要一种替代方法在我的 html 模板中显示 Sentry 参考 ID。
以前的版本在示例中看起来像这样:
<p>You've encountered an error, oh noes!</p>
{% if request.sentry.id %}
<p>
If you need assistance, you may reference this error as
<strong>{{ request.sentry.id }}</strong>.
</p>
{% endif %}
我如何现在就做这个吗?我尝试使用 sentry_sdk.capture_exception()
或 sentry_sdk.last_event_id()
方法。第一个在我的模板中返回 None ,第二个看起来像是我现在正在寻找的。
Since the raven
is deprecated I need an alternative way to display Sentry reference ID in my html template.
The previous version looks like this from the example:
<p>You've encountered an error, oh noes!</p>
{% if request.sentry.id %}
<p>
If you need assistance, you may reference this error as
<strong>{{ request.sentry.id }}</strong>.
</p>
{% endif %}
How do I do this now? I tried to use sentry_sdk.capture_exception()
or sentry_sdk.last_event_id()
method. The first one returns None in my template, the second one looks like it's now what I am looking for.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Sentry 有一个新的用户反馈功能。
以下是文档:https://docs。 Sentry.io/platforms/python/guides/django/enriching-events/user-feedback/
Sentry has a new User Feedback function.
Here are the docs: https://docs.sentry.io/platforms/python/guides/django/enriching-events/user-feedback/