安装centry
程序员文章站
2022-04-30 09:25:34
...
一、成功安装
- 安装docker
sudo yum -y install docker-io
- 启动docker
service docker start
- docker换源
sudo curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://6616fe43.m.daocloud.io
- 将docker加入到开机启动中
chkconfig docker on
- docker拉取redis postsql 和sentry
docker pull redis docker pull postgres docker pull sentry
- 启动redis和sentry
docker run -d --name sentry-redis redis docker run -d --name sentry-postgres -e POSTGRES_PASSWORD=secret -e POSTGRES_USER=sentry postgres docker run --rm sentry config generate-secret-key
- 启动sentry(上一行得到secret-key,然后把key复制到下面四行的单引号中)
(这一步会提示输入邮箱和密码)docker run -it --rm -e SENTRY_SECRET_KEY='<secret-key>' --link sentry-postgres:postgres --link sentry-redis:redis sentry upgrade
docker run -d -p 9000:9000 --name my-sentry -e SENTRY_SECRET_KEY='<secret-key>' --link sentry-redis:redis --link sentry-postgres:postgres sentry docker run -d --name sentry-cron -e SENTRY_SECRET_KEY='<secret-key>' --link sentry-postgres:postgres --link sentry-redis:redis sentry run cron docker run -d --name sentry-worker-1 -e SENTRY_SECRET_KEY='<secret-key>' --link sentry-postgres:postgres --link sentry-redis:redis sentry run worker
采集java终端:
- 创建java采集project
- 创建一个java项目,创建MySentry.java:
package com.lenovo.ai.uuid.sentry;
import io.sentry.Sentry;
import io.sentry.SentryClient;
import io.sentry.SentryClientFactory;
import io.sentry.context.Context;
import io.sentry.event.BreadcrumbBuilder;
import io.sentry.event.UserBuilder;
public class MySentry {
private static SentryClient sentry;
public static void main(String... args) {
Sentry.init();
sentry = SentryClientFactory.sentryClient();
MySentry myClass = new MySentry();
myClass.logWithStaticAPI();
myClass.logWithInstanceAPI();
}
void unsafeMethod() {
throw new UnsupportedOperationException("You shouldn't call this!");
}
void logWithStaticAPI() {
Sentry.getContext().recordBreadcrumb(
new BreadcrumbBuilder().setMessage("User made an action").build()
);
Sentry.getContext().setUser(
new UserBuilder().setEmail("aaa@qq.com").build()
);
Sentry.getContext().addExtra("extra", "thing");
Sentry.getContext().addTag("tagName", "tagValue");
Sentry.capture("This is a test");
try {
unsafeMethod();
} catch (Exception e) {
Sentry.capture(e);
}
}
/**
* Examples that use the SentryClient instance directly.
*/
void logWithInstanceAPI() {
Context context = sentry.getContext();
context.recordBreadcrumb(new BreadcrumbBuilder().setMessage("User made an action").build());
context.setUser(new UserBuilder().setEmail("aaa@qq.com").build());
sentry.sendMessage("This is a test");
try {
unsafeMethod();
} catch (Exception e) {
// This sends an exception event to Sentry.
sentry.sendException(e);
}
}
}
- 配置文件centry.properties:
dsn=http://aaa@qq.com:9000/3
备注:a48a254da2b34b04aea48b8a55174756
- 工程结构:
- 运行MySentry,java,在web页面上看到:
监控js项目:
- 创建html
<html>
<head>
<script src="https://browser.sentry-cdn.com/5.5.0/bundle.min.js" crossorigin="anonymous"></script>
<script type="text/javascript">
Sentry.init({ dsn: 'http://aaa@qq.com:9000/2' });
myUndefinedFunction();
</script>
</head>
</html>
因为myUndefinedFunction函数未定义,所以会出现js异常
- 在web页面上,可以看到:
上一篇: zabbix自动同步ldap帐号到数据库
推荐阅读
-
安装xampp后apache无法启动的原因及解决方法
-
ApowerREC屏幕录像机如何安装?ApowerREC屏幕录像机安装破解教程
-
木疙瘩动画制作软件如何使用?木疙瘩动画制作软件安装使用教程
-
阿里云服务器ECS上ubuntu安装nginx后默认站点页面打开错误,显示无法访问此网站
-
win7系统安装网银助手时提示您尚未正确安装错误的两种解决方法图文教程
-
win7安装Office提示1603/1902错误解决方法
-
PTC Arbortext Editor 7.1中文破解版安装许可激活图文详细教程
-
service pack3下载怎么安装(service pack3安装教程)
-
XMind 8 Update 7破解补丁中文授权一键注册安装破解教程(免序列号)
-
Artensoft Photo Collage Maker Pro安装汉化破解教程