From 8155425d2a171f28605359bb5b19b2b1628a21c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BA=84=E5=BB=BA=E5=9B=BD?= <9340100@qq.com> Date: Wed, 27 Jul 2022 11:39:38 +0000 Subject: [PATCH] =?UTF-8?q?=E4=B8=8Esentry=E6=9C=8D=E5=8A=A1=E9=9B=86?= =?UTF-8?q?=E6=88=90=EF=BC=8C=E9=9B=86=E4=B8=AD=E6=B1=87=E6=80=BB=E6=95=85?= =?UTF-8?q?=E9=9A=9C=E6=8A=A5=E5=91=8A=20#3672?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitpod.yml | 2 +- services/service-community/package.service.js | 6 +++--- services/service-sentry/package.json | 3 +-- services/service-sentry/package.service.js | 4 ++-- services/service-steedos-server/index.js | 2 +- .../service-analytics}/main/default/client/sentry.client.js | 3 +-- .../service-analytics}/public/sentry/sentry.min.js | 0 7 files changed, 9 insertions(+), 11 deletions(-) rename {services/service-sentry => steedos-packages/service-analytics}/main/default/client/sentry.client.js (91%) rename {services/service-sentry => steedos-packages/service-analytics}/public/sentry/sentry.min.js (100%) diff --git a/.gitpod.yml b/.gitpod.yml index ca107ecb1f..31694827b1 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -4,7 +4,7 @@ image: # List the ports you want to expose and what to do when they are served. See https://www.gitpod.io/docs/config-ports/ ports: - port: 5000 - onOpen: open-browser + onOpen: ignore visibility: public - port: 3000 onOpen: ignore diff --git a/services/service-community/package.service.js b/services/service-community/package.service.js index 29d50725f7..7b12ad6b12 100644 --- a/services/service-community/package.service.js +++ b/services/service-community/package.service.js @@ -64,6 +64,9 @@ module.exports = { */ async started(ctx) { + // 故障报告服务 + this.broker.createService(require("@steedos/service-sentry")); + // 启动 元数据服务 this.broker.createService(require("@steedos/service-metadata-server")); @@ -87,9 +90,6 @@ module.exports = { // 启动 登录页面 this.broker.createService(require("@steedos/webapp-accounts")); - // 故障报告服务 - this.broker.createService(require("@steedos/service-sentry")); - // 产品分析 this.broker.createService(require("@steedos/service-analytics")); }, diff --git a/services/service-sentry/package.json b/services/service-sentry/package.json index 98f741d720..f75e281565 100644 --- a/services/service-sentry/package.json +++ b/services/service-sentry/package.json @@ -6,8 +6,7 @@ "dependencies": { "@sentry/node": "7.7.0", "@sentry/tracing": "7.7.0", - "@sentry/utils": "7.7.0", - "@steedos/objectql": "2.2.55-beta.13" + "@sentry/utils": "7.7.0" }, "private": false, "publishConfig": { diff --git a/services/service-sentry/package.service.js b/services/service-sentry/package.service.js index e324f89ec9..a9e0ebf608 100644 --- a/services/service-sentry/package.service.js +++ b/services/service-sentry/package.service.js @@ -6,6 +6,7 @@ 'use strict' + const _ = require('lodash'); const Sentry = require('@sentry/node') const SentryUtils = require('@sentry/utils') @@ -24,7 +25,6 @@ const DEFAULT_DSN = { module.exports = { name: serviceName, namespace: "steedos", - mixins: [packageLoader], /** * Dependencies @@ -218,7 +218,7 @@ module.exports = { }) } }, - + started() { let { enabled, dsn, options } = this.settings.sentry if (enabled) { diff --git a/services/service-steedos-server/index.js b/services/service-steedos-server/index.js index db7f7ad32a..461d48577d 100644 --- a/services/service-steedos-server/index.js +++ b/services/service-steedos-server/index.js @@ -8,7 +8,7 @@ const packageLoader = require('@steedos/service-meteor-package-loader'); const objectql = require('@steedos/objectql'); const standardObjectsPath = path.dirname(require.resolve("@steedos/standard-objects/package.json")); const _ = require('lodash'); -const Sentry = require('@sentry/node') + /** * @typedef {import('moleculer').Context} Context Moleculer's Context */ diff --git a/services/service-sentry/main/default/client/sentry.client.js b/steedos-packages/service-analytics/main/default/client/sentry.client.js similarity index 91% rename from services/service-sentry/main/default/client/sentry.client.js rename to steedos-packages/service-analytics/main/default/client/sentry.client.js index a9126aa22d..af4ee2ee9b 100644 --- a/services/service-sentry/main/default/client/sentry.client.js +++ b/steedos-packages/service-analytics/main/default/client/sentry.client.js @@ -1,5 +1,4 @@ -console.log(Meteor.settings.public.sentry.dsn) -if (Meteor.settings.public.sentry.dsn) { +if (Meteor.settings.public.sentry && Meteor.settings.public.sentry.dsn) { let sentryScript = document.createElement("script"); sentryScript.setAttribute("src", Steedos.absoluteUrl('/sentry/sentry.min.js')); diff --git a/services/service-sentry/public/sentry/sentry.min.js b/steedos-packages/service-analytics/public/sentry/sentry.min.js similarity index 100% rename from services/service-sentry/public/sentry/sentry.min.js rename to steedos-packages/service-analytics/public/sentry/sentry.min.js