Homework/02 multithreading - #101
Open
invincible-summer wants to merge 2 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
该 PR 为“02-multithreading”作业提交:补全日志解析链路(Request/Internal)、补全多线程分析器的工作队列与 worker 线程执行逻辑,并在本地 CLI 与文档中加入对应作业内容与报告。
Changes:
- 完成
request/internal两类日志的解析与 Visitor 输出(LineParser/KeyValueVisitor/LogEntries)。 - 实现多线程日志分析的工作队列
WorkQueue<T>,并在LogFileAnalyzer中启动 worker 线程并汇总解析结果。 - 补全本地 CLI 的交互功能,并更新作业报告/术语表与
.gitignore。
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/LogParser/Visitors/KeyValueVisitor.cs | 为 Request/Internal 日志补齐 Key-Value 导出字段 |
| src/LogParser/Parser/LineParser.cs | 支持解析 request/internal message JSON 并构造对应 LogEntry |
| src/LogParser/Models/LogEntries.cs | 补齐 Request/Internal 的 visitor 分发实现 |
| src/LogAnalyzer/WorkQueue.cs | 实现基于 lock + Monitor 的线程安全工作队列 |
| src/LogAnalyzer/LogFileAnalyzer.cs | 过滤待解析文件、启动 worker 线程并写回分析结果 |
| src/LocalCli/Program.cs | 补齐 CLI:展示文件、分析文件/全部、查询结果 |
| docs/appendix/appendix-a-glossary.md | 调整术语表中“云服务与日志”表格格式 |
| docs/02-multithreading/report.md | 添加 02-multithreading 问答题报告 |
| docs/01-basic/report.md | 添加 01-basic 问答题报告 |
| .gitignore | 忽略 .obsidian/ |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+71
to
+82
| var exceptionspilt = internalMessage.Exception.IndexOf(": "); | ||
| if (exceptionspilt == -1) | ||
| { | ||
| throw new FormatException($"Invalid exception format: {internalMessage.Exception}"); | ||
| } | ||
| return new InternalLogEntry( | ||
| LineNo: logRecord.LineNo, | ||
| Timestamp: DateTimeOffset.Parse(logRecord.Timestamp), | ||
| PodName: logRecord.PodName, | ||
| Severity: ParseSeverity(internalMessage.Severity), | ||
| ExceptionName: internalMessage.Exception.Substring(0, exceptionspilt), | ||
| ExceptionMessage: internalMessage.Exception.Substring(exceptionspilt + 2) |
Comment on lines
+163
to
+168
| if (!_analysisResults.TryGetValue(file.Name, out var isExist)) | ||
| { | ||
| throw new InvalidOperationException($"Unknown file '{file.FullName}'."); | ||
| } | ||
| if (isExist.State != AnalysisState.Succeeded) | ||
| { |
Comment on lines
+139
to
+146
| try | ||
| { | ||
| degreeOfParallelism = int.Parse(degreeStr); | ||
| } | ||
| catch (Exception) | ||
| { | ||
| Console.WriteLine("Invalid input, please try again."); | ||
| return; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
暑培:队式作业提交
基本信息
提交说明
02-multithreading作业提交通道 #33