我需要用 docker 设置哨兵。这就是为什么我不想在安装过程中被要求创建用户。因此我使用以下命令来安装哨兵。
./install.sh --no-user-prompt
Run Code Online (Sandbox Code Playgroud)
在配置文件 config.example.yml 中,我还设置了以下值。不幸的是我无法登录。
system.secret-key: 'somesupersecretkey'
system.admin-email: 'somemail@adress.com'
Run Code Online (Sandbox Code Playgroud)
我必须如何更改配置文件才能设置用户。那么 system.secrey-key 到底有什么用呢?
我用以下方法构建了我的 Ionic 项目:
ionic build --prod --source-map
然后我上传了源地图:
npx sentry-cli releases files my-app-1.1.0 upload-sourcemaps ../sentry-source-code-1.1.0 --url-prefix 'http://localhost'
(sentry-source-code-1.1.0 文件夹包含 .map 和 .js 文件)
这似乎是有道理的,但不幸的是 Ionic / Capacitor 应用程序总是从中加载,localhost因为它是一个 Webview 容器。
上传--url-prefix 'http://localhost没有改变任何东西
我如何告诉哨兵查找localhost工件中的文件和源映射?
我有以下函数,我正在尝试处理错误并将其发送给哨兵
import sentry_sdk
...
...
...
def create_orders(
orders: orders_schema.OrderCreate
):
try:
query = "INSERT INTO orders VALUES (nextval('orders_id_seq'), :price, :currency, :created_on, :note)"
values = {
"price": orders.price,
"currency": orders.currency,
"created_on": datetime.utcnow(),
"note": orders.note
}
except Exception as err:
sentry_sdk.capture_exception(err)
return database.execute(query, values=values)
Run Code Online (Sandbox Code Playgroud)
这是调用该函数的路由器端点
@router.post("/orders/create", response_model=orders_schema.OrderCreate)
async def create_new_order(
orders: orders_schema.OrderCreate
):
await crud.create_orders(orders)
return {**orders.dict()}
Run Code Online (Sandbox Code Playgroud)
哨兵集成的工作原理是我已经测试过接收其他一些未处理的错误事件,但现在我想实际使用哨兵来满足我的需要;这是为了帮助管理已处理的错误
但是当我尝试向 api 端点发送错误的值或错误的密钥时,没有任何内容发送到哨兵
我是否遗漏了某些内容或者我该怎么做才能发送错误?
当我\xe2\x80\x99m在哨兵问题描述页面时,我可以看到哨兵服务收集的一些信息,并且我\xe2\x80\x99d希望避免收集它们以避免隐私问题。
\n我\xe2\x80\x99d 不希望看到的信息是:app.device和用户 ID,如您在此处看到的:
\n\n是否可以?我\xe2\x80\x99m 担心新的苹果隐私限制。我不知道我是否理解正确,但有必要使用弹出窗口或类似的方式向用户解释该应用程序正在使用第三方软件来收集有关“应用程序崩溃”和“应用程序崩溃”的数据表现”。让用户可以选择不收集这些数据会给开发人员带来很多麻烦。\n我搜索了所有项目设置和文档,但我只找到了隐藏某些标签/数据的方法,但重点不是隐藏信息,但根本不收集它们。
\n谢谢
\nsentry_sdk哨兵文档解释了如何自动捕获异常或记录消息。但是,我怎样才能捕捉到 python 警告,比如DeprecationWarning会引发的警告
warnings.warn(DeprecationWarning, "warning message")
Run Code Online (Sandbox Code Playgroud) 我的 Angular 应用程序正在使用 Service Worker 和 Sentry。硬重新加载应用程序时,可以请求 Sentry 并以 200 响应。在网络控制台中正常加载应用程序(无需硬重新加载)时,它会显示 504 网关超时(来自服务工作人员)。由于 Sentry 是一个错误跟踪工具,Service Worker 不应该对这些请求执行任何操作。我想知道因为发送的请求是 POST 请求。如何配置 Service Worker 使其不拦截此 POST 请求?
我正在使用带有sentry/sentry-laravel插件的 Laravel 8。
有一种工作在 99% 的情况下都可以正常工作。如果由于以下原因出现任何问题,它会重试 N 次:
public $backoff = 120;
public function retryUntil()
{
return now()->addHours(6);
}
Run Code Online (Sandbox Code Playgroud)
它只是调用一些服务:
public function handle()
{
// Service calls some external API
$service->doSomeWork(...);
}
Run Code Online (Sandbox Code Playgroud)
方法doSomeWork有时会由于网络问题而引发异常,例如Curl error: Operation timed out after 15001 milliseconds with 0 bytes received. 由于自动重试,这很好。大多数情况下,下次重试就会成功。
每个curl 错误都会发送到Sentry。作为管理员,我必须检查每个警报,因为这项工作非常重要,我不能错过实际失败的工作。例如:
如何使只有“最终”作业失败才会向 Sentry 发送消息?我的意思是在重试失败 6 小时之后:只有那时我才想收到一条警报。
有一种解决方法可以“起作用”。我们可以替换Exception为SomeCustomException并将其添加到 …
我正在使用此命令生成源映射:
flutter build web --release --source-maps
Run Code Online (Sandbox Code Playgroud)
当我在浏览器中打开应用程序时,每个 flutter 文件只包含 index.html 内容。还尝试在哨兵上上传源地图,它说无效映射(源地图中的位置无效)所以我认为源地图必须损坏。
我正在使用go-swagger。Sentry 添加了性能监控我正在寻找最佳实践来在我的项目中添加此功能。
我知道,go-swagger 使用“net/http”,但对于正确的添加方式仍然存在一些争议。我将 init Sentry 添加到 configure_myapp_api.go 中
func InitSentry(cfg *configs.Config) {
err := sentry.Init(sentry.ClientOptions{
Dsn: cfg.SentryDsn,
Environment: fmt.Sprintf("[%s][%s]", "myapp-api-back", cfg.SentryEnvironment),
AttachStacktrace: true,
TracesSampleRate: 0.2,
SampleRate: 0.2,
EnableTracing: true,
})
if err != nil {
log.Fatalf("Sentry initialization failed: %v\n", err)
}
defer sentry.Recover()
}
Run Code Online (Sandbox Code Playgroud)
它应该只是一个中间件吗?
我最近将哨兵添加到我的 nextjs 项目中。我的问题是这个错误阻止我的应用程序构建。我在运行时也遇到同样的错误,但令我困惑的是为什么它阻止我的应用程序构建。我可以以仅在运行时有效的方式配置它吗?
Failed to compile.
Sentry CLI Plugin: Command failed: D:\client-new\node_modules\@sentry\cli\sentry-cli.exe releases new SOME_KEY_CODE
error: API request failed
caused by: [28] Timeout was reached (Failed to connect to sentry.io port 443 after 21064 ms: Timed out)
Add --log-level=[info|debug] or export SENTRY_LOG_LEVEL=[info|debug] to see more output.
Please attach the full debug log to all bug reports.
Sentry CLI Plugin: Command failed: D:\client-new\node_modules\@sentry\cli\sentry-cli.exe releases new SOME_KEY_CODE
error: API request failed
caused by: [28] Timeout was reached (Failed to connect to sentry.io …Run Code Online (Sandbox Code Playgroud)