diff --git a/continew-starter-trace/pom.xml b/continew-starter-trace/pom.xml new file mode 100644 index 00000000..d805a58b --- /dev/null +++ b/continew-starter-trace/pom.xml @@ -0,0 +1,28 @@ + + + 4.0.0 + + top.continew + continew-starter + ${revision} + + + continew-starter-trace + ContiNew Starter 链路追踪模块 + + + + + top.continew + continew-starter-web + + + + + com.yomahub + tlog-web-spring-boot-starter + + + \ No newline at end of file diff --git a/continew-starter-web/src/main/java/top/continew/starter/web/autoconfigure/trace/TLogProperties.java b/continew-starter-trace/src/main/java/top/continew/starter/trace/autoconfigure/TLogProperties.java similarity index 97% rename from continew-starter-web/src/main/java/top/continew/starter/web/autoconfigure/trace/TLogProperties.java rename to continew-starter-trace/src/main/java/top/continew/starter/trace/autoconfigure/TLogProperties.java index ef49e48f..656cabb4 100644 --- a/continew-starter-web/src/main/java/top/continew/starter/web/autoconfigure/trace/TLogProperties.java +++ b/continew-starter-trace/src/main/java/top/continew/starter/trace/autoconfigure/TLogProperties.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package top.continew.starter.web.autoconfigure.trace; +package top.continew.starter.trace.autoconfigure; /** * TLog 配置属性 diff --git a/continew-starter-web/src/main/java/top/continew/starter/web/autoconfigure/trace/TraceAutoConfiguration.java b/continew-starter-trace/src/main/java/top/continew/starter/trace/autoconfigure/TraceAutoConfiguration.java similarity index 88% rename from continew-starter-web/src/main/java/top/continew/starter/web/autoconfigure/trace/TraceAutoConfiguration.java rename to continew-starter-trace/src/main/java/top/continew/starter/trace/autoconfigure/TraceAutoConfiguration.java index d1904010..faf32cf9 100644 --- a/continew-starter-web/src/main/java/top/continew/starter/web/autoconfigure/trace/TraceAutoConfiguration.java +++ b/continew-starter-trace/src/main/java/top/continew/starter/trace/autoconfigure/TraceAutoConfiguration.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package top.continew.starter.web.autoconfigure.trace; +package top.continew.starter.trace.autoconfigure; import com.yomahub.tlog.id.TLogIdGenerator; import com.yomahub.tlog.id.TLogIdGeneratorLoader; @@ -32,9 +32,11 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Primary; import org.springframework.core.Ordered; import top.continew.starter.core.constant.PropertiesConstants; +import top.continew.starter.trace.filter.TLogServletFilter; +import top.continew.starter.trace.handler.TraceIdGenerator; /** - * 链路跟踪自动配置 + * 链路追踪自动配置 * * @author Jasmine * @author Charles7c @@ -43,7 +45,7 @@ import top.continew.starter.core.constant.PropertiesConstants; @AutoConfiguration @ConditionalOnWebApplication @EnableConfigurationProperties(TraceProperties.class) -@ConditionalOnProperty(prefix = PropertiesConstants.WEB_TRACE, name = PropertiesConstants.ENABLED, havingValue = "true") +@ConditionalOnProperty(prefix = PropertiesConstants.TRACE, name = PropertiesConstants.ENABLED, havingValue = "true") public class TraceAutoConfiguration { private static final Logger log = LoggerFactory.getLogger(TraceAutoConfiguration.class); @@ -89,6 +91,6 @@ public class TraceAutoConfiguration { @PostConstruct public void postConstruct() { - log.debug("[ContiNew Starter] - Auto Configuration 'Web-Trace' completed initialization."); + log.debug("[ContiNew Starter] - Auto Configuration 'Trace' completed initialization."); } } diff --git a/continew-starter-web/src/main/java/top/continew/starter/web/autoconfigure/trace/TraceProperties.java b/continew-starter-trace/src/main/java/top/continew/starter/trace/autoconfigure/TraceProperties.java similarity index 90% rename from continew-starter-web/src/main/java/top/continew/starter/web/autoconfigure/trace/TraceProperties.java rename to continew-starter-trace/src/main/java/top/continew/starter/trace/autoconfigure/TraceProperties.java index 3db27d10..ea0e678d 100644 --- a/continew-starter-web/src/main/java/top/continew/starter/web/autoconfigure/trace/TraceProperties.java +++ b/continew-starter-trace/src/main/java/top/continew/starter/trace/autoconfigure/TraceProperties.java @@ -14,23 +14,23 @@ * limitations under the License. */ -package top.continew.starter.web.autoconfigure.trace; +package top.continew.starter.trace.autoconfigure; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.NestedConfigurationProperty; import top.continew.starter.core.constant.PropertiesConstants; /** - * 链路跟踪配置属性 + * 链路追踪配置属性 * * @author Charles7c * @since 1.3.0 */ -@ConfigurationProperties(PropertiesConstants.WEB_TRACE) +@ConfigurationProperties(PropertiesConstants.TRACE) public class TraceProperties { /** - * 是否启用链路跟踪配置 + * 是否启用链路追踪配置 */ private boolean enabled = false; diff --git a/continew-starter-web/src/main/java/top/continew/starter/web/autoconfigure/trace/TLogServletFilter.java b/continew-starter-trace/src/main/java/top/continew/starter/trace/filter/TLogServletFilter.java similarity index 93% rename from continew-starter-web/src/main/java/top/continew/starter/web/autoconfigure/trace/TLogServletFilter.java rename to continew-starter-trace/src/main/java/top/continew/starter/trace/filter/TLogServletFilter.java index 494855f3..3741f9e9 100644 --- a/continew-starter-web/src/main/java/top/continew/starter/web/autoconfigure/trace/TLogServletFilter.java +++ b/continew-starter-trace/src/main/java/top/continew/starter/trace/filter/TLogServletFilter.java @@ -14,13 +14,15 @@ * limitations under the License. */ -package top.continew.starter.web.autoconfigure.trace; +package top.continew.starter.trace.filter; import cn.hutool.core.text.CharSequenceUtil; import com.yomahub.tlog.context.TLogContext; import jakarta.servlet.*; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; +import top.continew.starter.trace.autoconfigure.TraceProperties; +import top.continew.starter.trace.handler.TLogWebCommon; import java.io.IOException; diff --git a/continew-starter-web/src/main/java/top/continew/starter/web/autoconfigure/trace/TLogWebCommon.java b/continew-starter-trace/src/main/java/top/continew/starter/trace/handler/TLogWebCommon.java similarity index 97% rename from continew-starter-web/src/main/java/top/continew/starter/web/autoconfigure/trace/TLogWebCommon.java rename to continew-starter-trace/src/main/java/top/continew/starter/trace/handler/TLogWebCommon.java index 74dd6791..2f190d07 100644 --- a/continew-starter-web/src/main/java/top/continew/starter/web/autoconfigure/trace/TLogWebCommon.java +++ b/continew-starter-trace/src/main/java/top/continew/starter/trace/handler/TLogWebCommon.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package top.continew.starter.web.autoconfigure.trace; +package top.continew.starter.trace.handler; import com.yomahub.tlog.constant.TLogConstants; import com.yomahub.tlog.core.rpc.TLogLabelBean; diff --git a/continew-starter-web/src/main/java/top/continew/starter/web/autoconfigure/trace/TraceIdGenerator.java b/continew-starter-trace/src/main/java/top/continew/starter/trace/handler/TraceIdGenerator.java similarity index 94% rename from continew-starter-web/src/main/java/top/continew/starter/web/autoconfigure/trace/TraceIdGenerator.java rename to continew-starter-trace/src/main/java/top/continew/starter/trace/handler/TraceIdGenerator.java index 0c9edfa3..da4c6f5e 100644 --- a/continew-starter-web/src/main/java/top/continew/starter/web/autoconfigure/trace/TraceIdGenerator.java +++ b/continew-starter-trace/src/main/java/top/continew/starter/trace/handler/TraceIdGenerator.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package top.continew.starter.web.autoconfigure.trace; +package top.continew.starter.trace.handler; import com.yomahub.tlog.id.TLogIdGenerator; import com.yomahub.tlog.id.snowflake.UniqueIdGenerator; diff --git a/continew-starter-trace/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/continew-starter-trace/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 00000000..9c6c5e03 --- /dev/null +++ b/continew-starter-trace/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +top.continew.starter.trace.autoconfigure.TraceAutoConfiguration \ No newline at end of file