use of zipkin2.storage.cassandra.Schema.TABLE_SPAN in project zipkin by openzipkin.
the class CassandraUtil method annotationQuery.
/**
* Returns a set of annotation getValues and tags joined on equals, delimited by ░
*
* <p>Values over {@link RecyclableBuffers#SHORT_STRING_LENGTH} are not considered. Zipkin's
* {@link QueryRequest#annotationQuery()} are equals match. Not all values are lookup values. For
* example, {@code sql.query} isn't something that is likely to be looked up by value and indexing
* that could add a potentially kilobyte partition key on {@link Schema#TABLE_SPAN}
*
* @see QueryRequest#annotationQuery()
*/
@Nullable
static String annotationQuery(Span span) {
if (span.annotations().isEmpty() && span.tags().isEmpty())
return null;
// as very unlikely to be in the query
char delimiter = '░';
StringBuilder result = new StringBuilder().append(delimiter);
for (Annotation a : span.annotations()) {
if (a.value().length() > SHORT_STRING_LENGTH)
continue;
result.append(a.value()).append(delimiter);
}
for (Map.Entry<String, String> tag : span.tags().entrySet()) {
if (tag.getValue().length() > SHORT_STRING_LENGTH)
continue;
// search is possible by key alone
result.append(tag.getKey()).append(delimiter);
result.append(tag.getKey()).append('=').append(tag.getValue()).append(delimiter);
}
return result.length() == 1 ? null : result.toString();
}
Aggregations