I would like to propose adding several features to tools.trace:
The ability to trottle tracing using several characteristics:
Number of messages logged.
Number of times called.
Size of output generated
Times logged in a given period
The ability to trace only certain calls:
Trace calls to functions with specific values for their argument
I find this feature interesting but I read the implementation and find it complex.
I would like to simplify it. The count may be done at all times even without the throttling
I would pass a different wrapper in do-trace-var* depending if the throttling feature is
required or not instead of testing the throttle feature at runtime every time.
I may also want to preserve existing fns that have been made public in the past.
The top level call could be a bit more specific than trace-opts.
Will think about a name. Maybe having top level calls more explicit will make
things clearer and easier to implement while preserving backward compat.
Can you shed some light on why you need a dosync in the throttler ?
I reread the code three/four times but cannot wrap my mind as to why a simple atom
with swap! does not do the job here.
All your refs are in the local scope of the throttler fn, nothing leaks out as far as I can
see. (It's late however...
Comment made by: aeronotix
The dosync is for when the function is being called from multiple threads.