修复部分问题

This commit is contained in:
ascrutae 2017-01-13 11:39:30 +08:00
parent 038811a151
commit b91d681dca
1 changed files with 13 additions and 0 deletions

View File

@ -14,4 +14,17 @@ public class TraceIdUtil {
return traceIdBuilder.substring(0, traceIdBuilder.length() - 1).toString();
}
public static TraceId toTraceId(String traceId) {
String[] traceIdSegment = traceId.split("\\.");
TraceId.Builder builder = TraceId.newBuilder();
for (String segment : traceIdSegment) {
builder = builder.addSegments(Long.parseLong(segment));
}
return builder.build();
}
}