Log-rate-limit

Latest version: v1.4.1

Safety actively analyzes 682487 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 2

1.4.1

Fixed

- Redis sync issue that causes `KeyError: 'next_valid_time'` error in rare (or high load) situations.

1.4.0

Added

- Per-stream rate-limiting data (cache) can now be stored in a Redis database if a `redis_url` is provided to the `StreamRateLimitFilter` constructor.
- Using Redis allows multiple processes with a single output stream to share their rate-limiting, and it also allows cache to be monitored and controlled externally (e.g. if memory usage of rate-limiting cache becomes a concern for long-running processes).

1.3.0

Added

- Tracked streams are now expired after some time.
- When expired, they'll report any skipped messages that haven't been reported before.
- This should help with long-running processes that could use increasing amounts of memory in the rare case that they continually generate both large and unique log messages (actually unique `stream_ids`).
- The new configurable parameters introduced for this feature are: `expire_check_sec` (default: 1min), `expire_offset_sec` (default: 15min) and `expire_msg`.
- The default values mean that a stream is considered expired 15 minutes after end of rate-limiting and that the check for expired streams will occur (at most) once a minute.
- New `stream_id_max_len` option can be used to limit `stream_id` strings to a maximum length.
- Added `print_config` option to print provided configs at start-up. Useful for debugging.
- Added complexity check to CI and refactored code to simplify it.

1.2.2

Added

- `srl_summary_note` now gets added to all log records that pass through filter:
- Is only set whenever a message is printed and previous messages in the same stream were suppressed.

Changed

- Simplified default unique message to use `LogRecord`'s `getMessage()` function.

1.2.1

Fixed

- Fix bug when not logging string messages

1.2.0

Changed

- Default rate-limiting now applies to identical log messages (instead of to logs originating from the same line of code).
- Replaced boolean `all_unique` parameter with `default_stream_id` which can have multiple options, including ones that achieve the same functionality as before:
- `default_stream_id=None` (or `default_stream_id=DefaultSID.NONE`) is equivalent to `all_unique=False`.
- `default_stream_id="file_line_no"` (or `default_stream_id=DefaultSID.FILE_LINE_NO`) is equivalent to `all_unique=True`.

Added

- New `default_stream_id` parameter includes a third option that wasn't previously available:
- `default_stream_id="log_message"` (or `default_stream_id=DefaultSID.LOG_MESSAGE`) which will set the default stream ID such that repeated log messages will be rate limited.

Page 1 of 2

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.