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) {
|
private void doDebugTrack(ResponseBuilder rb) {
|
||||||
SolrQueryRequest req = rb.req;
|
String rid = getRequestId(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);
|
|
||||||
}
|
|
||||||
rb.addDebug(rid, "track", CommonParams.REQUEST_ID);//to see it in the response
|
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
|
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")
|
@SuppressForbidden(reason = "Need currentTimeMillis, only used for naming")
|
||||||
private String generateRid(ResponseBuilder rb) {
|
private static String generateRid(SolrQueryRequest req) {
|
||||||
String hostName = rb.req.getCore().getCoreContainer().getHostName();
|
String hostName = req.getCore().getCoreContainer().getHostName();
|
||||||
return hostName + "-" + rb.req.getCore().getName() + "-" + System.currentTimeMillis() + "-" + ridCounter.getAndIncrement();
|
return hostName + "-" + req.getCore().getName() + "-" + System.currentTimeMillis() + "-" + ridCounter.getAndIncrement();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue