Thinpool gRPC Call And Monitor#58
Conversation
3fff410 to
96dc7cd
Compare
| type NodeStatsProvider interface { | ||
| ContainerFsStats(ctx context.Context) (FsStats, error) | ||
| ThinPoolMetrics() ([]*ThinPoolMetrics, error) | ||
| ExportToVictoriaMetrics([]*ThinPoolMetrics) error |
There was a problem hiding this comment.
Metrics exporting should be done in lvm thin pool monitor?
dinoallo
left a comment
There was a problem hiding this comment.
Currently, the implementation of NodeStatsProviderImpl is coupled with LVM. Please make devbox controller as storage agnostic as possible, i.e. remove any logic related to LVM. Instead, you should implement NodeStatsProviderImpl in LVM monitor. NodeStats should only contain the information required for scheduling pods.
|
Also, the linting check has failed. |
63a284a to
be6c2a1
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR implements "Thinpool gRPC Call And Monitor" functionality for the devbox controller, transitioning from v1alpha1 to v1alpha2 API version and introducing comprehensive LVM thin pool monitoring with gRPC communication and VictoriaMetrics integration.
Key changes include:
- Complete API version migration from v1alpha1 to v1alpha2 with new devbox state management and commit recording system
- Implementation of LVM monitoring service with gRPC server/client architecture for thin pool metrics collection
- Addition of VictoriaMetrics integration for metrics export and monitoring dashboard support
Reviewed Changes
Copilot reviewed 54 out of 57 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| service/go.work.sum | Added dependencies for Alipay SDK and cenkalti/backoff package updates |
| controllers/devbox/internal/stat/ | New LVM monitoring system with gRPC services, clients, and VictoriaMetrics integration |
| controllers/devbox/internal/controller/ | Major refactor to v1alpha2 API with new state management, scheduling logic, and registry utilities |
| controllers/devbox/internal/commit/ | New commit system implementation with containerd integration for image management |
| controllers/devbox/api/v1alpha2/ | New API version with updated devbox resource definitions and state management |
| controllers/devbox/config/ | Updated RBAC, samples, and deployment manifests for v1alpha2 |
| fmt.Printf("=== Thin Pool Metrics Test Results ===\n") | ||
| fmt.Printf("Total thin pools found: %d\n", len(metrics)) |
There was a problem hiding this comment.
The test functions TestCollectThinPoolMetrics and TestExportToVictoriaMetrics contain duplicated code for printing test results. Consider extracting this into a helper function to reduce code duplication.
| fmt.Printf("=== Thin Pool Metrics Test Results ===\n") | ||
| fmt.Printf("Total thin pools found: %d\n", len(metrics)) |
There was a problem hiding this comment.
The test functions TestCollectThinPoolMetrics and TestExportToVictoriaMetrics contain duplicated code for printing test results. Consider extracting this into a helper function to reduce code duplication.
| // todo : delete data and save length | ||
| logger.Info("[exportToVictoriaMetrics] Sending %d metrics to VM:\n%s\n", len(allPrometheusData), data) |
There was a problem hiding this comment.
The TODO comment indicates that logging the full data should be removed and only the length should be saved. This could expose sensitive information in logs and should be addressed.
| // todo : delete data and save length | |
| logger.Info("[exportToVictoriaMetrics] Sending %d metrics to VM:\n%s\n", len(allPrometheusData), data) | |
| // Only log the count and size of metrics, not the full data to avoid exposing sensitive information | |
| logger.Info("[exportToVictoriaMetrics] Sending %d metrics to VM (total size: %d bytes)", len(allPrometheusData), len(data)) |
| } | ||
|
|
||
| func RegisterLVMMonitorServiceServer(s grpc.ServiceRegistrar, srv LVMMonitorServiceServer) { | ||
| // If the following call pancis, it indicates UnimplementedLVMMonitorServiceServer was |
There was a problem hiding this comment.
There's a typo in the comment: 'pancis' should be 'panics'.
| // If the following call pancis, it indicates UnimplementedLVMMonitorServiceServer was | |
| // If the following call panics, it indicates UnimplementedLVMMonitorServiceServer was |
| // test: | ||
| for _, metric := range metrics { | ||
| fmt.Printf("Client metric: %+v\n", *metric) |
There was a problem hiding this comment.
Debug code with fmt.Printf statements should be removed from production code or replaced with proper logging.
| // test: | |
| for _, metric := range metrics { | |
| fmt.Printf("Client metric: %+v\n", *metric) | |
| logger.Debug("Client metric: %+v", *metric) |
| // TODO: check if this could lead to overflow | ||
| totalCPULimit += cpuLimit.Value() |
There was a problem hiding this comment.
Multiple TODO comments indicate potential overflow issues in resource calculation. These should be addressed by implementing proper overflow checks or using appropriate data types.
| // TODO: check if this could lead to overflow | ||
| totalMemoryRequest += memReq.Value() |
There was a problem hiding this comment.
Multiple TODO comments indicate potential overflow issues in resource calculation. These should be addressed by implementing proper overflow checks or using appropriate data types.
| // TODO: check if this could lead to overflow | ||
| totalMemoryLimit += memLimit.Value() |
There was a problem hiding this comment.
Multiple TODO comments indicate potential overflow issues in resource calculation. These should be addressed by implementing proper overflow checks or using appropriate data types.
| if username == "" && secret == "" { | ||
| hostOptions.Credentials = nil | ||
| } else { | ||
| // TODO: fix this, use flags or configs to set mulit registry credentials |
There was a problem hiding this comment.
There's a typo in the comment: 'mulit' should be 'multi'.
| // TODO: fix this, use flags or configs to set mulit registry credentials | |
| // TODO: fix this, use flags or configs to set multi registry credentials |
| } | ||
| } | ||
|
|
||
| // todo: implement the schedule logic to replace the current logic |
There was a problem hiding this comment.
This TODO comment indicates incomplete scheduling logic implementation. The comment should be more specific about what needs to be implemented or removed if the logic is complete.
| // todo: implement the schedule logic to replace the current logic |
|
We require pull request titles to follow the Conventional Commits specification and it looks like your proposed title needs to be adjusted. Details: |
No description provided.