use of com.couchbase.client.core.cnc.RequestSpan in project couchbase-jvm-clients by couchbase.
the class AsyncQueryIndexManager method exec.
private CompletableFuture<QueryResult> exec(QueryType queryType, CharSequence statement, CommonOptions<?>.BuiltCommonOptions options, String spanName, String bucketName, JsonArray parameters) {
QueryOptions queryOpts = toQueryOptions(options).readonly(requireNonNull(queryType) == READ_ONLY);
if (parameters != null && !parameters.isEmpty()) {
queryOpts.parameters(parameters);
}
RequestSpan parent = cluster.environment().requestTracer().requestSpan(spanName, options.parentSpan().orElse(null));
parent.attribute(TracingIdentifiers.ATTR_SYSTEM, TracingIdentifiers.ATTR_SYSTEM_COUCHBASE);
if (bucketName != null) {
parent.attribute(TracingIdentifiers.ATTR_NAME, bucketName);
}
queryOpts.parentSpan(parent);
return cluster.query(statement.toString(), queryOpts).exceptionally(t -> {
throw translateException(t);
}).whenComplete((r, t) -> parent.end());
}
use of com.couchbase.client.core.cnc.RequestSpan in project couchbase-jvm-clients by couchbase.
the class AsyncAnalyticsIndexManager method exec.
/**
* Executes a statement with options against analytics.
*
* @param statement the statement of the query.
* @param options the options that should be passed along.
* @param spanName the name of the span as the outer parent.
* @return a future eventually containing the analytics result once complete, or a failure.
*/
private CompletableFuture<AnalyticsResult> exec(final String statement, final CommonOptions<?>.BuiltCommonOptions options, final String spanName) {
RequestSpan parent = CbTracing.newSpan(cluster.environment().requestTracer(), spanName, options.parentSpan().orElse(null));
final AnalyticsOptions analyticsOptions = toAnalyticsOptions(options).parentSpan(parent);
return cluster.analyticsQuery(statement, analyticsOptions).whenComplete((r, t) -> parent.end());
}
Aggregations