mirror of https://github.com/apache/lucene.git
SOLR-13395: make DebugComponent.getRequestId() public
This commit is contained in:
parent
7830cae571
commit
e783207535
|
@ -145,23 +145,27 @@ public class DebugComponent extends SearchComponent
|
|||
|
||||
|
||||
private void doDebugTrack(ResponseBuilder rb) {
|
||||
SolrQueryRequest req = rb.req;
|
||||
String rid = req.getParams().get(CommonParams.REQUEST_ID);
|
||||
if(rid == null || "".equals(rid)) {
|
||||
rid = generateRid(rb);
|
||||
ModifiableSolrParams params = new ModifiableSolrParams(req.getParams());
|
||||
params.add(CommonParams.REQUEST_ID, rid);//add rid to the request so that shards see it
|
||||
req.setParams(params);
|
||||
}
|
||||
String rid = getRequestId(rb.req);
|
||||
rb.addDebug(rid, "track", CommonParams.REQUEST_ID);//to see it in the response
|
||||
rb.rsp.addToLog(CommonParams.REQUEST_ID, rid); //to see it in the logs of the landing core
|
||||
|
||||
}
|
||||
|
||||
public static String getRequestId(SolrQueryRequest req) {
|
||||
String rid = req.getParams().get(CommonParams.REQUEST_ID);
|
||||
if(rid == null || "".equals(rid)) {
|
||||
rid = generateRid(req);
|
||||
ModifiableSolrParams params = new ModifiableSolrParams(req.getParams());
|
||||
params.add(CommonParams.REQUEST_ID, rid);//add rid to the request so that shards see it
|
||||
req.setParams(params);
|
||||
}
|
||||
return rid;
|
||||
}
|
||||
|
||||
@SuppressForbidden(reason = "Need currentTimeMillis, only used for naming")
|
||||
private String generateRid(ResponseBuilder rb) {
|
||||
String hostName = rb.req.getCore().getCoreContainer().getHostName();
|
||||
return hostName + "-" + rb.req.getCore().getName() + "-" + System.currentTimeMillis() + "-" + ridCounter.getAndIncrement();
|
||||
private static String generateRid(SolrQueryRequest req) {
|
||||
String hostName = req.getCore().getCoreContainer().getHostName();
|
||||
return hostName + "-" + req.getCore().getName() + "-" + System.currentTimeMillis() + "-" + ridCounter.getAndIncrement();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue