@Test public void accept() throws Exception { onClientCall( observer -> { observer.onNext(Empty.getDefaultInstance()); observer.onCompleted(); }); spanConsumer.accept(asList(TestObjects.CLIENT_SPAN)).execute(); ArgumentCaptor<BatchWriteSpansRequest> requestCaptor = ArgumentCaptor.forClass(BatchWriteSpansRequest.class); verify(traceService).batchWriteSpans(requestCaptor.capture(), any()); BatchWriteSpansRequest request = requestCaptor.getValue(); assertThat(request.getName()).isEqualTo("projects/" + projectId); assertThat(request.getSpansList()) .isEqualTo(SpanTranslator.translate(projectId, asList(TestObjects.CLIENT_SPAN))); }
@Override public Call<Void> accept(List<Span> spans) { if (spans.isEmpty()) return Call.create(null); List<com.google.devtools.cloudtrace.v2.Span> stackdriverSpans = SpanTranslator.translate(projectId, spans); BatchWriteSpansRequest request = BatchWriteSpansRequest.newBuilder() .setName(projectName) .addAllSpans(stackdriverSpans) .build(); return new BatchWriteSpansCall(grpcClient, request); }
StackdriverSpanConsumer implements SpanConsumer { @Override public Call<Void> accept(List<Span> spans) { if (spans.isEmpty()) return Call.create(null); List<com.google.devtools.cloudtrace.v2.Span> stackdriverSpans = SpanTranslator.translate(projectId, spans); BatchWriteSpansRequest request = BatchWriteSpansRequest.newBuilder() .setName(projectName) .addAllSpans(stackdriverSpans) .build(); return new BatchWriteSpansCall(grpcClient, request); } }
StackdriverSpanConsumer implements SpanConsumer { @Override public Call<Void> accept(List<Span> spans) { if (spans.isEmpty()) return Call.create(null); List<com.google.devtools.cloudtrace.v2.Span> stackdriverSpans = SpanTranslator.translate(projectId, spans); BatchWriteSpansRequest request = BatchWriteSpansRequest.newBuilder() .setName(projectName) .addAllSpans(stackdriverSpans) .build(); return new BatchWriteSpansCall(grpcClient, request); } StackdriverSpanConsumer(UnaryGrpcClient grpcClient, String projectId); }
StackdriverSpanConsumer implements SpanConsumer { @Override public Call<Void> accept(List<Span> spans) { if (spans.isEmpty()) return Call.create(null); List<com.google.devtools.cloudtrace.v2.Span> stackdriverSpans = SpanTranslator.translate(projectId, spans); BatchWriteSpansRequest request = BatchWriteSpansRequest.newBuilder() .setName(projectName) .addAllSpans(stackdriverSpans) .build(); return new BatchWriteSpansCall(grpcClient, request); } StackdriverSpanConsumer(UnaryGrpcClient grpcClient, String projectId); @Override Call<Void> accept(List<Span> spans); }
StackdriverSpanConsumer implements SpanConsumer { @Override public Call<Void> accept(List<Span> spans) { if (spans.isEmpty()) return Call.create(null); List<com.google.devtools.cloudtrace.v2.Span> stackdriverSpans = SpanTranslator.translate(projectId, spans); BatchWriteSpansRequest request = BatchWriteSpansRequest.newBuilder() .setName(projectName) .addAllSpans(stackdriverSpans) .build(); return new BatchWriteSpansCall(grpcClient, request); } StackdriverSpanConsumer(UnaryGrpcClient grpcClient, String projectId); @Override Call<Void> accept(List<Span> spans);  }