我有一个 Django 应用程序,其运行状况检查端点使用django-health-check。
在url_patterns我添加了以下行:
url(r'^ht/', include('health_check.urls')),
Run Code Online (Sandbox Code Playgroud)
问题在于健康检查正在满足所有 Sentry 事务限制。
如何排除 Sentry 中的健康检查端点?
我正在尝试在 Java 应用程序(这是一个 Web API)中设置一些第三方 appender - appender 是作为依赖项添加的库。这是一个 Maven 应用程序,这些库是 Raven(通过 Sentry)和 Logentries。他们接受日志并提供图形用户界面来查看它们。
本地工作正常 - 当整个应用程序在本地运行时,日志成功显示在 Logentries 和 Sentry 中。在两种环境中都成功找到并解析了配置。我log4j2.xml在为两种环境启动服务器时的配置和输出包含在下面。
在登台环境中,我看到日志说 CLASS_NOT_FOUND,所以这可能是一个类路径问题?有任何想法吗?
配置
<?xml version="1.0" encoding="utf-8"?>
<configuration status="all">
<properties>
<property name="pattern">%d{hh:mm:ss.sss} [mode=${env:MODE}] [%t] %-5level %logger{36} - %msg%n</property>
</properties>
<appenders>
<console name="console" target="system_out">
<patternlayout pattern="${pattern}"/>
</console>
<raven name="sentry">
<dsn>[dsn_here]</dsn>
<patternlayout pattern="${pattern}"/>
<!--to turn down the noise-->
<!--<ThresholdFilter level="ERROR" onMatch="ACCEPT" onMismatch="DENY"/>-->
</raven>
<logentries name="le">
<token>[token_here]</token>
<patternlayout pattern="${pattern}"/>
<!--to turn down the noise-->
<!--<ThresholdFilter level="ERROR" onMatch="ACCEPT" onMismatch="DENY"/>-->
</logentries>
</appenders> …Run Code Online (Sandbox Code Playgroud) 我最近在我的项目中添加了用于错误跟踪的哨兵,并根据此处的文档配置了 raven,但出现如下所示的错误。
import raven
INSTALLED_APPS = [
# 3rd party app
'raven.contrib.django.raven_compat',
]
RAVEN_CONFIG = {
'dsn': 'https://*****@sentry.io/224093',
'release': raven.fetch_git_sha(os.path.dirname(os.pardir)),
}
Run Code Online (Sandbox Code Playgroud)
System check identified no issues (0 silenced).
October 02, 2017 - 11:31:58
Django version 1.10, using settings 'FoodCham.settings.development'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
Sending message of length 2240 to https://sentry.io/api/224093/store/
Internal Server Error: /
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/exception.py", line 39, in inner
response = get_response(request)
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", …Run Code Online (Sandbox Code Playgroud) 我在Laravel项目中设置了Sentry.io。我也在使用队列。
我想知道是否可以将失败的队列发送到Sentry?因为它们在失败时不会自动发送。
假设我有这段代码...
Raven.capture_exception(error, {
extra: {
error_message: message
}
})
end
Run Code Online (Sandbox Code Playgroud)
我已经尝试使用expect(Raven).to receive(:capture_exception).with(...),无论如何切片,我似乎都无法将期望绑定到Raven,因此可以验证它是否已发送日志通信。它一直告诉我capture_exception没有定义。我都尝试过expect并且expect_any_instance_of没有运气。现在,我已经跳过了,但是我知道有办法。有什么想法吗?
我正在使用无服务器框架将 PHP 代码部署为 IBM Cloud Function。
以下是操作 PHP 文件中的代码:
function main($args): array {
Sentry\init(['dsn' => 'SENTRY_DSN' ]);
try {
throw new \Exception('Some error')
} catch (\Throwable $exception) {
Sentry\captureException($exception);
}
}
Run Code Online (Sandbox Code Playgroud)
这是 serverless.yml 文件:
service: cloudfunc
provider:
name: openwhisk
runtime: php
package:
individually: true
exclude:
- "**"
include:
- "vendor/**"
functions:
test-sentry:
handler: actions/test-sentry.main
annotations:
raw-http: true
events:
- http:
path: /test-sentry
method: post
resp: http
package:
include:
- actions/test-sentry.php
plugins:
- serverless-openwhisk
Run Code Online (Sandbox Code Playgroud)
当我从本地环境(NGINX/PHP Docker 容器)测试操作处理程序时,错误将被发送到 Sentry。
但是,当我尝试从 IBM Cloud …
我想在我的 docker 镜像中运行sentry-cli,如下所示:
sentry-frontend:
stage: sentry
services:
- docker:18-dind
before_script:
- docker login -u gitlab-ci-token -p "$CI_JOB_TOKEN" registry.xxx.xx
script:
- export SENTRY_AUTH_TOKEN=xxxxxxxxxxxxxxxxxx
- export IMAGE=$CI_REGISTRY_IMAGE/frontend-builder:$CI_COMMIT_REF_NAME
- export RELEASE_VERSION=$CI_COMMIT_REF_NAME
- docker pull getsentry/sentry-cli
- docker run --rm -v $(pwd):/work getsentry/sentry-cli releases -o org -p frontend new $RELEASE_VERSION
tags:
- dindRun Code Online (Sandbox Code Playgroud)
然而工作失败了,因为
error: API request failed
caused by: sentry reported an error: Authentication credentials were not provided. (http status: 401)
我试过:
- docker run --rm -v $(pwd):/work getsentry/sentry-cli --auth-token xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
但是之后我收到了与跑步时相同的消息
docker …
也许我误解了目的。我正在寻找一种解决方案来替换我的应用程序中的 console.log(errors),因为我已准备好进行生产。我完成了将 Sentry 功能添加到我的 expo 托管工作流程项目中的步骤。它似乎工作,它连接,它运行 Sentry.init() 很好。但是,当我尝试使用 Sentry.captureException('some exception') 代替 console.log 时,应用程序崩溃,并且我得到“Sentry.captureException 不是函数”。它在我的哨兵控制台中记录了该错误。所以错误正在传递到我的哨兵项目。但从我关注的文档来看,Sentry.captureException 应该是一个有效的函数?我缺少什么?我也尝试过 Sentry.captureMessage ,结果相同。
应用程序.js
import * as Sentry from 'sentry-expo';
Sentry.init({
dsn: 'xxxx',
enableInExpoDevelopment: true,
debug: true, // Sentry will try to print out useful debugging information if something goes wrong with sending an event. Set this to `false` in production.
});
enableScreens();
export default function App() {
return (
<NavigationContainer>
<AuthNavigator />
</NavigationContainer>
)
}
Run Code Online (Sandbox Code Playgroud)
app.json 博览会挂钩
"hooks": {
"postPublish": [
{
"file": "sentry-expo/upload-sourcemaps",
"config": …Run Code Online (Sandbox Code Playgroud) 我安装了 Symfony 4.3 并将其升级到 4.4.19。在我的旧安装中,Sentry 与 exclude_exception 运行良好。我像这样使用它sentry.yaml:
sentry:
dsn: "https://key@sentry.io/id"
options:
excluded_exceptions:
- App\Exception\BadArgumentException
- App\Exception\BadFilterException
- App\Exception\BadRequestException
Run Code Online (Sandbox Code Playgroud)
但是当我升级到 4.4.19 时,symfony 日志告诉我excluded_exceptions不存在。Sentry 在我的项目中获取每个异常。它运行良好,所以我不明白为什么它不能识别此选项。(我已经看到它被添加到 v2.1 的哨兵中)。
我试过做一个,composer update sentry/sentry-symfony但没有任何改变。在我的composer.json 上,我有这个需要部分:
"sentry/sentry": "^3.1", "sentry/sentry-symfony": "^4.0",
所以我现在不知道该怎么做才能解决这个问题。也许我必须忘记一些事情。