@@ -41,7 +41,6 @@ class CassandraEsTraceStore(cassandraConfig: CassandraConfiguration,
4141 extends TraceStore with MetricsSupport with ResponseParser {
4242
4343 private val LOGGER = LoggerFactory .getLogger(classOf [ElasticSearchReader ])
44- private val traceRejected = metricRegistry.meter(AppMetricNames .SEARCH_TRACE_REJECTED )
4544
4645 private val cassandraSession = new CassandraSession (cassandraConfig, new CassandraClusterFactory )
4746 private val cassandraReader : CassandraTraceReader = new CassandraTraceReader (cassandraSession, cassandraConfig)
@@ -79,36 +78,21 @@ class CassandraEsTraceStore(cassandraConfig: CassandraConfiguration,
7978 // go through each hit and fetch trace for parsed traceId
8079 val sourceList = result.getSourceAsStringList
8180 if (sourceList != null && sourceList.size() > 0 ) {
82- val traceFutures = sourceList
81+ val traceIds = sourceList
8382 .asScala
8483 .map(source => extractTraceIdFromSource(source))
8584 .filter(! _.isEmpty)
86- .toSet[String ]
87- .toSeq
88- .map(id => getTrace(id))
89-
90- // wait for all Futures to complete and then map them to Traces
91- Future
92- .sequence(liftToTry(traceFutures))
93- .map(_.flatMap(retrieveTriedTrace))
85+ .toSet[String ] // de-dup traceIds
86+ .toList
87+
88+ cassandraReader.readRawTraces(traceIds)
9489 } else {
9590 Future .successful(Nil )
9691 }
9792 }
9893
9994 override def getTrace (traceId : String ): Future [Trace ] = cassandraReader.readTrace(traceId)
10095
101- private def retrieveTriedTrace (mayBeTrace : Try [Trace ]): Option [Trace ] = {
102- mayBeTrace match {
103- case Success (trace) =>
104- Some (trace)
105- case Failure (ex) =>
106- LOGGER .warn(" traceId not found in cassandra, rejected searched trace" , ex)
107- traceRejected.mark()
108- None
109- }
110- }
111-
11296 override def getFieldNames (): Future [Seq [String ]] = {
11397 Future .successful(indexConfig.whitelistIndexFields.map(_.name).distinct.sorted)
11498 }
0 commit comments