Source:
<code>public CallStatus run() { <START> RequestMetrics.Context savedSearchMetricCtx = metrics.startEntityRequest("savedsearch", entity, version); <END> RequestMetrics.Context findMetricCtx = null; LOGGER.debug("run: entity={}, version={}", entity, version); Error.reset(); Error.push("rest"); Error.push(getClass().getSimpleName()); Error.push(entity); Response r = null; try { ClientIdentification callerId=getCallerId(); JsonNode searchDoc=RestConfiguration.getSavedSearchCache().getSavedSearch(getMediator(),getCallerId(),searchName,entity,version); if(searchDoc==null) throw Error.get(RestCrudConstants.ERR_REST_SAVED_SEARCH,searchName+":"+entity+":"+version); Map<String,String> parameters=FindRequestBuilder.fillDefaults(searchDoc,params,new DefaultTypes()); LOGGER.debug("Parameters:{}",parameters); FindRequest req=FindRequestBuilder.buildRequest(searchDoc,entity,version,callerId,parameters); if(projection!=null) { req.setProjection(Projection.add(req.getProjection(),projection)); } if(sort!=null) { req.setSort(sort); } if(from!=null) { req.setFrom(from.longValue()); } if(to!=null) { req.setTo(to.longValue()); } LOGGER.debug("Request:{}",req); findMetricCtx = metrics.startEntityRequest("find", req.getEntityVersion().getEntity(), req.getEntityVersion().getVersion()); r = getMediator().find(req); return new CallStatus(r); } catch (Error e) { savedSearchMetricCtx.markRequestException(e); LOGGER.error("saved_search failure: {}", e); return new CallStatus(e); } catch (Exception e) { Error error = Error.get(RestCrudConstants.ERR_REST_FIND, e.toString()); savedSearchMetricCtx.markRequestException(error); LOGGER.error("saved_search failure: {}", e); return new CallStatus(error); } finally { savedSearchMetricCtx.endRequestMonitoring(); if (r != null) { findMetricCtx.markAllErrorsAndEndRequestMonitoring(r.getErrors()); } else { findMetricCtx.endRequestMonitoring(); } } }</code><technical_language>saved search name in metrics for this actually? queries performing. this additional parameter, track this startSavedSearchRequest</technical_language>

Target:
public CallStatus run() { RequestMetrics.Context metricCtx = metrics.startSavedSearchRequest(searchName, entity, version); LOGGER.debug("run: entity={}, version={}", entity, version); Error.reset(); Error.push("rest"); Error.push(getClass().getSimpleName()); Error.push(entity); Response r = null; try { ClientIdentification callerId=getCallerId(); JsonNode searchDoc=RestConfiguration.getSavedSearchCache().getSavedSearch(getMediator(),getCallerId(),searchName,entity,version); if(searchDoc==null) throw Error.get(RestCrudConstants.ERR_REST_SAVED_SEARCH,searchName+":"+entity+":"+version); Map<String,String> parameters=FindRequestBuilder.fillDefaults(searchDoc,params,new DefaultTypes()); LOGGER.debug("Parameters:{}",parameters); FindRequest req=FindRequestBuilder.buildRequest(searchDoc,entity,version,callerId,parameters); if(projection!=null) { req.setProjection(Projection.add(req.getProjection(),projection)); } if(sort!=null) { req.setSort(sort); } if(from!=null) { req.setFrom(from.longValue()); } if(to!=null) { req.setTo(to.longValue()); } LOGGER.debug("Request:{}",req); r = getMediator().find(req); return new CallStatus(r); } catch (Error e) { metricCtx.markRequestException(e); LOGGER.error("saved_search failure: {}", e); return new CallStatus(e); } catch (Exception e) { Error error = Error.get(RestCrudConstants.ERR_REST_FIND, e.toString()); metricCtx.markRequestException(error); LOGGER.error("saved_search failure: {}", e); return new CallStatus(error); } finally { if (r != null) { metricCtx.markAllErrorsAndEndRequestMonitoring(r.getErrors()); } else { metricCtx.endRequestMonitoring(); } } }