-
Notifications
You must be signed in to change notification settings - Fork 3
Recording runtime logs in DB #363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
a93be03
b33d807
653b695
f91e5f1
ba5a6a2
b1fb6c6
10e029f
fb0c726
c494e9e
818aa1f
5d2d4f5
18d5ae3
1a8b397
4700231
926f20f
16f5327
bb9e044
d2e53e4
bfde5e5
f480e38
49e6dfb
6d13d20
a30d076
52b5187
55333a5
da4de66
f79cdb2
6d8bf27
16850c9
152eb1f
9722898
6404901
2e9a7a2
279067e
834e2b1
46dbf2e
a88a1ef
652e153
2350093
4b10335
8811311
28c79b8
6d1563b
3a697a7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,14 @@ | ||
| //! Runtime logs | ||
| //! | ||
| //! Parse and record the logs emitted by the runtime to support | ||
| //! Parse and record the logs from the ordinance runtime to support | ||
| //! pos-processing and analysis. | ||
| //! | ||
| //! The most verbose levels are ignored to minimize the impact on the | ||
| //! final database size. The outputs are archived, so any forensics | ||
|
Comment on lines
+6
to
+7
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm quite worried about database size, actually. The Can you check how the size of the error messages compared to the other types in your current database? It would be nice to know if I am worrying about nothing or if this is a legitimate concern |
||
| //! can be done by inspecting the raw log files if needed. The purpose | ||
| //! here is to support questions such as what is the distribution of | ||
| //! cost and runtime per jurisdictions? Which exceptions where captured | ||
castelao marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| //! on each jurisdiction? | ||
|
|
||
| mod loglevel; | ||
|
|
||
|
|
@@ -15,6 +22,14 @@ use crate::error::Result; | |
| use loglevel::LogLevel; | ||
|
|
||
| #[derive(Debug)] | ||
| /// A single log record parsed from the runtime logs. | ||
| /// | ||
| /// Expect something like: | ||
| /// [2025-12-06 15:15:14,272] INFO - Task-1: Running COMPASS | ||
| /// or | ||
| /// [2025-12-06 15:15:14,572] INFO - Jefferson County, Colorado: Running COMPASS | ||
| /// | ||
| /// Note that the 'message' can have multiple lines. | ||
castelao marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| pub(super) struct LogRecord { | ||
| timestamp: NaiveDateTime, | ||
| level: LogLevel, | ||
|
|
@@ -23,6 +38,7 @@ pub(super) struct LogRecord { | |
| } | ||
|
|
||
| impl LogRecord { | ||
| /// Parse a single log line into a LogRecord | ||
| fn parse(line: &str) -> Result<Self> { | ||
| // Regex pattern: [timestamp] LEVEL - subject: message | ||
| static RE: LazyLock<Regex> = | ||
|
|
@@ -99,6 +115,7 @@ mod tests { | |
| } | ||
|
|
||
| #[derive(Debug)] | ||
| /// Collection of runtime log records | ||
| pub(super) struct RuntimeLogs(Vec<LogRecord>); | ||
|
|
||
| impl RuntimeLogs { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The word "pos-processing" should be "post-processing"