code: public static CompletionTime spanToCompletionTime(SpanCache spanCache, Span span) {
          CompletionTime completionTime = new CompletionTime();
          completionTime.setId(span.getId());
  
          if (span.getTimestamp() != null) {
              completionTime.setTimestamp(span.getTimestamp());
          }
          if (span.getDuration() != null) {
              completionTime.setDuration(span.getDuration());
          }
  
          completionTime.setOperation(SpanDeriverUtil.deriveOperation(span));
          completionTime.getProperties().add(new Property(Constants.PROP_FAULT, SpanDeriverUtil.deriveFault(span)));
  
          completionTime.setHostAddress(span.ipv4());
          if (span.service() != null) {
              completionTime.getProperties().add(new Property(Constants.PROP_SERVICE_NAME, span.service()));
          }
  
          URL url = getUrl(spanCache, span);
          if (url == null &&
                  span.serverSpan() && spanCache.get(null, SpanUniqueIdGenerator.getClientId(span.getId())) != null) {
              return null;
          }
  
          if (url != null) {
              String uri = span.clientSpan() ? EndpointUtil.encodeClientURI(url.getPath()) : url.getPath();
  
              completionTime.setUri(uri);
              completionTime.setEndpointType(url.getProtocol() == null ? null : url.getProtocol().toUpperCase());
          } else {
              completionTime.setEndpointType("Unknown");
          }
  
          completionTime.getProperties().addAll(span.binaryAnnotationMapping().getProperties());
  
          return completionTime;
      }
docs: Convert span to CompletionTime object
  
  @param span the span
  @param spanCache span cache
  @return completion time derived from the supplied span, if the uri of the completion time
  cannot be derived (span is server span and client span also does not contain url) it returns null