Skip to content
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

JDK17支持:升级Lombok版本、ByteBuddy版本、新增Shenandoah收集器指标信息 #1293

Merged
merged 1 commit into from
Sep 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<xerces.version>2.12.1</xerces.version>
<snake.yaml.version>1.32</snake.yaml.version>
<zookeeper.version>3.6.3</zookeeper.version>
<lombok.version>1.18.10</lombok.version>
<lombok.version>1.18.22</lombok.version>
<asm.version>8.0.1</asm.version>
<common.io.version>1.3.2</common.io.version>
<org.jacoco.version>0.8.8</org.jacoco.version>
Expand Down
2 changes: 1 addition & 1 deletion sermant-agentcore/sermant-agentcore-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<sermant.basedir>${pom.basedir}/../..</sermant.basedir>
<package.temp.dir>${sermant.basedir}/${sermant.name}-${project.version}</package.temp.dir>

<byte.buddy.version>1.10.14</byte.buddy.version>
<byte.buddy.version>1.12.19</byte.buddy.version>

<shade.plugin.version>3.2.4</shade.plugin.version>
<source.plugin.version>3.0.1</source.plugin.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,10 @@ public void addEnhance(AbstractPluginDeclarer pluginDeclarer) {

@Override
public Builder<?> transform(Builder<?> builder, TypeDescription typeDescription,
ClassLoader classLoader, JavaModule module) {
ClassLoader classLoader,
JavaModule module, ProtectionDomain protectionDomain) {
return new DefaultTransformer(abstractPluginDeclarer.getInterceptDeclarers(classLoader))
.transform(builder, typeDescription, classLoader, module);
.transform(builder, typeDescription, classLoader, module, protectionDomain);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@
import com.huaweicloud.sermant.core.plugin.agent.transformer.DefaultTransformer;

import net.bytebuddy.description.type.TypeDescription;
import net.bytebuddy.dynamic.DynamicType;
import net.bytebuddy.dynamic.DynamicType.Builder;
import net.bytebuddy.matcher.ElementMatcher;
import net.bytebuddy.utility.JavaModule;

import java.security.ProtectionDomain;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
Expand Down Expand Up @@ -117,10 +118,11 @@ public boolean matches(TypeDescription target) {
}

@Override
public DynamicType.Builder<?> transform(DynamicType.Builder<?> builder, TypeDescription typeDescription,
ClassLoader classLoader, JavaModule module) {
public Builder<?> transform(Builder<?> builder, TypeDescription typeDescription,
ClassLoader classLoader,
JavaModule module, ProtectionDomain protectionDomain) {
return new DefaultTransformer(declarer.getInterceptDeclarers(classLoader))
.transform(builder, typeDescription, classLoader, module);
.transform(builder, typeDescription, classLoader, module, protectionDomain);
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@
import net.bytebuddy.description.method.MethodList;
import net.bytebuddy.description.type.TypeDescription;
import net.bytebuddy.dynamic.DynamicType;
import net.bytebuddy.dynamic.DynamicType.Builder;
import net.bytebuddy.matcher.ElementMatchers;
import net.bytebuddy.utility.JavaModule;

import java.lang.reflect.InvocationTargetException;
import java.security.ProtectionDomain;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
Expand Down Expand Up @@ -68,12 +70,13 @@ public DefaultTransformer(InterceptDeclarer[] interceptDeclarers) {
}

@Override
public DynamicType.Builder<?> transform(DynamicType.Builder<?> builder, TypeDescription typeDesc,
ClassLoader classLoader, JavaModule module) {
public Builder<?> transform(Builder<?> builder, TypeDescription typeDescription,
ClassLoader classLoader,
JavaModule module, ProtectionDomain protectionDomain) {
if (interceptDeclarers == null || interceptDeclarers.length == 0) {
return builder;
}
return enhanceMethods(builder, typeDesc, classLoader);
return enhanceMethods(builder, typeDescription, classLoader);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion sermant-backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<io.netty.version>4.1.86.Final</io.netty.version>
<spring-boot.version>2.6.1</spring-boot.version>
<protobuf-java.version>3.9.1</protobuf-java.version>
<lombok.version>1.18.12</lombok.version>
<lombok.version>1.18.22</lombok.version>
<fastjson.version>1.2.83</fastjson.version>
<commons-lang.version>2.6</commons-lang.version>
<junit.version>4.13.1</junit.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
* @since 2022-08-02
*/
public enum MetricEnum {

/**
* JVM内存指标信息
*/
Expand Down Expand Up @@ -75,26 +74,6 @@ public enum MetricEnum {
*/
NON_HEAP_MEMORY_COMMITTED("non_heap_memory_committed", "the number is committed of non heap memory"),

/**
* codeCache初始值
*/
CODE_CACHE_INIT("code_cache_init", "the number is init of code cache"),

/**
* codecCache 最大值
*/
CODE_CACHE_MAX("code_cache_max", "the number is max of code cache"),

/**
* codeCache使用值
*/
CODE_CACHE_USED("code_cache_used", "the number is used of code cache"),

/**
* codeCache提交值
*/
CODE_CACHE_COMMITTED("code_cache_committed", "the committed is init of code cache"),

/**
* meta space 初始值
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
/*
* Copyright (C) 2023-2023 Huawei Technologies Co., Ltd. All rights reserved.
*
* Licensed 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 com.huaweicloud.integration.common;

/**
* JDK12及以上版本独有性能指标枚举类
*
* @author tangle
* @version 1.0.0
* @since 2023-09-04
*/
public enum MetricEnumJDK12 {
/**
* JDK9存储其他类型编译代码的codeCache初始值
*/
NON_NMETHODS_INIT("non_nmethods_init", "the number is init of non_nmethods"),

/**
* JDK9存储其他类型编译代码的codeCache使用值
*/
NON_NMETHODS_USED("non_nmethods_used", "the number is used of non_nmethods"),

/**
* JDK9存储其他类型编译代码的codeCache最大值
*/
NON_NMETHODS_MAX("non_nmethods_max", "the number is max of non_nmethods"),

/**
* JDK9存储其他类型编译代码的codeCache提交值
*/
NON_NMETHODS_COMMITTED("non_nmethods_committed", "the number is committed of non_nmethods"),

/**
* JDK9存储经过性能分析的编译代码的codeCache初始值
*/
PROFILED_NMETHODS_INIT("profiled_nmethods_init", "the number is init of profiled nmethods"),

/**
* JDK9存储经过性能分析的编译代码的codeCache使用值
*/
PROFILED_NMETHODS_USED("profiled_nmethods_used", "the number is used of profiled nmethods"),

/**
* JDK9存储经过性能分析的编译代码的codeCache最大值
*/
PROFILED_NMETHODS_MAX("profiled_nmethods_max", "the number is max of profiled nmethods"),

/**
* JDK9存储经过性能分析的编译代码的codeCache提交值
*/
PROFILED_NMETHODS_COMMITTED("profiled_nmethods_committed", "the number is committed of profiled nmethods"),

/**
* JDK9存储未经过性能分析的编译代码的codeCache初始值
*/
NON_PROFILED_NMETHODS_INIT("non_profiled_nmethods_init", "the number is init of non-profiled nmethods"),

/**
* JDK9存储未经过性能分析的编译代码的codeCache使用值
*/
NON_PROFILED_NMETHODS_USED("non_profiled_nmethods_used", "the number is used of non-profiled nmethods"),

/**
* JDK9存储未经过性能分析的编译代码的codeCache最大值
*/
NON_PROFILED_NMETHODS_MAX("non_profiled_nmethods_max", "the number is max of non-profiled nmethods"),

/**
* JDK9存储未经过性能分析的编译代码的codeCache提交值
*/
NON_PROFILED_NMETHODS_COMMITTED("non_profiled_nmethods_committed",
"the number is committed of non-profiled nmethods"),

/**
* JDK9的Epsilon收集器初始值
*/
EPSILON_HEAP_INIT("epsilon_heap_init", "the number is init of Epsilon Heap"),

/**
* JDK9的Epsilon收集器使用值
*/
EPSILON_HEAP_USED("epsilon_heap_used", "the number is used of Epsilon Heap"),

/**
* JDK9的Epsilon收集器最大值
*/
EPSILON_HEAP_MAX("epsilon_heap_max", "the number is max of Epsilon Heap"),

/**
* JDK9的Epsilon收集器提交值
*/
EPSILON_HEAP_COMMITTED("epsilon_heap_committed", "the number is committed of Epsilon Heap"),
/**
* JDK12的Shenandoah收集器初始值
*/
SHENANDOAH_INIT("shenandoah_init", "the number is init of Shenandoah"),

/**
* JDK12的Shenandoah收集器使用值
*/
SHENANDOAH_USED("shenandoah_used", "the number is used of Shenandoah"),

/**
* JDK12的Shenandoah收集器最大值
*/
SHENANDOAH_MAX("shenandoah_max", "the number is max of Shenandoah"),

/**
* JDK12的Shenandoah收集器提交值
*/
SHENANDOAH_COMMITTED("shenandoah_committed", "the number is committed of Shenandoah");

/**
* 名称
*/
private String name;

/**
* 描述
*/
private String disc;

MetricEnumJDK12(String name, String disc) {
this.name = name;
this.disc = disc;
}

public String getName() {
return name;
}

public String getDisc() {
return disc;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
* Copyright (C) 2023-2023 Huawei Technologies Co., Ltd. All rights reserved.
*
* Licensed 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 com.huaweicloud.integration.common;

/**
* JDK8独有性能指标枚举类
*
* @author tangle
* @version 1.0.0
* @since 2023-09-04
*/
public enum MetricEnumJDK8 {
/**
* codeCache初始值
*/
CODE_CACHE_INIT("code_cache_init", "the number is init of code cache"),

/**
* codecCache 最大值
*/
CODE_CACHE_MAX("code_cache_max", "the number is max of code cache"),

/**
* codeCache使用值
*/
CODE_CACHE_USED("code_cache_used", "the number is used of code cache"),

/**
* codeCache提交值
*/
CODE_CACHE_COMMITTED("code_cache_committed", "the committed is init of code cache");

/**
* 名称
*/
private String name;

/**
* 描述
*/
private String disc;

MetricEnumJDK8(String name, String disc) {
this.name = name;
this.disc = disc;
}

public String getName() {
return name;
}

public String getDisc() {
return disc;
}
}
Loading
Loading