Skip to content

Commit

Permalink
Merge pull request #67 from hanbingleixue/2.0.x
Browse files Browse the repository at this point in the history
Fix the issue of first plugin packaging failure for version 2.0.0
  • Loading branch information
lilai23 authored Jul 8, 2024
2 parents b5983bd + 184e4b0 commit 4300f62
Show file tree
Hide file tree
Showing 10 changed files with 118 additions and 97 deletions.
5 changes: 3 additions & 2 deletions first-plugin-demo/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.huaweicloud.sermant</groupId>
<groupId>io.sermant</groupId>
<artifactId>first-plugin-demo</artifactId>
<version>1.2.0</version>
<version>2.0.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>application</artifactId>
Expand Down
141 changes: 80 additions & 61 deletions first-plugin-demo/config/config.properties
Original file line number Diff line number Diff line change
@@ -1,96 +1,115 @@
#=============================字节码增强配置==============================
# 字节码增强重转换开关, 开启则可以支持对已加载的类通过重转换进行字节码增强, 默认值为true
#=============================bytecode enhancement configuration==============================#
# ReTransform switch. If enabled, bytecode enhancement can be performed on loaded classes by ReTransform. The default value is true.
agent.config.isReTransformEnable=true
# 字节码增强日志输出开关, 开启则会将字节码增强相关日志输出到日志文件, 默认值为false
# If this function is enabled, logs related to bytecode enhancement will be output to log files. The default value is false.
agent.config.isShowEnhanceLog=false
# 被增强类字节码输出开关, 开启则会将增强后的字节码以文件的形式进行输出, 默认值为false
# Enhanced class bytecode output switch. If this switch is enabled, the enhanced bytecode is output as a file. The default value is false
agent.config.isOutputEnhancedClasses=false
# 被增强类字节码输出位置配置, 配置后会将增强后的字节码以文件的形式输出到该配置指定目录, 不配置则默认为agent/enhancedClasses
# The enhanced bytecode output location of the enhanced class. If this parameter is not configured, it is agent/enhancedClasses by default
agent.config.enhancedClassesOutputPath=
# 拦截器执行时使用线程上下文类加载器辅助加载宿主服务类的开关, 开启则会在拦截器执行中通过线程上下文类加载器辅助加载宿主类, 用于服务治理逻辑使用, 默认值为true
# Enable the host service instance class to be loaded by the thread context classloader during interceptor execution. If enabled, the host class is loaded by the context classloader during interceptor execution for service governance logic use. The default value is true.
agent.config.useContextLoader=true
# 字节码增强时对类进行查找时需忽略的类的前缀列表, 如果某些类不希望被字节码增强, 则可以通过该配置项进行配置
agent.config.ignoredPrefixes=com.huawei.sermant,com.huaweicloud.sermant
# 字节码增强时对类进行查找时需要忽略的接口的列表, 如果某些接口的全部实现类都不希望被字节码增强, 则可以通过该配置项进行配置
# List of class prefixes that need be ignored when bytecode enhancement is performed.
agent.config.ignoredPrefixes=io.sermant
# List of interfaces that need to be ignored when bytecode enhancement is used to search for a class. If all implementation classes of an interface do not want to be bytecode enhanced, you can configure this configuration item
agent.config.ignoredInterfaces=org.springframework.cglib.proxy.Factory
# 指定插件服务中允许被字节码增强的类(插件服务中的类默认不允许被字节码增强)
agent.config.serviceInjectList=com.huawei.discovery.service.lb.filter.NopInstanceFilter,com.huawei.discovery.service.lb.DiscoveryManager,com.huawei.discovery.service.util.ApplyUtil,com.huawei.discovery.service.lb.cache.InstanceCacheManager
#============================= 核心服务配置 =============================#
# 心跳服务开关
# Specifies which classes in the plugins are allowed to be bytecode enhanced (classes in the plugins are not allowed to be bytecode enhanced by default)
agent.config.serviceInjectList=io.sermant.discovery.service.lb.filter.NopInstanceFilter,io.sermant.discovery.service.lb.DiscoveryManager,io.sermant.discovery.service.util.ApplyUtil,io.sermant.discovery.service.lb.cache.InstanceCacheManager
# Generate unmatched class name to file, used to reduce startup time for the second time and after
agent.config.preFilter.enable=false
# Path of unmatched class name file, the default path is the same directory of sermant-agent.jar
agent.config.preFilter.path=
# File name of unmatched class name, the default file is 'unmatched_class_name.txt'
agent.config.preFilter.file=
#============================= core service configuration =============================#
# Heartbeat service switch
agent.service.heartbeat.enable=false
# 统一网关服务开关
# Gateway service switch
agent.service.gateway.enable=false
# 链路标记服务开关
# Tracing service switch
agent.service.tracing.enable=false
# Spring注入服务开关
agent.service.inject.enable=false
# 动态配置服务开关
# Spring inject service switch
agent.service.inject.enable=true
# Dynamic config service switch
agent.service.dynamic.config.enable=true
#============================= 事件系统配置 =============================#
# 事件系统开关
# HTTP server switch
agent.service.httpserver.enable=false
# xDS service switch
agent.service.xds.service.enable=false
#============================= Event configuration =============================#
# Event switch
event.enable=false
# Warn级别日志事件上报开关
# Report warn log switch
event.offerWarnLog=false
# Error级别日志事件上报开关
# Report error log switch
event.offerErrorLog=false
# 事件发送间隔时间, 指定事件向Sermant Backend发送的间隔时间(ms)
# Event sending interval, specifying the interval (ms) for events to be sent to Sermant Backend
event.sendInterval=30000
# 指定相同事件记录时间间隔, 在一定时间内重复事件压缩(ms)
# Specify the same event recording interval to repeat event compression (ms) over a certain period of time
event.offerInterval=300000
# 内部事件通知开关
# Internal event notification switch
notification.enable=false
#=============================动态配置服务配置=============================#
# 指定配置读取超时时间(ms)
#=============================Dynamic config service configuration =============================#
# Specify config read timeout (ms)
dynamic.config.timeoutValue=30000
# 指定配置的默认组
# Specify the default group for the config
dynamic.config.defaultGroup=sermant
# 指定配置中心的服务端地址
# Specify the server address of the configuration center
dynamic.config.serverAddress=127.0.0.1:2181
# 指定动态配置中心类型, 取值范围为NOP(无实现)、ZOOKEEPERKIENACOS
# Specify the type of dynamic configuration center. The value can be NOP(no implementation), ZOOKEEPER, KIE, or NACOS
dynamic.config.dynamicConfigType=ZOOKEEPER
# 指定在启动Sermant时的配置中心的重连次数
# Specify the number of reconnections to the configuration center when Sermant is started
dynamic.config.connectRetryTimes=5
# 指定在启动Sermant时连接配置中心的超时时间(ms)
# Specify the timeout (ms) of connection to the configuration center when Sermant is started
dynamic.config.connectTimeout=1000
# 指定是否开启配置中心授权, 开启后需验证用户名密码
# Specify whether to enable the authorization of the configuration center. If enable authorization, you need to verify the user name and password
dynamic.config.enableAuth=false
# 指定连接动态配置中心时的用户名
# Specify the user name for connecting to the dynamic configuration center
dynamic.config.userName=
# 指定连接动态配置中心时的密码
# Specify the password for connecting to the dynamic configuration center
dynamic.config.password=
# 指定为用户名和密码进行加解密的密钥
# Specify the AES privateKey that encrypts and decrypts the password
dynamic.config.privateKey=
# 指定获取配置的请求超时时间(ms)
# Specify the request timeout time (ms) to get the configuration
dynamic.config.requestTimeout=3000
#=============================心跳服务配置===============================#
# 指定心跳时间间隔(ms)
#=============================Heartbeat service configuration===============================#
# Specify Heartbeat Interval (ms)
heartbeat.interval=30000
#=============================Spring注入服务配置=========================#
# Spring注入服务所需依赖的包
inject.essentialPackage=com.huawei.sermant,com.huaweicloud.sermant,com.huawei.dynamic.config,com.huawei.flowcontrol,com.huaweicloud.loadbalancer,com.huawei.monitor,com.huawei.dubbo.registry,com.huawei.registry,com.huaweicloud.visibility,com.huawei.discovery
#=============================统一网关配置===============================#
# 指定统一网关对接的Netty服务端IP
#=============================Spring inject service configuration=========================#
# The packages needed for Spring inject service
inject.essentialPackage=io.sermant,io.sermant.dynamic.config,io.sermant.flowcontrol,io.sermant.loadbalancer,io.sermant.monitor,io.sermant.dubbo.registry,io.sermant.registry,io.sermant.visibility,io.sermant.discovery
#=============================Gateway service configuration===============================#
# Specify the IP address of Netty server
gateway.nettyIp=127.0.0.1
# 指定统一网关对接的Netty服务端端口
# Specify the port of Netty server
gateway.nettyPort=6888
# 指定统一网关对接的Netty服务端连接超时时间(ms)
gateway.nettyConnectTimeout=5000
# 指定统一网关对接的Netty客户端读写等待时间(ms)
gateway.nettyWriteAndReadWaitTime=60000
# 指定统一网关数据向服务端发送的间隔时间(s)
gateway.sendInternalTime=10
# 指定统一网关重连退避算法初始连接间隔(s)
gateway.initReconnectInternalTime=5
# 指定统一网关重连退避算法最大连接间隔(s)
gateway.maxReconnectInternalTime=180
#=============================元数据配置================================#
# 指定应用名称, 用于服务注册等服务治理场景
# Specify the Netty server connection timeout duration (ms)
#gateway.nettyConnectTimeout=5000
# Specify read/write wait time of Netty (ms).
#gateway.nettyWriteAndReadWaitTime=60000
# Specify the interval that data sent to the server (s).
#gateway.sendInternalTime=10
# Specify retreat algorithm initial connection interval (s)
#gateway.initReconnectInternalTime=5
# Specify retreat algorithm maximum connection interval (s)
#gateway.maxReconnectInternalTime=180
#=============================xds configuration===============================#
# istiod control plane address, security.enable=false with 15010 port, and security.enable=true with 15012 port
xds.config.control.plane.address=istiod.istio-system.svc:15010
# Whether to use secure communication with the control plane
xds.config.security.enable=false
# service account token used for secure communication with the control plane
xds.config.service.account.token.path=/var/run/secrets/kubernetes.io/serviceaccount/token
#=============================Metadata===============================#
# Service name for host service instance
service.meta.service=default
# Application name for host service instance, used in service governance scenarios such as service registration and label routing
service.meta.application=default
# 指定服务版本, 用于服务注册、标签路由等服务治理场景
# Version for host service instance, used in service governance scenarios such as service registration and label routing
service.meta.version=1.0.0
# 指定服务命名空间, 用于服务注册等服务治理场景
# Namespace for host service instance, used in service governance scenarios such as service registration and label routing
service.meta.project=default
# 指定服务所在环境, 用于服务注册等服务治理场景
# Environment for host service instance, used in service governance scenarios such as service registration and label routing
service.meta.environment=
# 指定服务所在az(可用区), 用于服务注册、标签路由等服务治理场景
# Availability Zone for host service instance, used in service governance scenarios such as service registration and label routing
service.meta.zone=
4 changes: 2 additions & 2 deletions first-plugin-demo/pom.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.huaweicloud.sermant</groupId>
<groupId>io.sermant</groupId>
<artifactId>first-plugin-demo</artifactId>
<version>1.2.0</version>
<version>2.0.0</version>

<packaging>pom</packaging>

Expand Down
15 changes: 8 additions & 7 deletions first-plugin-demo/template/pom.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>com.huaweicloud.sermant</groupId>
<groupId>io.sermant</groupId>
<artifactId>first-plugin-demo</artifactId>
<version>1.2.0</version>
<version>2.0.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down Expand Up @@ -94,7 +95,7 @@
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.huaweicloud.sermant</groupId>
<groupId>io.sermant</groupId>
<artifactId>sermant-agentcore-premain</artifactId>
<version>${project.version}</version>
<type>jar</type>
Expand All @@ -103,31 +104,31 @@
<destFileName>sermant-agent.jar</destFileName>
</artifactItem>
<artifactItem>
<groupId>com.huaweicloud.sermant</groupId>
<groupId>io.sermant</groupId>
<artifactId>sermant-agentcore-core</artifactId>
<version>${project.version}</version>
<type>jar</type>
<overWrite>false</overWrite>
<outputDirectory>${output.basedir}/agent/core</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>com.huaweicloud.sermant</groupId>
<groupId>io.sermant</groupId>
<artifactId>sermant-agentcore-implement</artifactId>
<version>${project.version}</version>
<type>jar</type>
<overWrite>false</overWrite>
<outputDirectory>${output.basedir}/agent/implement</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>com.huaweicloud.sermant</groupId>
<groupId>io.sermant</groupId>
<artifactId>sermant-common</artifactId>
<version>${project.version}</version>
<type>jar</type>
<overWrite>false</overWrite>
<outputDirectory>${output.basedir}/agent/common</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>com.huaweicloud.sermant</groupId>
<groupId>io.sermant</groupId>
<artifactId>sermant-agentcore-god</artifactId>
<version>${project.version}</version>
<type>jar</type>
Expand Down
7 changes: 4 additions & 3 deletions first-plugin-demo/template/template-plugin/pom.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>com.huaweicloud.sermant</groupId>
<groupId>io.sermant</groupId>
<artifactId>template</artifactId>
<version>1.2.0</version>
<version>2.0.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand All @@ -20,7 +21,7 @@

<dependencies>
<dependency>
<groupId>com.huaweicloud.sermant</groupId>
<groupId>io.sermant</groupId>
<artifactId>sermant-agentcore-core</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package com.huaweicloud.sermant.template;
package io.sermant.template;

import com.huaweicloud.sermant.core.plugin.agent.declarer.AbstractPluginDeclarer;
import com.huaweicloud.sermant.core.plugin.agent.declarer.InterceptDeclarer;
import com.huaweicloud.sermant.core.plugin.agent.entity.ExecuteContext;
import com.huaweicloud.sermant.core.plugin.agent.interceptor.Interceptor;
import com.huaweicloud.sermant.core.plugin.agent.matcher.ClassMatcher;
import com.huaweicloud.sermant.core.plugin.agent.matcher.MethodMatcher;
import io.sermant.core.plugin.agent.declarer.AbstractPluginDeclarer;
import io.sermant.core.plugin.agent.declarer.InterceptDeclarer;
import io.sermant.core.plugin.agent.matcher.ClassMatcher;
import io.sermant.core.plugin.agent.matcher.MethodMatcher;

/**
* 模板字节码增强声明
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package com.huaweicloud.sermant.template;
package io.sermant.template;

import com.huaweicloud.sermant.core.common.LoggerFactory;
import com.huaweicloud.sermant.core.operation.OperationManager;
import com.huaweicloud.sermant.core.operation.converter.api.YamlConverter;
import com.huaweicloud.sermant.core.plugin.agent.entity.ExecuteContext;
import com.huaweicloud.sermant.core.plugin.agent.interceptor.Interceptor;
import com.huaweicloud.sermant.core.service.ServiceManager;
import com.huaweicloud.sermant.core.service.dynamicconfig.DynamicConfigService;
import com.huaweicloud.sermant.core.service.dynamicconfig.common.DynamicConfigEvent;
import com.huaweicloud.sermant.core.service.dynamicconfig.common.DynamicConfigListener;
import io.sermant.core.common.LoggerFactory;
import io.sermant.core.operation.OperationManager;
import io.sermant.core.operation.converter.api.YamlConverter;
import io.sermant.core.plugin.agent.entity.ExecuteContext;
import io.sermant.core.plugin.agent.interceptor.Interceptor;
import io.sermant.core.service.ServiceManager;
import io.sermant.core.service.dynamicconfig.DynamicConfigService;
import io.sermant.core.service.dynamicconfig.common.DynamicConfigEvent;
import io.sermant.core.service.dynamicconfig.common.DynamicConfigListener;

import java.util.HashMap;
import java.util.Map;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
io.sermant.template.TemplateDeclarer
Loading

0 comments on commit 4300f62

Please sign in to comment.