noblepaul commented on a change in pull request #115:
URL: https://github.com/apache/solr/pull/115#discussion_r638411806
##########
File path: solr/core/src/java/org/apache/solr/api/V2HttpCall.java
##########
@@ -360,6 +366,80 @@ protected void execute(SolrQueryResponse rsp) {
SolrCore.postDecorateResponse(handler, solrReq, rsp);
}
+ @Override
+ protected void populateTracingSpan(Span span) {
+ // Set db.instance
+ String coreOrColName = this.origCorename;
+ if (coreOrColName == null) {
+ Map<String, String> pathTemplateValues = getUrlParts(); // ==
solrReq.getPathTemplateValues()
+ coreOrColName = pathTemplateValues.get("collection");
+ if (coreOrColName == null) {
+ coreOrColName = pathTemplateValues.get("core");
+ }
+ }
+ if (coreOrColName != null) {
+ span.setTag(Tags.DB_INSTANCE, coreOrColName);
+ }
+
+ // Get the templatize-ed path
+ String path;
+ if (api instanceof AnnotatedApi) {
+ // ideal scenario; eventually everything might be AnnotatedApi?
+ path = ((AnnotatedApi) api).getEndPoint().path()[0]; // consider first
to be primary
+ } else {
+ path = computeEndpointPath();
+ // TODO consider getValidators, looking for command & path?
+ }
+
+ String verb = req.getMethod().toLowerCase(Locale.ROOT);
+ // if this api has commands ...
+ final Map<String, JsonSchemaValidator> validators = getValidators(); //
should be cached
+ if (validators != null && validators.isEmpty() == false && solrReq !=
null) {
Review comment:
The most common usecase will not have any commands. So, avoid getting
the validators and the verb is absent
##########
File path: solr/core/src/java/org/apache/solr/api/V2HttpCall.java
##########
@@ -360,6 +366,80 @@ protected void execute(SolrQueryResponse rsp) {
SolrCore.postDecorateResponse(handler, solrReq, rsp);
}
+ @Override
+ protected void populateTracingSpan(Span span) {
+ // Set db.instance
+ String coreOrColName = this.origCorename;
+ if (coreOrColName == null) {
+ Map<String, String> pathTemplateValues = getUrlParts(); // ==
solrReq.getPathTemplateValues()
+ coreOrColName = pathTemplateValues.get("collection");
+ if (coreOrColName == null) {
+ coreOrColName = pathTemplateValues.get("core");
+ }
+ }
+ if (coreOrColName != null) {
+ span.setTag(Tags.DB_INSTANCE, coreOrColName);
+ }
+
+ // Get the templatize-ed path
+ String path;
+ if (api instanceof AnnotatedApi) {
+ // ideal scenario; eventually everything might be AnnotatedApi?
+ path = ((AnnotatedApi) api).getEndPoint().path()[0]; // consider first
to be primary
+ } else {
+ path = computeEndpointPath();
+ // TODO consider getValidators, looking for command & path?
+ }
+
+ String verb = req.getMethod().toLowerCase(Locale.ROOT);
Review comment:
why use to `toLowerCase(Locale.ROOT);`
it's expensive. it's always going to be in ALL CAPS
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]