Add throttling/rate-limiting

Description

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

Environment

N/A?

Activity

Show:
import
February 1, 2015, 4:47 PM

Comment made by: aeronotix

I have an implementation of most of this on my branch at github: https://github.com/AeroNotix/tools.trace/tree/alf-implement-throttled-tracing

Luc Préfontaine
February 18, 2015, 3:01 AM

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
feature enabled.

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...

Luc P.

import
February 18, 2015, 10:41 AM

Comment made by: aeronotix

The dosync is for when the function is being called from multiple threads.

Assignee

Luc Préfontaine

Reporter

import

Labels

None

Approval

None

Patch

None

Priority

Minor
Configure