diff --git a/exporters/trace/src/main/java/com/google/cloud/opentelemetry/trace/TraceTranslator.java b/exporters/trace/src/main/java/com/google/cloud/opentelemetry/trace/TraceTranslator.java index 873a408b..31e87ab7 100644 --- a/exporters/trace/src/main/java/com/google/cloud/opentelemetry/trace/TraceTranslator.java +++ b/exporters/trace/src/main/java/com/google/cloud/opentelemetry/trace/TraceTranslator.java @@ -120,7 +120,7 @@ Span generateSpan(SpanData spanData, String projectId) { spanBuilder.setEndTime(toTimestampProto(end)); } spanBuilder.setLinks(toLinksProto(spanData.getLinks(), spanData.getTotalRecordedLinks())); - if (spanData.getParentSpanId() != null) { + if (spanData.getParentSpanContext().isValid()) { spanBuilder.setParentSpanId(spanData.getParentSpanId()); } boolean hasRemoteParent = spanData.getParentSpanContext().isRemote();