Add StaticTimestamped generator that uses timestamps from a file to send logs#1687
Add StaticTimestamped generator that uses timestamps from a file to send logs#1687
Conversation
78768d6 to
b3de2e0
Compare
78c5594 to
fa19c37
Compare
8071239 to
ff8a57f
Compare
fa19c37 to
7e1a732
Compare
1be6e74 to
30363c3
Compare
7e1a732 to
1098a47
Compare
30363c3 to
4aba943
Compare
1098a47 to
02c10d3
Compare
4aba943 to
b413062
Compare
02c10d3 to
9aa2aee
Compare
b413062 to
85dfb43
Compare
9aa2aee to
49cdb8f
Compare
85dfb43 to
fac862b
Compare
49cdb8f to
9e8ecc9
Compare
fac862b to
c5eee9b
Compare
6bc7260 to
b173aed
Compare
8e1b11c to
84e040f
Compare
b173aed to
9e7b813
Compare
9e7b813 to
72668f1
Compare
72668f1 to
7be29f5
Compare
84e040f to
021b37b
Compare
7be29f5 to
739872f
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 739872f122
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
efc7cc8 to
f1c39bb
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f1c39bb28f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
6c49d5b to
75583e6
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 75583e6697
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
75583e6 to
40e6e49
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 40e6e498ef
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
40e6e49 to
7b5501b
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7b5501b16b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let (ts, remainder) = NaiveDateTime::parse_and_remainder(line, timestamp_format) | ||
| .map_err(|_| Error::Timestamp(line.to_string()))?; | ||
| let body = remainder | ||
| .strip_prefix(|c: char| c.is_ascii_whitespace()) | ||
| .unwrap_or(remainder); | ||
| ( | ||
| Utc.from_utc_datetime(&ts).timestamp(), |
There was a problem hiding this comment.
Reject or resolve
%Z zones instead of forcing them to UTC
In parse_line_with_format, any format that uses %Z can fall through to NaiveDateTime::parse_and_remainder and then be converted with Utc.from_utc_datetime(...). Chrono's %Z parser ignores the zone token rather than producing an offset, so inputs like PST/PDT are accepted but treated as UTC. That breaks real logs that cross a DST abbreviation change or mix named zones: a one-second transition can become a 3601-second gap, or the fall-back transition can be rejected as out-of-order.
Useful? React with 👍 / 👎.
| Some(s) if s == line_sec => { | ||
| // This line is in the same second as the current block add to it. | ||
| lines.push(payload); |
There was a problem hiding this comment.
Stream oversized seconds instead of buffering the entire group
read_next_block() stores every line from the current second in memory before to_bytes() ever sees max_bytes. If a single hot second contains far more data than maximum_block_bytes (for example, hundreds of MB of small log lines in one second), startup still materializes the whole second into Vec<Vec<u8>> and only then truncates it, which can cause very large transient allocations or OOM during cache construction.
Useful? React with 👍 / 👎.
7b5501b to
2b48880
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2b48880d37
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let (ts, remainder) = NaiveDateTime::parse_and_remainder(line, timestamp_format) | ||
| .map_err(|_| Error::Timestamp(line.to_string()))?; |
There was a problem hiding this comment.
Support chrono formats that omit a full date-time
parse_line_with_format() only falls back to DateTime<FixedOffset> and NaiveDateTime, so formats that do not describe a complete date-time (for example common syslog prefixes like %b %e %H:%M:%S or time-only %H:%M:%S) are rejected as Timestamp errors even though timestamp_format is documented as a general chrono format. In practice this makes the new generator unusable for many real log files unless they already include a full date, which is a surprising limitation for replaying existing logs.
Useful? React with 👍 / 👎.

What does this PR do?
Adds a new "static" generator that parses timestamps from a log file, and chunks each second worth of logs into a single block.
Motivation
This allows you to e.g. download an hour worth of logs, parse their timestamps, and then (in conjunction w/ prior block-based throttling) send 1 block per second to get a "realistic" load pattern as opposed to generating X bytes/second.
Related issues
Follow up of #1683