tools.trace

Add throttling/rate-limiting

Details

  • Type: Enhancement Enhancement
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Environment:
    N/A?

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

Activity

Hide
Aaron France added a comment -

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

Show
Aaron France added a comment - I have an implementation of most of this on my branch at github: https://github.com/AeroNotix/tools.trace/tree/alf-implement-throttled-tracing
Hide
Luc Préfontaine added a comment -

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.

Show
Luc Préfontaine added a comment - 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.
Hide
Aaron France added a comment -

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

Show
Aaron France added a comment - The dosync is for when the function is being called from multiple threads.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated: