コード例 #1
1
 protected List<String> serviceNamesNotFoundInZipkin(List<io.zipkin.Span> spans) {
   List<String> serviceNamesFoundInAnnotations =
       spans
           .stream()
           .filter(span -> span.annotations != null)
           .map(span -> span.annotations)
           .flatMap(Collection::stream)
           .filter(span -> span.endpoint != null)
           .map(annotation -> annotation.endpoint)
           .map(endpoint -> endpoint.serviceName)
           .distinct()
           .collect(Collectors.toList());
   List<String> serviceNamesFoundInBinaryAnnotations =
       spans
           .stream()
           .filter(span -> span.binaryAnnotations != null)
           .map(span -> span.binaryAnnotations)
           .flatMap(Collection::stream)
           .filter(span -> span.endpoint != null)
           .map(annotation -> annotation.endpoint)
           .map(endpoint -> endpoint.serviceName)
           .distinct()
           .collect(Collectors.toList());
   List<String> names = new ArrayList<>();
   names.addAll(serviceNamesFoundInAnnotations);
   names.addAll(serviceNamesFoundInBinaryAnnotations);
   return names.contains(getAppName()) ? Collections.emptyList() : names;
 }
コード例 #2
0
 protected List<String> annotationsNotFoundInZipkin(List<io.zipkin.Span> spans) {
   String binaryAnnotationName = getRequiredBinaryAnnotationName();
   Optional<String> names =
       spans
           .stream()
           .filter(span -> span.binaryAnnotations != null)
           .map(span -> span.binaryAnnotations)
           .flatMap(Collection::stream)
           .filter(span -> span.endpoint != null)
           .map(annotation -> annotation.key)
           .filter(binaryAnnotationName::equals)
           .findFirst();
   return names.isPresent()
       ? Collections.emptyList()
       : Collections.singletonList(binaryAnnotationName);
 }