dubbo traceID 完成
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package com.czg.config;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.dubbo.common.Constants;
|
||||
import org.apache.dubbo.common.constants.CommonConstants;
|
||||
import org.apache.dubbo.common.extension.Activate;
|
||||
import org.apache.dubbo.rpc.*;
|
||||
import org.slf4j.MDC;
|
||||
@@ -10,7 +10,7 @@ import org.slf4j.MDC;
|
||||
* @author ww
|
||||
* @description
|
||||
*/
|
||||
@Activate(group = Constants.CONSUMER)
|
||||
@Activate(group = CommonConstants.CONSUMER)
|
||||
public class TraceConsumerFilter implements Filter {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
package com.czg.config;
|
||||
|
||||
import org.slf4j.MDC;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author ww
|
||||
* @description
|
||||
*/
|
||||
public class TraceContext {
|
||||
private static final String TRACE_ID = "traceId";
|
||||
|
||||
public static void setTraceId(String traceId) {
|
||||
MDC.put(TRACE_ID, traceId);
|
||||
}
|
||||
|
||||
public static String getTraceId() {
|
||||
return MDC.get(TRACE_ID);
|
||||
}
|
||||
|
||||
public static void clear() {
|
||||
MDC.clear();
|
||||
}
|
||||
|
||||
public static String generateTraceId() {
|
||||
return UUID.randomUUID().toString().replace("-", "");
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,8 @@
|
||||
package com.czg.config;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import org.apache.dubbo.common.constants.CommonConstants;
|
||||
import org.apache.dubbo.rpc.*;
|
||||
|
||||
import com.alibaba.dubbo.common.Constants;
|
||||
import org.apache.dubbo.common.extension.Activate;
|
||||
import org.slf4j.MDC;
|
||||
|
||||
@@ -11,7 +10,7 @@ import org.slf4j.MDC;
|
||||
* @author ww
|
||||
* @description
|
||||
*/
|
||||
@Activate(group = Constants.PROVIDER)
|
||||
@Activate(group = CommonConstants.PROVIDER)
|
||||
public class TraceProviderFilter implements Filter {
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user