|
22 | 22 | import com.navercorp.pinpoint.common.annotations.VisibleForTesting;
|
23 | 23 | import com.navercorp.pinpoint.common.util.CollectionUtils;
|
24 | 24 | import com.navercorp.pinpoint.common.util.IntStringValue;
|
| 25 | +import com.navercorp.pinpoint.common.util.StringUtils; |
25 | 26 | import com.navercorp.pinpoint.grpc.trace.PAcceptEvent;
|
26 | 27 | import com.navercorp.pinpoint.grpc.trace.PAnnotation;
|
27 | 28 | import com.navercorp.pinpoint.grpc.trace.PAnnotationValue;
|
|
58 | 59 | * @author Woonduk Kang(emeroad)
|
59 | 60 | */
|
60 | 61 | public class GrpcSpanMessageConverter implements MessageConverter<SpanType, GeneratedMessageV3> {
|
| 62 | + public static final String DEFAULT_END_POINT = "UNKNOWN"; |
| 63 | + public static final String DEFAULT_RPC_NAME = "UNKNOWN"; |
| 64 | + public static final String DEFAULT_REMOTE_ADDRESS = "UNKNOWN"; |
61 | 65 |
|
62 | 66 | private final String agentId;
|
63 | 67 | private final short applicationServiceType;
|
@@ -170,10 +174,13 @@ private boolean isCompressedType(TraceId traceId) {
|
170 | 174 | private PAcceptEvent newAcceptEvent(Span span) {
|
171 | 175 | PAcceptEvent.Builder builder = PAcceptEvent.newBuilder();
|
172 | 176 |
|
173 |
| - builder.setRemoteAddr(span.getRemoteAddr()); |
| 177 | + final String remoteAddr = StringUtils.defaultIfEmpty(span.getRemoteAddr(), DEFAULT_REMOTE_ADDRESS); |
| 178 | + builder.setRemoteAddr(remoteAddr); |
174 | 179 | final Shared shared = span.getTraceRoot().getShared();
|
175 |
| - builder.setRpc(shared.getRpcName()); |
176 |
| - builder.setEndPoint(shared.getEndPoint()); |
| 180 | + final String rpc = StringUtils.defaultIfEmpty(shared.getRpcName(), DEFAULT_RPC_NAME); |
| 181 | + builder.setRpc(rpc); |
| 182 | + final String endPoint = StringUtils.defaultIfEmpty(shared.getEndPoint(), DEFAULT_END_POINT); |
| 183 | + builder.setEndPoint(endPoint); |
177 | 184 |
|
178 | 185 | PParentInfo pParentInfo = newParentInfo(span);
|
179 | 186 | if (pParentInfo != null) {
|
|
0 commit comments