我刚开始使用Sentry,这很可爱。我有大约 10 个不同的站点,其中一些位于相同的服务器上,它们的名称类似于 web12.example.com。这些服务器名称通过 Sentry 的界面传递,因此我可以过滤错误来自哪个服务器。按服务器过滤并不是特别有用 - 有用的是按站点过滤。
有没有办法将服务器名称更改为不是实际的服务器名称,而是(例如)错误来自的域名?
Sentry already does what I wanted, with the (apparently undocumented) SENTRY_SITE
settings. I just set the following in my settings.py
file:
SENTRY_SITE = u'My Site Name'
and I can filter on it from the filters list on the right-hand side of the Sentry interface.
Server name isn't intended for this purpose (presumably for people with large setups, it's useful to see if lots of errors are coming from a particularly server, which may be indicative of configuration issues), this is what the site filter is for.
现在他们可以选择设置:
sentry_sdk.init(
<endpoint>,
server_name='a_name_to_distinguish_instance',
...
)
在 Web UI 中,可以使用server_name
标签来过滤以这种方式配置的实例的问题。