Skip to content

Homework/02 multithreading - #101

Open
invincible-summer wants to merge 2 commits into
eesast:homework/02-multithreadingfrom
invincible-summer:homework/02-multithreading
Open

Homework/02 multithreading#101
invincible-summer wants to merge 2 commits into
eesast:homework/02-multithreadingfrom
invincible-summer:homework/02-multithreading

Conversation

@invincible-summer

Copy link
Copy Markdown

暑培:队式作业提交

基本信息

  • 姓名:杨钧富
  • 班级:无51
  • 学号:2025010180

提交说明

Copilot AI lite review requested due to automatic review settings August 21, 2026 07:59
@mergify mergify Bot added the homework Homework PR, will not be merged label Aug 21, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 thread src/LocalCli/Program.cs
Comment on lines +139 to +146
try
{
degreeOfParallelism = int.Parse(degreeStr);
}
catch (Exception)
{
Console.WriteLine("Invalid input, please try again.");
return;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

homework Homework PR, will not be merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants