in atlas-lwcapi/src/main/scala/com/netflix/atlas/lwcapi/ExpressionSplitter.scala [66:104]
private def parse(expression: String, exprType: ExprType): Try[List[DataExprMeta]] = Try {
val parsedExpressions = interpreter.parseQuery(expression, exprType)
exprType match {
case ExprType.EVENTS =>
parsedExpressions.collect {
case e: EventExpr =>
val q = toSpectatorQuery(compress(e.query))
DataExprMeta(e.toString, q)
}
case ExprType.TIME_SERIES =>
parsedExpressions
.collect {
case se: StyleExpr => se.expr.dataExprs
}
.flatten
.distinct
.map { e =>
val q = toSpectatorQuery(compress(e.query))
DataExprMeta(e.toString, q)
}
case ExprType.TRACE_EVENTS =>
parsedExpressions.map { e =>
// Tracing cannot be scoped to specific infrastructure, always use True
DataExprMeta(e.toString, MatchesAll)
}
case ExprType.TRACE_TIME_SERIES =>
parsedExpressions
.collect {
case tq: TraceQuery.SpanTimeSeries =>
tq.expr.expr.dataExprs.map(e => tq.copy(expr = StyleExpr(e, Map.empty)))
}
.flatten
.distinct
.map { e =>
// Tracing cannot be scoped to specific infrastructure, always use True
DataExprMeta(e.toString, MatchesAll)
}
}
}