[ 
https://issues.apache.org/jira/browse/SOLR-5969?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13963242#comment-13963242
 ] 

Gregg Donovan commented on SOLR-5969:
-------------------------------------

Tomas -- Thanks for the pointer to SOLR-5277. I don't see any current use in 
Solr/Lucene of the SLF4J MDC, so I'm definitely curious to see if that issue 
makes progress.

Tomas -- the UUID is added as a header for a few reasons.
1) It's difficult due to the custom nature of SolrRequestParser to intercept 
HTTP parameters and add them to the MDC before SolrDispatchFilter is invoked. 
E.g. if the request is a POST, calling getParameter() will [trigger a parameter 
incompatibility 
exception|https://github.com/apache/lucene-solr/blob/trunk/solr/core/src/java/org/apache/solr/servlet/SolrRequestParsers.java#L621:L628].

2) If we're going to add a UUID or other metadata to the SolrParams and log 
them via the MDC, we end up with duplicate data in the logs. We pay for our 
logging by the byte, so this is unfortunate. We could add a Filter that removed 
the parameter from the HttpServletRequest, but it would need to get re-added 
when sending a distributed query.

3) Semantically, tracing information is a different thing than request 
parameters, so mixing them can be confusing.

> Enable distributed tracing of requests
> --------------------------------------
>
>                 Key: SOLR-5969
>                 URL: https://issues.apache.org/jira/browse/SOLR-5969
>             Project: Solr
>          Issue Type: Improvement
>            Reporter: Gregg Donovan
>         Attachments: SOLR-5969.diff
>
>
> Enable users to add diagnostic information to requests and trace them in the 
> logs across servers.
> We have some metadata -- e.g. a request UUID -- that we log to every log line 
> using [Log4J's 
> MDC|http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/MDC.html]. 
> The UUID logging allows us to connect any log lines we have for a given 
> request across servers. Sort of like Twitter's 
> [Zipkin|http://twitter.github.io/zipkin/].
> Currently we're using EmbeddedSolrServer without sharding, so adding the UUID 
> is fairly simple, since everything is in one process and one thread. But, 
> we're testing a sharded HTTP implementation and running into some 
> difficulties getting this data passed around in a way that lets us trace all 
> log lines generated by a request to its UUID.
> The first thing I tried was to add the UUID by adding it to the SolrParams. 
> This achieves the goal of getting those values logged on the shards if a 
> request is successful, but we miss having those values in the MDC if there 
> are other log lines before the final log line. E.g. an Exception in a custom 
> component.
> My current thought is that sending HTTP headers with diagnostic information 
> would be very useful. Those could be placed in the MDC even before handing 
> off to work to SolrDispatchFilter, so that any Solr problem will have the 
> proper logging.
> I.e. every additional header added to a Solr request gets a "Solr-" prefix. 
> On the server, we look for those headers and add them to the [SLF4J 
> MDC|http://www.slf4j.org/manual.html#mdc].



--
This message was sent by Atlassian JIRA
(v6.2#6252)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to