Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR introduces new proto definitions for metric, experiment, and project records, along with updated build scripts, go.mod dependency changes, and expanded tests to validate JSON serialization and yRange parsing.
- Adds new .proto files and corresponding Python and Go generated code
- Implements a parser in Go with unit tests for handling yRange conversion and enum validation
- Updates build and CI configuration files and documentation for the core module
Reviewed Changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| swanlab/proto/record/v1/metric_pb2.pyi | Added view of generated type definitions for metric records |
| swanlab/proto/record/v1/metric_pb2.py | Generated Python file for metric proto changes |
| swanlab/proto/record/v1/metric.proto | New proto definitions for runtime, column, media, scalar and log records |
| swanlab/proto/record/v1/experiment_pb2.pyi | Added new experiment proto type definitions |
| swanlab/proto/record/v1/experiment_pb2.py | Generated Python file for experiment proto changes |
| swanlab/proto/record/v1/experiment.proto | New proto definitions for project and experiment records |
| script/build_proto.py | Updated build instructions to include gRPC tools installation |
| core/pkg/pb/*.go | Updated Go generated files (experiment, common, collector service) |
| core/internal/api/parse.go | Introduced a Parser for proto-to-JSON conversion and yRange handling |
| core/internal/api/parse_test.go | Added unit tests to validate yRange serialization and parser functionality |
| core/internal/api/api.go | Minor documentation update in file header |
| core/go.mod | Updated dependencies and added indirect modules |
| core/README.md | Updated file template documentation |
| .github/workflows/test-core.yml | Enhanced CI workflow with additional testing and module verification |
Comments suppressed due to low confidence (2)
core/internal/api/parse.go:1
- The file header title 'send.go' does not match the actual file name 'parse.go'. Consider updating the header to reflect the correct filename for clarity.
// @Title send.go
core/internal/api/parse_test.go:70
- [nitpick] Consider replacing 'string(rune(rand.Intn(1000)))' with 'strconv.Itoa(rand.Intn(1000))' for a clearer and more idiomatic conversion of an integer to a string.
record.ChartIndex: "test-chart-index" + string(rune(rand.Intn(1000))),
10281b3 to
485ae66
Compare
Kaikaikaifang
requested changes
Jun 14, 2025
616e996 to
74b5b13
Compare
74b5b13 to
5e1eac9
Compare
SAKURA-CAT
added a commit
that referenced
this pull request
Jun 15, 2025
* feat: init go project (#1064) * fix: license use symlink (#1067) * Feature/protobuf: hello-word (#1074) * feat: init go project (#1064) * feat: add proto and grpc * feat: add proto build script * fix: golangci lint * feat: support auto or specify select port * chore: license * chore: add .golangci.yml * fix: use log/slog instead of log * chore: del core vendor --------- Co-authored-by: Kang Li <79990647+SAKURA-CAT@users.noreply.github.com> * feat: impl health checker and init data collector (#1077) * feat: impl health checker and init data collector * chore: change module name --------- Co-authored-by: KAAANG <79990647+SAKURA-CAT@users.noreply.github.com> * Feat/record proto and column parser (#1091) Co-authored-by: kaikai <2837968358@qq.com> * fix: import module and typo --------- Co-authored-by: Kaikai <98205900+Kaikaikaifang@users.noreply.github.com> Co-authored-by: kaikai <2837968358@qq.com>
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.
Description
for #1063
列的枚举定义
在column的proto中,我们定义了以下枚举:
其中除了 列type为必传参数以外,其他为可选,这意味着只有列的枚举0值被设置为UNKNOWN:
其他的枚举中0为默认值(有效值),这样方便测试,减少繁琐的计算。
yRange解析测试
在go中要实现
null和int共存是一件很麻烦的事情,我们通过使用指针实现了这一点,从而在json序列化时支持类似[null, int]的格式。在这里需要直接访问protobuf结构体的值,以防Get函数在空指针时自动设置默认空值——但是在linter规则中这不允许,因此我们通过注释显式告诉linter:
Record 包装message
在保存备份日志时所有message都保存在同一份文件中,因此需要一个统一的message包装器来打包、标识不同类型的message——我们称之为
Record: