-
Notifications
You must be signed in to change notification settings - Fork 799
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ISSUE #483] Virtual thread compatible #506
Changes from 22 commits
f5f25f5
cc83c79
0d0c160
74f64c6
17a913b
706d887
f05dd26
a85826c
4a93554
4495be0
a729e11
6a1e1a9
3755c8b
db44cd8
0a38447
f4b5804
c791fd2
ebc5e0e
e29ebd4
554f3f1
3dc7ee6
0b18056
4154092
d9b5d4d
119d2e2
7944b9b
33a4214
fe40c63
f449863
c40e854
4027731
2f7a99d
a812aff
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.dromara.dynamictp.common.entity; | ||
|
||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
|
||
/** | ||
* ClassName: VTExecutorStats | ||
* Package: org.dromara.dynamictp.common.entity | ||
* Description: | ||
* | ||
* @author CYC | ||
* @create 2024/11/4 16:52 | ||
*/ | ||
@Data | ||
@EqualsAndHashCode(callSuper = true) | ||
public class VTExecutorStats extends Metrics { | ||
|
||
/** | ||
* 虚拟线程执行器名字 | ||
*/ | ||
private String executorName; | ||
|
||
/** | ||
* 虚拟线程执行器别名 | ||
*/ | ||
private String executorAliasName; | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ | |
import com.google.common.collect.Maps; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.dromara.dynamictp.common.entity.ThreadPoolStats; | ||
import org.dromara.dynamictp.common.entity.VTExecutorStats; | ||
import org.dromara.dynamictp.common.util.ExtensionServiceLoader; | ||
import org.dromara.dynamictp.core.monitor.collector.InternalLogCollector; | ||
import org.dromara.dynamictp.core.monitor.collector.LogCollector; | ||
|
@@ -44,7 +45,7 @@ public final class CollectorHandler { | |
|
||
private CollectorHandler() { | ||
List<MetricsCollector> loadedCollectors = ExtensionServiceLoader.get(MetricsCollector.class); | ||
loadedCollectors.forEach(collector -> COLLECTORS.put(collector.type().toLowerCase(), collector)); | ||
loadedCollectors.forEach(collector -> COLLECTORS.put(collector.type(), collector)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 解决冲突有问题?toLowerCase()咋删了 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 没印象了😂 |
||
|
||
MetricsCollector microMeterCollector = new MicroMeterCollector(); | ||
LogCollector logCollector = new LogCollector(); | ||
|
@@ -68,6 +69,18 @@ public void collect(ThreadPoolStats poolStats, List<String> types) { | |
} | ||
} | ||
|
||
public void collectVTExecutor(VTExecutorStats vtExecutorStats, List<String> types) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 不要单独收集了了,复用一套就行,重复代码太多,看着好不舒服 |
||
if (vtExecutorStats == null || CollectionUtils.isEmpty(types)) { | ||
return; | ||
} | ||
for (String collectorType : types) { | ||
MetricsCollector collector = COLLECTORS.get(collectorType.toLowerCase()); | ||
if (collector != null) { | ||
collector.collect(vtExecutorStats); | ||
} | ||
} | ||
} | ||
|
||
public static CollectorHandler getInstance() { | ||
return CollectorHandlerHolder.INSTANCE; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不要单独建VTExecutorStats,还是复用之前的ThreadPoolStats,可以改名为ExecutorStats,新加executorName、executorAliasName字段,同时保留poolName、poolAliasName,并设置为@deprecated,在后续版本移除掉