Skip to content

Commit

Permalink
[pinpoint-apm#9187] Fix span dispatch failed
Browse files Browse the repository at this point in the history
  • Loading branch information
jaehong-kim authored and BillionaireDY committed Dec 29, 2022
1 parent 4256477 commit 8e3a6e9
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.navercorp.pinpoint.common.annotations.VisibleForTesting;
import com.navercorp.pinpoint.common.util.CollectionUtils;
import com.navercorp.pinpoint.common.util.IntStringValue;
import com.navercorp.pinpoint.common.util.StringUtils;
import com.navercorp.pinpoint.grpc.trace.PAcceptEvent;
import com.navercorp.pinpoint.grpc.trace.PAnnotation;
import com.navercorp.pinpoint.grpc.trace.PAnnotationValue;
Expand Down Expand Up @@ -58,6 +59,9 @@
* @author Woonduk Kang(emeroad)
*/
public class GrpcSpanMessageConverter implements MessageConverter<SpanType, GeneratedMessageV3> {
public static final String DEFAULT_END_POINT = "UNKNOWN";
public static final String DEFAULT_RPC_NAME = "UNKNOWN";
public static final String DEFAULT_REMOTE_ADDRESS = "UNKNOWN";

private final String agentId;
private final short applicationServiceType;
Expand Down Expand Up @@ -170,10 +174,13 @@ private boolean isCompressedType(TraceId traceId) {
private PAcceptEvent newAcceptEvent(Span span) {
PAcceptEvent.Builder builder = PAcceptEvent.newBuilder();

builder.setRemoteAddr(span.getRemoteAddr());
final String remoteAddr = StringUtils.defaultIfEmpty(span.getRemoteAddr(), DEFAULT_REMOTE_ADDRESS);
builder.setRemoteAddr(remoteAddr);
final Shared shared = span.getTraceRoot().getShared();
builder.setRpc(shared.getRpcName());
builder.setEndPoint(shared.getEndPoint());
final String rpc = StringUtils.defaultIfEmpty(shared.getRpcName(), DEFAULT_RPC_NAME);
builder.setRpc(rpc);
final String endPoint = StringUtils.defaultIfEmpty(shared.getEndPoint(), DEFAULT_END_POINT);
builder.setEndPoint(endPoint);

PParentInfo pParentInfo = newParentInfo(span);
if (pParentInfo != null) {
Expand Down

0 comments on commit 8e3a6e9

Please # to comment.