@SneakyThrows
    @Get("/debugging/query/zipkin/api/v2/traces")
    public String queryZipkinTraces(@Param("serviceName") Optional<String> serviceName,
                                    @Param("remoteServiceName") Optional<String> remoteServiceName,
                                    @Param("spanName") Optional<String> spanName,
                                    @Param("annotationQuery") Optional<String> annotationQuery,
                                    @Param("minDuration") Optional<Long> minDuration,
                                    @Param("maxDuration") Optional<Long> maxDuration,
                                    @Param("endTs") Optional<Long> endTs,
                                    @Param("lookback") Optional<Long> lookback,
                                    @Default("10") @Param("limit") int limit) {
        final String condition = "serviceName: " + serviceName.orElse(null) +
            ", remoteServiceName: " + remoteServiceName.orElse(null) +
            ", spanName: " + spanName.orElse(null) +
            ", annotationQuery: " + annotationQuery.orElse(null) +
            ", minDuration: " + minDuration.orElse(null) +
            ", maxDuration: " + maxDuration.orElse(null) +
            ", endTs: " + endTs.orElse(null) +
            ", lookback: " + lookback.orElse(null) +
            ", limit: " + limit;
        DebuggingTraceContext traceContext = new DebuggingTraceContext(condition, true, false);
        DebuggingTraceContext.TRACE_CONTEXT.set(traceContext);
        try {
            AggregatedHttpResponse response = zipkinQueryHandler.getTraces(
                serviceName, remoteServiceName, spanName, annotationQuery, minDuration, maxDuration, endTs, lookback,
                limit
            );
            List<List<Span>> traces = new ArrayList<>();
            if (response.status().code() == 200) {
                traces = new Gson().fromJson(
                    response.contentUtf8(), new TypeToken<ArrayList<ArrayList<Span>>>() {
                    }.getType()
                );
            }
            DebuggingZipkinQueryTracesRsp result = new DebuggingZipkinQueryTracesRsp(
                traces, transformTrace(traceContext.getExecTrace()));
            return transToYAMLStringZipkin(result);
        } finally {
            traceContext.stopTrace();
            DebuggingTraceContext.TRACE_CONTEXT.remove();
        }
    }
Only for BanyanDB, can be used to query the trace in the cold stage.
oap-server/server-query-plugin/status-query-plugin/src/main/java/org/apache/skywalking/oap/query/debug/DebuggingHTTPHandler.java