Clojure JIRAhttp://dev.clojure.org/jira/secure/IssueNavigator.jspa?reset=true&jqlQuery=project+%3D+TTRACE+AND+resolution+%3D+Unresolved+ORDER+BY+updated+DESC
An XML representation of a search requesten-us4.464925-07-2011[TTRACE-13] Implicitly quote the name space in the trace-ns macrohttp://dev.clojure.org/jira/browse/TTRACE-13
tools.traceTTRACE-13Implicitly quote the name space in the trace-ns macroEnhancementMinorOpenUnresolvedLuc PréfontaineLuc PréfontaineThu, 8 Oct 2015 19:03:15 -0500Thu, 8 Oct 2015 20:57:49 -050000<p>Solved in master, ready for 0.7.10</p>Global Rank[TTRACE-10] Add throttling/rate-limitinghttp://dev.clojure.org/jira/browse/TTRACE-10
tools.trace<p>I would like to propose adding several features to tools.trace:</p>
<ul>
<li>The ability to trottle tracing using several characteristics:</li>
<li>Number of messages logged.</li>
<li>Number of times called.</li>
<li>Size of output generated</li>
<li>Times logged in a given period</li>
</ul>
<ul>
<li>The ability to trace <b>only</b> certain calls:</li>
<li>Trace calls to functions with specific values for their argument</li>
</ul>
N/A?TTRACE-10Add throttling/rate-limitingEnhancementMinorOpenUnresolvedLuc PréfontaineAaron FranceSun, 1 Feb 2015 05:57:29 -0600Wed, 18 Feb 2015 04:41:13 -060001<p>I have an implementation of most of this on my branch at github: <a href="https://github.com/AeroNotix/tools.trace/tree/alf-implement-throttled-tracing">https://github.com/AeroNotix/tools.trace/tree/alf-implement-throttled-tracing</a></p><p>I find this feature interesting but I read the implementation and find it complex.<br/>
I would like to simplify it. The count may be done at all times even without the throttling<br/>
feature enabled.</p>
<p>I would pass a different wrapper in do-trace-var* depending if the throttling feature is<br/>
required or not instead of testing the throttle feature at runtime every time.</p>
<p>I may also want to preserve existing fns that have been made public in the past.</p>
<p>The top level call could be a bit more specific than trace-opts.<br/>
Will think about a name. Maybe having top level calls more explicit will make<br/>
things clearer and easier to implement while preserving backward compat.</p>
<p>Can you shed some light on why you need a dosync in the throttler ?</p>
<p>I reread the code three/four times but cannot wrap my mind as to why a simple atom<br/>
with swap! does not do the job here.</p>
<p>All your refs are in the local scope of the throttler fn, nothing leaks out as far as I can<br/>
see. (It's late however...<img class="emoticon" src="http://dev.clojure.org/jira/images/icons/emoticons/smile.gif" height="20" width="20" align="absmiddle" alt="" border="0"/></p>
<p>Luc P.</p><p>The dosync is for when the function is being called from multiple threads.</p>Global Rank[TTRACE-9] Use aprint when displaying valuehttp://dev.clojure.org/jira/browse/TTRACE-9
tools.trace<p>Problem: when trace-ns is used, very long displays in the output stream is very hard to read when the fn calls are important and with voluminous data structure<br/>
Solution: Use <a href="https://github.com/razum2um/aprint">Aprint library</a> when printing value in the output string, now get syntax hightlighting and better layout of data structure<br/>
Tradeoffs: add a new dependency to tools.trace<br/>
Tests: yes, modify the cleanup fn to also clean the color information added by aprint, so 100% tests passed</p>TTRACE-9Use aprint when displaying valueEnhancementMinorOpenUnresolvedLuc PréfontaineJérémie GrodziskienhancementprintWed, 29 Oct 2014 10:09:15 -0500Tue, 17 Feb 2015 21:07:00 -060003<p>Jeremie, I am not certain, but I believe it is a policy of Clojure contrib libraries <em>not</em> to depend on libraries other than those in Clojure or Clojure contrib.</p>
<p>Perhaps if new arities were added to some existing tools.trace functions or macros, sprint or any other developer-desired function could be provided as arguments to control how printing occurs?</p><p>Hi Andy,</p>
<p>Thanks for your comment, yes I thought about that and known it would be the greatest concern...<br/>
I'll have a look at 2 possibilities:</p>
<ul class="alternate" type="square">
<li>the fastest: add new arg to tools.trace fns and macros for providing a filter that can add the colors and layout</li>
<li>the better: see if inlining the aprint code is worth considering, or better add the syntax hightlighting feature in clojure.pprint even though pprint is not used in tools.trace (and along with some neat library like <a href="https://github.com/AvisoNovate/pretty">Pretty</a> that could be added to clojure.repl)</li>
</ul>
<p>In the end, adding aprint (both for color and layout) made a HUGE difference for me in usability...</p><p>Andy, that is not a policy afaik, merely a preference to minimize them as much as possible. There are other contribs that have external dependencies. It's up to Luc as the contrib lead whether he thinks this is ok here.</p><p>I've looked into this. 'Inlining aprint' in tools.trace would be my first choice.<br/>
However we need to get Vlad Bokov to fill a CA (I do not see him in the list of contributors)<br/>
and to grant us the rights to include part of is source code in tools.trace.</p>
<p>Being a regular user of this tool, I find the arity avenue painful. It happens that we use this in<br/>
integrated test mode to nail issues. Then the output goes to a file were tty ansi commands<br/>
are not welcomed.</p>
<p>I think we need a mode state to enable/disable this feature. In the repl you would need a single<br/>
statement to get the colored output whatever trace fns you are calling. That can be part of your<br/>
user profile.</p>
<p>Eventually this could migrate to core.pprint but that will require some time before it ends up in a clojure release.</p>
<p>Meanwhile we can keep this isolated in tools.trace so it can be moved later elsewhere.</p>
<p>Comments ?</p><p>I sent an email to Vlad and the url to this ticket.<br/>
Will have a discussion off line first and then move along with the plan if we can.</p><p>Hi Jérémie, Alex and Luc,</p>
<p>I'm the author of aprint and really happy about you like my lib <img class="emoticon" src="http://dev.clojure.org/jira/images/icons/emoticons/smile.gif" height="20" width="20" align="absmiddle" alt="" border="0"/><br/>
Here are my thoughts about it:</p>
<p>1) I really like the idea to push it into tools.trace<br/>
2) Currently all the clojure contrib-libs have same patch acceptance policy as the lang, which I already wondered about <a href="https://github.com/clojure/clojure/pull/17#issuecomment-53628365">https://github.com/clojure/clojure/pull/17#issuecomment-53628365</a> Try to understand, if a lib depends on another, the last one must share the same policy as the original, which is not the case, as I hardly stop accepting pull requests.<br/>
3) If you couldn't change this policy, I see "inlining" as best choice.</p>
<p>Now some points about the question "what will get inlined?"</p>
<p>4) I'm a bit surprised, that people don't share my intent to integrate it with repl like this <a href="https://github.com/greglook/whidbey">https://github.com/greglook/whidbey</a>, don't like colors, they simply like the layout. So coloring could be thrown away and we eliminate dependance on clansi. Or I could inline clansi (has MIT license), document a :^dynamic to turn on colors (which will get off by default)<br/>
5) Code for compact layout depends on jline and it's definitely won't get inside <img class="emoticon" src="http://dev.clojure.org/jira/images/icons/emoticons/smile.gif" height="20" width="20" align="absmiddle" alt="" border="0"/> As such this will remain pprint/<b>print-right-margin</b> default value, which is 72 by default and isn't best choice in my opinion, but let it be. (or do you still run clojure on very old terminals?)<br/>
6) I don't see sense in introducing a new one :^dynamic for it, I suggest to rely on pprint/<b>print-pretty</b> and if it's true - use compact layout instead of pprint's default one</p>
<p>As such:</p>
<ul class="alternate" type="square">
<li>i could fill and sign a CA</li>
<li>prepare a dependent free patch for you, which includes only compact layout (and colors if you like) controlled by pprint/<b>print-pretty</b> and pprint/<b>print-right-margin</b></li>
</ul>
<p>Hi Vlad,</p>
<p>any change on this one ?</p>
<p>I am about to issue 0.7.9. Dunno if you had some time to do the above steps.</p>
<p>Luc P.</p><p>BTWY, </p>
<p>I still punch Clojure code on Hollerith cards so I am in unfamiliar territory when a line<br/>
exceeds 80 characters and the last 8 columns are not usable anyway <img class="emoticon" src="http://dev.clojure.org/jira/images/icons/emoticons/smile.gif" height="20" width="20" align="absmiddle" alt="" border="0"/></p>Global RankPatchCode and Test