docker-compose run --rm web upgrade Would you like to create a user account now? [Y/n]: y Email: anjia0532@gmail.com Password: Repeat for confirmation: Should this user be a superuser? [y/N]: y ## 直到输出 Migrated: - sentry - sentry.nodestore - sentry.search - social_auth - sentry.tagstore - sentry_plugins.hipchat_ac - sentry_plugins.jira_ac Creating missing DSNs Correcting Group.num_comments counter ## 并退出
配置 Sentry
配置 vue
本文以 iview-admin 为例
git clone https://gitee.com/anjia/iview-admin.git cd iview-admin
// The Vue build version to load with the `import` command // (runtime-only or standalone) has been set in webpack.base.conf with an alias. import Vue from"vue"; import App from"./App"; import router from"./router"; import store from"./store"; import iView from"iview"; import i18n from"@/locale"; import config from"@/config"; import importDirective from"@/directive"; import { directive as clickOutside } from"v-click-outside-x"; import installPlugin from"@/plugin"; import"./index.less"; import"@/assets/icons/iconfont.css"; import TreeTable from"tree-table-vue"; import VOrgTree from"v-org-tree"; import"v-org-tree/dist/v-org-tree.css"; import * as Sentry from"@sentry/browser"; import * as Integrations from"@sentry/integrations"; import VueMatomo from"vue-matomo";
// 实际打包时应该不引入mock /* eslint-disable */ if (process.env.NODE_ENV !== "production") require("@/mock");
Sentry.init({ dsn: "https://xxx@xxx.xxx.com/xxx", integrations: [ new Integrations.Vue({ Vue, attachProps: true, }), ], }); Vue.use(VueMatomo, { // Configure your matomo server and site by providing host: "//xxxx.xxxx.com/", siteId: xx,
// Changes the default .js and .php endpoint's filename // Default: 'piwik' trackerFileName: "matomo.js",
// Enables automatically registering pageviews on the router router: router,
// Enables link tracking on regular links. Note that this won't // work for routing links (ie. internal Vue router links) // Default: true enableLinkTracking: true,
// Require consent before sending tracking information to matomo // Default: false requireConsent: false,
// Whether to track the initial page view // Default: true trackInitialView: true,
// Whether or not to log debug information // Default: false debug: false, });
引言 首先,之所以谈这个话题呢,是发现现在很多人对微服务的设计缺乏认识,所以写一篇扫盲文。当然,考虑到目前大多微服务的文章都是口水文,烟哥争取将实现方式讲透,点清楚,让大家有所收获! OK,我要先说明一下,我有很长一段时间将 服务降级 和 服务熔断 混在一起,认为是一回事! 为什么我会有这样的误解呢? 针对下面的情形,如图所示 当 Service A 调用 Service B ,失败多次达到一定阀值, Service A 不会再去调 Service B ,而会去执行本地的降级方法! 对于这么一套机制:在Spring cloud中结合Hystrix,将其称为熔断降级! 所以我当时就以为是一回事了,毕竟熔断和降级是一起发生的,而且这二者的概念太相近了!后面接触了多了,发现自己理解的还是太狭隘了,因此本文中带着点我自己的见解,大家如果有不同意见,请轻喷!毕竟还有很多人认为两者是一致的! 正文 服务雪崩 OK,我们从服务雪崩开始讲起!假设存在如下调用链 而此时, Service A 的流量波动很大,流量经常会突然性增加!那么在这种情况下,就算 Service A 能扛得住请求, Service B 和 Service C 未必能扛得住这突发的请求。 此时,如果 Service C 因为抗不住请求,变得不可用。那么 Service B 的请求也会阻塞,慢慢耗尽 Service B 的线程资源, Service B 就会变得不可用。紧接着, Service A 也会不可用,这一过程如下图所示 如上图所示,一个服务失败,导致整条链路的服务都失败的情形,我们称之为服务雪崩。 ps: 谁发明的这个词,真是面试装13必备! 那么, 服务熔断 和 服务降级 就可以视为解决服务雪崩的手段之一。 服务熔断 那么,什么是服务熔断呢? 服务熔断:当下游的服务因为某种原因突然 变得不可用 或 响应过慢 ,上游服务为了保证自己整体服务的可用性,不再继续调用目标服务,直接返回,快速释放资源。如果目标服务情况好转则恢复调用。 需要说明的是熔断其实是一个框架级的处理,那么这套熔断机制的设计,基本上业内用的是 断路器模式 ,如 Martin Fowler 提供的状态转换图如下所示 最开始处于 closed 状态,一旦检测到错误到达一定阈值,便转为 open 状态; 这时候会有个 reset timeou...
评论