Merge remote-tracking branch 'origin/develop' into develop

pull/1529/head
LqxHxy 6 months ago
commit 6c56773fd9

@ -5,7 +5,7 @@ title: 采用公司
## 谁在使用 Hippo4j ## 谁在使用 Hippo4j
共计 45+ 家公司生产接入 Hippo4j按照公司登记时间排序。 共计 46+ 家公司生产接入 Hippo4j按照公司登记时间排序。
- [身边云](https://serviceshare.com) - [身边云](https://serviceshare.com)
- [思派健康科技](https://www.medbanks.cn) - [思派健康科技](https://www.medbanks.cn)
@ -52,6 +52,7 @@ title: 采用公司
- [智慧芽信息科技(苏州)有限公司](https://www.zhihuiya.com) - [智慧芽信息科技(苏州)有限公司](https://www.zhihuiya.com)
- [滴滴出行](https://www.didiglobal.com) - [滴滴出行](https://www.didiglobal.com)
- [杭州源诚科技有限公司](http://www.yckjdata.com) - [杭州源诚科技有限公司](http://www.yckjdata.com)
- [汉克时代](https://www.hunktimes.com/)
## 登记 ## 登记

@ -24,7 +24,6 @@ import cn.hippo4j.common.toolkit.StringUtil;
import cn.hippo4j.core.config.ApplicationContextHolder; import cn.hippo4j.core.config.ApplicationContextHolder;
import cn.hippo4j.threadpool.dynamic.mode.config.properties.BootstrapConfigProperties; import cn.hippo4j.threadpool.dynamic.mode.config.properties.BootstrapConfigProperties;
import cn.hippo4j.threadpool.dynamic.mode.config.properties.MonitorProperties; import cn.hippo4j.threadpool.dynamic.mode.config.properties.MonitorProperties;
import cn.hippo4j.threadpool.monitor.api.DynamicThreadPoolMonitor;
import cn.hippo4j.threadpool.monitor.api.ThreadPoolMonitor; import cn.hippo4j.threadpool.monitor.api.ThreadPoolMonitor;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -53,6 +52,10 @@ public class ThreadPoolMonitorExecutor implements ApplicationRunner, DisposableB
private List<ThreadPoolMonitor> threadPoolMonitors; private List<ThreadPoolMonitor> threadPoolMonitors;
static {
ServiceLoaderRegistry.register(ThreadPoolMonitor.class);
}
@Override @Override
public void run(ApplicationArguments args) throws Exception { public void run(ApplicationArguments args) throws Exception {
MonitorProperties monitor = properties.getMonitor(); MonitorProperties monitor = properties.getMonitor();
@ -70,8 +73,8 @@ public class ThreadPoolMonitorExecutor implements ApplicationRunner, DisposableB
// Get dynamic thread pool monitoring component. // Get dynamic thread pool monitoring component.
List<String> collectTypes = Arrays.asList(monitor.getCollectTypes().split(",")); List<String> collectTypes = Arrays.asList(monitor.getCollectTypes().split(","));
ApplicationContextHolder.getBeansOfType(ThreadPoolMonitor.class).forEach((beanName, bean) -> threadPoolMonitors.add(bean)); ApplicationContextHolder.getBeansOfType(ThreadPoolMonitor.class).forEach((beanName, bean) -> threadPoolMonitors.add(bean));
Collection<DynamicThreadPoolMonitor> dynamicThreadPoolMonitors = Collection<ThreadPoolMonitor> dynamicThreadPoolMonitors =
ServiceLoaderRegistry.getSingletonServiceInstances(DynamicThreadPoolMonitor.class); ServiceLoaderRegistry.getSingletonServiceInstances(ThreadPoolMonitor.class);
dynamicThreadPoolMonitors.stream().filter(each -> collectTypes.contains(each.getType())).forEach(each -> threadPoolMonitors.add(each)); dynamicThreadPoolMonitors.stream().filter(each -> collectTypes.contains(each.getType())).forEach(each -> threadPoolMonitors.add(each));
// Execute dynamic thread pool monitoring component. // Execute dynamic thread pool monitoring component.
collectScheduledExecutor.scheduleWithFixedDelay( collectScheduledExecutor.scheduleWithFixedDelay(

@ -166,7 +166,6 @@ public class DynamicThreadPoolRefreshListener extends AbstractRefreshListener<Ex
private void checkNotifyConsistencyAndReplace(ExecutorProperties executorProperties) { private void checkNotifyConsistencyAndReplace(ExecutorProperties executorProperties) {
boolean checkNotifyConfig = false; boolean checkNotifyConfig = false;
boolean checkNotifyAlarm = false; boolean checkNotifyAlarm = false;
List<String> changeKeys = new ArrayList<>();
Map<String, List<NotifyConfigDTO>> newDynamicThreadPoolNotifyMap = Map<String, List<NotifyConfigDTO>> newDynamicThreadPoolNotifyMap =
configModeNotifyConfigBuilder.buildSingleNotifyConfig(executorProperties); configModeNotifyConfigBuilder.buildSingleNotifyConfig(executorProperties);
Map<String, List<NotifyConfigDTO>> notifyConfigs = threadPoolBaseSendMessageService.getNotifyConfigs(); Map<String, List<NotifyConfigDTO>> notifyConfigs = threadPoolBaseSendMessageService.getNotifyConfigs();
@ -179,7 +178,6 @@ public class DynamicThreadPoolRefreshListener extends AbstractRefreshListener<Ex
for (NotifyConfigDTO notifyConfig : each.getValue()) { for (NotifyConfigDTO notifyConfig : each.getValue()) {
if (!notifyConfigDTOS.contains(notifyConfig)) { if (!notifyConfigDTOS.contains(notifyConfig)) {
checkNotifyConfig = true; checkNotifyConfig = true;
changeKeys.add(each.getKey());
break; break;
} }
} }
@ -194,10 +192,9 @@ public class DynamicThreadPoolRefreshListener extends AbstractRefreshListener<Ex
Boolean isAlarm = executorProperties.getAlarm(); Boolean isAlarm = executorProperties.getAlarm();
Integer activeAlarm = executorProperties.getActiveAlarm(); Integer activeAlarm = executorProperties.getActiveAlarm();
Integer capacityAlarm = executorProperties.getCapacityAlarm(); Integer capacityAlarm = executorProperties.getCapacityAlarm();
// FIXME Compare using Objects.equals if ((isAlarm != null && !Objects.equals(isAlarm, threadPoolNotifyAlarm.getAlarm()))
if ((isAlarm != null && isAlarm != threadPoolNotifyAlarm.getAlarm()) || (activeAlarm != null && !Objects.equals(activeAlarm, threadPoolNotifyAlarm.getActiveAlarm()))
|| (activeAlarm != null && activeAlarm != threadPoolNotifyAlarm.getActiveAlarm()) || (capacityAlarm != null && !Objects.equals(capacityAlarm, threadPoolNotifyAlarm.getCapacityAlarm()))) {
|| (capacityAlarm != null && capacityAlarm != threadPoolNotifyAlarm.getCapacityAlarm())) {
checkNotifyAlarm = true; checkNotifyAlarm = true;
threadPoolNotifyAlarm.setAlarm(Optional.ofNullable(isAlarm).orElse(threadPoolNotifyAlarm.getAlarm())); threadPoolNotifyAlarm.setAlarm(Optional.ofNullable(isAlarm).orElse(threadPoolNotifyAlarm.getAlarm()));
threadPoolNotifyAlarm.setActiveAlarm(Optional.ofNullable(activeAlarm).orElse(threadPoolNotifyAlarm.getActiveAlarm())); threadPoolNotifyAlarm.setActiveAlarm(Optional.ofNullable(activeAlarm).orElse(threadPoolNotifyAlarm.getActiveAlarm()));

@ -87,6 +87,10 @@ public class ReportingEventExecutor implements Runnable, CommandLineRunner, Disp
*/ */
private ScheduledThreadPoolExecutor collectVesselExecutor; private ScheduledThreadPoolExecutor collectVesselExecutor;
static {
ServiceLoaderRegistry.register(ThreadPoolMonitor.class);
}
@SneakyThrows @SneakyThrows
@Override @Override
public void run() { public void run() {

@ -1,12 +1,12 @@
<template> <template>
<div class="navbar"> <div class="navbar">
<hamburger id="hamburger-container" :is-active="sidebar.opened" class="hamburger-container" <hamburger id="hamburger-container" :is-active="sidebar.opened" class="hamburger-container"
@toggleClick="toggleSideBar"/> @toggleClick="toggleSideBar" />
<breadcrumb id="breadcrumb-container" class="breadcrumb-container"/> <breadcrumb id="breadcrumb-container" class="breadcrumb-container" />
<div class="right-menu"> <div class="right-menu">
<template v-if="device!=='mobile'"> <template v-if="device !== 'mobile'">
<!-- <search id="header-search" class="right-menu-item" />--> <!-- <search id="header-search" class="right-menu-item" />-->
<!-- <error-log class="errLog-container right-menu-item hover-effect"/> --> <!-- <error-log class="errLog-container right-menu-item hover-effect"/> -->
@ -18,24 +18,17 @@
<!-- </el-tooltip>--> <!-- </el-tooltip>-->
</template> </template>
<el-select class="select-tenant" v-model="tenant.index" filterable @change="changeTenant"> <el-select v-model="currentTenant" class="select-tenant" @change="changeTenant">
<el-option <el-option v-for="item in tenantList" :key="item.tenantId" :label="item.resource" :value="item.tenantId">
v-for="(item, index) in tenantList"
:key="index"
:label="item.resource"
:value="item.index">
</el-option> </el-option>
</el-select> </el-select>
<langChange /> <langChange />
<el-dropdown class="avatar-container right-menu-item hover-effect" trigger="click"> <el-dropdown class="avatar-container right-menu-item hover-effect" trigger="click">
<div class="avatar-wrapper"> <div class="avatar-wrapper">
<img src="../../../public/hippo4j.gif" class="user-avatar"> <img src="../../../public/hippo4j.gif" class="user-avatar">
<i class="el-icon-caret-bottom"/> <i class="el-icon-caret-bottom" />
</div> </div>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<!--<router-link to="/profile/index">
<el-dropdown-item>Profile</el-dropdown-item>
</router-link>-->
<router-link to="/"> <router-link to="/">
<el-dropdown-item>{{ this.$t('menu.dashboard') }}</el-dropdown-item> <el-dropdown-item>{{ this.$t('menu.dashboard') }}</el-dropdown-item>
</router-link> </router-link>
@ -49,16 +42,18 @@
</template> </template>
<script> <script>
import * as jobProjectApi from '@/api/hippo4j-tenant'; import * as user from '@/api/hippo4j-user';
import * as user from '@/api/hippo4j-user'; import { mapGetters } from 'vuex'
import { mapGetters, mapState } from 'vuex' import Breadcrumb from '@/components/Breadcrumb'
import Breadcrumb from '@/components/Breadcrumb' import Hamburger from '@/components/Hamburger'
import Hamburger from '@/components/Hamburger' import langChange from '@/locale/langChange'
import ErrorLog from '@/components/ErrorLog'
import langChange from '@/locale/langChange'
import { i18nConfig } from '@/locale/config'
export default { export default {
components: {
Breadcrumb,
Hamburger,
langChange
},
data() { data() {
return { return {
tenant: { tenant: {
@ -66,14 +61,9 @@
resource: '', resource: '',
username: '' username: ''
}, },
currentTenant: undefined
} }
}, },
components: {
Breadcrumb,
Hamburger,
ErrorLog,
langChange
},
computed: { computed: {
...mapGetters([ ...mapGetters([
'sidebar', 'sidebar',
@ -83,13 +73,10 @@
'tenantInfo' 'tenantInfo'
]) ])
}, },
watch: { mounted() {
tenantInfo(newVal) { this.getTenantList()
this.tenant.tenantId = newVal.tenantId
this.tenant.resource = newVal.resource
console.log("ischangLang", newVal, this.tenantList)
}
}, },
methods: { methods: {
toggleSideBar() { toggleSideBar() {
this.$store.dispatch('app/toggleSideBar') this.$store.dispatch('app/toggleSideBar')
@ -106,64 +93,43 @@
.getCurrentUser(userName) .getCurrentUser(userName)
.then((response) => { .then((response) => {
const { resources } = response; const { resources } = response;
console.log("isTenList1", resources, this.tenantList) let resourcesRes = resources.map((item) => {
if (response.role == 'ROLE_ADMIN') {
resources.unshift({
action: "rw",
resource: this.$t('common.allTenant'),
username: userName,
tenantId: this.$t('common.allTenant'),
index: 0,
})
}
console.log("isTenList1111111", this.$t('common.allTenant'), resources, this.tenantList)
const resourcesRes = resources.map((item, index) => {
let query = { let query = {
...item, ...item,
tenantId: item.resource, tenantId: item.resource,
index: index,
} }
console.log("=============", index, query, item)
return query return query
}) })
console.log("isTenList22222", resourcesRes, this.tenantList) if (response.role == 'ROLE_ADMIN') {
resourcesRes = [{
action: "rw",
resource: this.$t('common.allTenant'),
username: userName,
tenantId: this.$t('common.allTenant'),
}, ...resourcesRes]
}
this.$store.dispatch('tenant/setTenantList', resourcesRes) this.$store.dispatch('tenant/setTenantList', resourcesRes)
this.tenant = JSON.parse(this.$cookie.get('tenantInfo')) || resourcesRes[0] this.tenant = JSON.parse(this.$cookie.get('tenantInfo')) || resourcesRes[0]
this.$store.dispatch('tenant/setTenantInfo', this.tenant || resourcesRes[0]) this.$store.dispatch('tenant/setTenantInfo', resourcesRes[0])
this.$cookie.set('tenantInfo', JSON.stringify(this.tenant)); this.$cookie.set('tenantInfo', JSON.stringify(this.tenant));
console.log("isTenList2", this.tenantList) this.currentTenant = resourcesRes[0]?.tenantId
// console.log('resourceRes:::', this.tenantInfo, this.tenantList)
}) })
.catch(() => {}); .catch(() => { });
}, },
async changeTenant(index) { changeTenant(id) {
console.log("isTenList", this.tenantList) const tenant = this.tenantList.find(item => item.tenantId === id)
let tenant = { this.currentTenant = id
tenantId: this.tenantList[index].resource,
resource: this.tenantList[index].resource,
index: this.tenantList[index].index,
current: 1,
desc: true,
size: 10,
}
this.$store.dispatch('tenant/setTenantInfo', tenant) this.$store.dispatch('tenant/setTenantInfo', tenant)
this.$cookie.set('tenantInfo', JSON.stringify(tenant));
let isAllTenant = tenant.tenantId == i18nConfig.messages.zh.common.allTenant || tenant.tenantId == i18nConfig.messages.en.common.allTenant
tenant.tenantId = isAllTenant ? '' : tenant.tenantId
await jobProjectApi.list(tenant).then((response) => {
console.log("isRes", response)
// this.$store.dispatch('tenant/setTenantList', resources)
});
} }
}, },
async mounted() { }
this.getTenantList()
},
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.navbar { .navbar {
height: 50px; height: 50px;
overflow: hidden; overflow: hidden;
position: relative; position: relative;
@ -197,6 +163,7 @@
height: 100%; height: 100%;
line-height: 50px; line-height: 50px;
display: flex; display: flex;
&:focus { &:focus {
outline: none; outline: none;
} }
@ -255,5 +222,5 @@
} }
} }
} }
} }
</style> </style>

@ -46,7 +46,7 @@ public class BeforeCheckConfiguration {
// TODO test // TODO test
boolean checkFlag = properties != null && properties.getEnable(); boolean checkFlag = properties != null && properties.getEnable();
if (checkFlag) { if (checkFlag) {
String propertiesClassName = properties.getClass().getName(); String propertiesClassName = properties.getClass().getSuperclass() == Object.class ? properties.getClass().getName() : properties.getClass().getSuperclass().getName();
switch (propertiesClassName) { switch (propertiesClassName) {
case bootstrapPropertiesClassName: { case bootstrapPropertiesClassName: {
String namespace = properties.getNamespace(); String namespace = properties.getNamespace();

@ -17,12 +17,14 @@
package cn.hippo4j.monitor.micrometer; package cn.hippo4j.monitor.micrometer;
import cn.hippo4j.common.extension.spi.ServiceLoaderRegistry;
import cn.hippo4j.core.config.ApplicationContextHolder; import cn.hippo4j.core.config.ApplicationContextHolder;
import cn.hippo4j.common.model.ThreadPoolRunStateInfo; import cn.hippo4j.common.model.ThreadPoolRunStateInfo;
import cn.hippo4j.common.toolkit.BeanUtil; import cn.hippo4j.common.toolkit.BeanUtil;
import cn.hippo4j.common.toolkit.CollectionUtil; import cn.hippo4j.common.toolkit.CollectionUtil;
import cn.hippo4j.core.executor.state.ThreadPoolRunStateHandler; import cn.hippo4j.core.executor.state.ThreadPoolRunStateHandler;
import cn.hippo4j.monitor.base.AbstractDynamicThreadPoolMonitor; import cn.hippo4j.monitor.base.AbstractDynamicThreadPoolMonitor;
import cn.hippo4j.threadpool.monitor.api.ThreadPoolMonitor;
import cn.hippo4j.threadpool.monitor.support.MonitorTypeEnum; import cn.hippo4j.threadpool.monitor.support.MonitorTypeEnum;
import io.micrometer.core.instrument.Metrics; import io.micrometer.core.instrument.Metrics;
import io.micrometer.core.instrument.Tag; import io.micrometer.core.instrument.Tag;
@ -48,6 +50,10 @@ public class DynamicThreadPoolMicrometerMonitorHandler extends AbstractDynamicTh
super(handler); super(handler);
} }
static {
ServiceLoaderRegistry.register(ThreadPoolMonitor.class);
}
@Override @Override
protected void execute(ThreadPoolRunStateInfo poolRunStateInfo) { protected void execute(ThreadPoolRunStateInfo poolRunStateInfo) {
ThreadPoolRunStateInfo stateInfo = runStateCache.get(poolRunStateInfo.getTpId()); ThreadPoolRunStateInfo stateInfo = runStateCache.get(poolRunStateInfo.getTpId());

Loading…
Cancel
Save