Source:
public Call<Void> accept(List<Span> rawSpans) { ImmutableList.Builder<V1Span> spansToIndex = ImmutableList.builder(); V2SpanConverter converter = V2SpanConverter.create(); V1ThriftSpanWriter encoder = new V1ThriftSpanWriter(); Set<InsertTrace.Input> insertTraces = new LinkedHashSet<>(); Set<String> insertServiceNames = new LinkedHashSet<>(); Set<InsertSpanName.Input> insertSpanNames = new LinkedHashSet<>(); Set<InsertTags.Input> tagsBySpan = new LinkedHashSet<>(); for (Span v2 : rawSpans) { V1Span span = converter.convert(v2); long ts_micro = v2.timestampAsLong(); if (ts_micro == 0L) ts_micro = guessTimestamp(v2); insertTraces.add(insertTrace.newInput(span, encoder.write(v2), ts_micro)); for (String serviceName : span.serviceNames()) { insertServiceNames.add(serviceName); if (span.name() == null) continue; insertSpanNames.add(insertSpanName.newInput(serviceName, span.name())); } if (null != v2.tags() && !v2.tags().isEmpty()) { v2.tags().forEach((k,v) -> tagsBySpan.add(insertTags.newInput(k,v))); } if (ts_micro == 0L) continue; spansToIndex.add(span); } List<Call<ResultSet>> calls = new ArrayList<>(); for (InsertTrace.Input insert : insertTraces) { calls.add(insertTrace.create(insert)); } for (String insert : insertServiceNames) { calls.add(insertServiceName.create(insert)); } for (InsertSpanName.Input insert : insertSpanNames) { calls.add(insertSpanName.create(insert)); } for (InsertTags.Input tags : tagsBySpan) { calls.add(insertTags.create(tags)); } indexer.index(spansToIndex.build(), calls); if (calls.size() == 1) return calls.get(0).map(r -> null); return new StoreSpansCall(calls); }

Target:
public Call<Void> accept(List<Span> rawSpans) { ImmutableList.Builder<V1Span> spansToIndex = ImmutableList.builder(); V2SpanConverter converter = V2SpanConverter.create(); V1ThriftSpanWriter encoder = new V1ThriftSpanWriter(); Set<InsertTrace.Input> insertTraces = new LinkedHashSet<>(); Set<String> insertServiceNames = new LinkedHashSet<>(); Set<InsertSpanName.Input> insertSpanNames = new LinkedHashSet<>(); Set<Map.Entry<String, String>> autocompleteTags = new LinkedHashSet<>(); for (Span v2 : rawSpans) { V1Span span = converter.convert(v2); long ts_micro = v2.timestampAsLong(); if (ts_micro == 0L) ts_micro = guessTimestamp(v2); insertTraces.add(insertTrace.newInput(span, encoder.write(v2), ts_micro)); for (String serviceName : span.serviceNames()) { insertServiceNames.add(serviceName); if (span.name() == null) continue; insertSpanNames.add(insertSpanName.newInput(serviceName, span.name())); } for (Map.Entry<String, String> entry : v2.tags().entrySet()) { if (autocompleteKeys.contains(entry.getKey())) autocompleteTags.add(entry); } if (ts_micro == 0L) continue; spansToIndex.add(span); } List<Call<ResultSet>> calls = new ArrayList<>(); for (InsertTrace.Input insert : insertTraces) { calls.add(insertTrace.create(insert)); } for (String insert : insertServiceNames) { calls.add(insertServiceName.create(insert)); } for (InsertSpanName.Input insert : insertSpanNames) { calls.add(insertSpanName.create(insert)); } for (Map.Entry<String, String> entry : autocompleteTags) { calls.add(insertAutocompleteValue.create(entry)); } indexer.index(spansToIndex.build(), calls); if (calls.size() == 1) return calls.get(0).map(r -> null); return new StoreSpansCall(calls); }