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"/> -->
@ -16,26 +16,19 @@
<!-- <el-tooltip content="Global Size" effect="dark" placement="bottom">--> <!-- <el-tooltip content="Global Size" effect="dark" placement="bottom">-->
<!-- <size-select id="size-select" class="right-menu-item hover-effect" />--> <!-- <size-select id="size-select" class="right-menu-item hover-effect" />-->
<!-- </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,211 +42,185 @@
</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' export default {
import { i18nConfig } from '@/locale/config' components: {
Breadcrumb,
export default { Hamburger,
data() { langChange
return { },
tenant: { data() {
action: '', return {
resource: '', tenant: {
username: '' action: '',
}, resource: '',
} username: ''
}, },
components: { currentTenant: undefined
Breadcrumb, }
Hamburger, },
ErrorLog, computed: {
langChange ...mapGetters([
'sidebar',
'avatar',
'device',
'tenantList',
'tenantInfo'
])
},
mounted() {
this.getTenantList()
},
methods: {
toggleSideBar() {
this.$store.dispatch('app/toggleSideBar')
}, },
computed: { async logout() {
...mapGetters([ this.$cookie.delete('userName')
'sidebar', this.$cookie.delete('tenantInfo')
'avatar', await this.$store.dispatch('user/logout')
'device', this.$router.push(`/login?redirect=${this.$route.fullPath}`)
'tenantList',
'tenantInfo'
])
}, },
watch: { async getTenantList() {
tenantInfo(newVal) { const userName = this.$cookie.get('userName')
this.tenant.tenantId = newVal.tenantId await user
this.tenant.resource = newVal.resource
console.log("ischangLang", newVal, this.tenantList)
}
},
methods: {
toggleSideBar() {
this.$store.dispatch('app/toggleSideBar')
},
async logout() {
this.$cookie.delete('userName')
this.$cookie.delete('tenantInfo')
await this.$store.dispatch('user/logout')
this.$router.push(`/login?redirect=${this.$route.fullPath}`)
},
async getTenantList() {
const userName = this.$cookie.get('userName')
await user
.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) => {
let query = {
...item,
tenantId: item.resource,
}
return query
})
if (response.role == 'ROLE_ADMIN') { if (response.role == 'ROLE_ADMIN') {
resources.unshift({ resourcesRes = [{
action: "rw", action: "rw",
resource: this.$t('common.allTenant'), resource: this.$t('common.allTenant'),
username: userName, username: userName,
tenantId: this.$t('common.allTenant'), tenantId: this.$t('common.allTenant'),
index: 0, }, ...resourcesRes]
})
} }
console.log("isTenList1111111", this.$t('common.allTenant'), resources, this.tenantList)
const resourcesRes = resources.map((item, index) => {
let query = {
...item,
tenantId: item.resource,
index: index,
}
console.log("=============", index, query, item)
return query
})
console.log("isTenList22222", resourcesRes, this.tenantList)
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) {
console.log("isTenList", this.tenantList)
let tenant = {
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.$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()
}, },
} changeTenant(id) {
const tenant = this.tenantList.find(item => item.tenantId === id)
this.currentTenant = id
this.$store.dispatch('tenant/setTenantInfo', tenant)
}
},
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.navbar { .navbar {
height: 50px; height: 50px;
overflow: hidden; overflow: hidden;
position: relative; position: relative;
background: #fff; background: #fff;
box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08); box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
.hamburger-container {
line-height: 46px;
height: 100%;
float: left;
cursor: pointer;
transition: background 0.3s;
-webkit-tap-highlight-color: transparent;
&:hover {
background: rgba(0, 0, 0, 0.025);
}
}
.hamburger-container { .breadcrumb-container {
line-height: 46px; float: left;
height: 100%; }
float: left;
cursor: pointer;
transition: background 0.3s;
-webkit-tap-highlight-color: transparent;
&:hover { .errLog-container {
background: rgba(0, 0, 0, 0.025); display: inline-block;
} vertical-align: top;
}
.right-menu {
float: right;
height: 100%;
line-height: 50px;
display: flex;
&:focus {
outline: none;
} }
.breadcrumb-container { ::v-deep .el-input__inner {
float: left; border: none;
box-shadow: none;
} }
.errLog-container { .select-tenant {
display: inline-block; margin-right: 20px;
vertical-align: top; border: 0;
width: 150px;
} }
.right-menu {
float: right; .right-menu-item {
display: inline-block;
padding: 0 8px;
height: 100%; height: 100%;
line-height: 50px; font-size: 18px;
display: flex; color: #5a5e66;
&:focus { vertical-align: text-bottom;
outline: none;
}
::v-deep .el-input__inner { &.hover-effect {
border: none; cursor: pointer;
box-shadow: none; transition: background 0.3s;
}
.select-tenant { &:hover {
margin-right: 20px; background: rgba(0, 0, 0, 0.025);
border: 0; }
width: 150px;
} }
}
.avatar-container {
margin-right: 30px;
.right-menu-item { .avatar-wrapper {
display: inline-block; margin-top: 5px;
padding: 0 8px; position: relative;
height: 100%;
font-size: 18px;
color: #5a5e66;
vertical-align: text-bottom;
&.hover-effect { .user-avatar {
cursor: pointer; cursor: pointer;
transition: background 0.3s; width: 40px;
height: 40px;
&:hover { border-radius: 10px;
background: rgba(0, 0, 0, 0.025);
}
} }
}
.avatar-container { .el-icon-caret-bottom {
margin-right: 30px; cursor: pointer;
position: absolute;
.avatar-wrapper { right: -20px;
margin-top: 5px; top: 25px;
position: relative; font-size: 12px;
.user-avatar {
cursor: pointer;
width: 40px;
height: 40px;
border-radius: 10px;
}
.el-icon-caret-bottom {
cursor: pointer;
position: absolute;
right: -20px;
top: 25px;
font-size: 12px;
}
} }
} }
} }
} }
</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