Skip to content

Add get procfs stat#25

Merged
leborchuk merged 12 commits intomainfrom
AddGetProcfsdataImpl
Apr 30, 2026
Merged

Add get procfs stat#25
leborchuk merged 12 commits intomainfrom
AddGetProcfsdataImpl

Conversation

@leborchuk
Copy link
Copy Markdown
Contributor

@leborchuk leborchuk commented Apr 29, 2026

Adds procfs-based per-PID /proc collection (cmdline/stat/status) and exposes it via the segment gRPC API, along with protobuf schema updates to carry the new data.

Changes:

  • Introduces internal/utils/procfs.go to read /proc/ using github.com/prometheus/procfs and map results into protobuf messages.
  • Adds a new gRPC handler in internal/grpc/get_query_info.go to fetch per-PID proc information for requested segment processes.

Copilot AI review requested due to automatic review settings April 29, 2026 09:09
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds procfs-based per-PID /proc collection (cmdline/stat/status) and exposes it via the segment gRPC API, along with protobuf schema updates to carry the new data.

Changes:

  • Introduces internal/utils/procfs.go to read /proc/<pid> using github.com/prometheus/procfs and map results into protobuf messages.
  • Adds a new gRPC handler in internal/grpc/get_query_info.go to fetch per-PID proc information for requested segment processes.
  • Updates protobuf definitions/generated code to extend GpPidProcInfo payload (including state and proc_io) and regenerates multiple pb.go files.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
internal/utils/procfs.go New procfs reader + mapping utilities to protobuf (GetPidProcInfo, conversions, cmdline parsing).
internal/utils/procfs_test.go Unit tests for procfs parsing/mapping helpers and non-existent PID handling.
internal/utils/procfs_linux_test.go Linux-only test validating GetPidProcInfo against the current process.
internal/grpc/get_query_info.go Adds server handler intended to return proc info for a list of PIDs.
internal/grpc/get_query_info_test.go Adds handler-level tests for nil/empty/non-existent PID requests and a test server helper.
internal/grpc/get_query_info_linux_test.go Linux-only test validating proc info retrieval for the current process via the server handler.
api/proto/common/yagpcc_metrics.proto Extends GpPidProcInfo schema (adds state, shifts fields, adds ProcIO).
api/proto/common/yagpcc_metrics.pb.go Regenerated protobuf Go output reflecting GpPidProcInfo/ProcIO and related type changes.
api/proto/common/yagpcc_session.pb.go Regenerated protobuf Go output (timestamp import/type changes).
api/proto/agent_segment/yagpcc_set_service_grpc.pb.go Regenerated gRPC stubs (protoc version/header updates).
api/proto/agent_segment/yagpcc_set_service.pb.go Regenerated protobuf Go output (timestamp import/type changes).
api/proto/agent_segment/yagpcc_get_service_grpc.pb.go Regenerated gRPC stubs for GetQueryInfo service.
api/proto/agent_segment/yagpcc_get_service.pb.go Regenerated protobuf Go output for GetQueryInfo messages.
api/proto/agent_segment/yagpcc_control_service_grpc.pb.go Regenerated gRPC stubs (protoc version/header updates).
api/proto/agent_segment/yagpcc_control_service.pb.go Regenerated protobuf Go output (timestamp import/type changes).
api/proto/agent_master/yagpcc_get_service_grpc.pb.go Regenerated gRPC stubs (protoc version/header updates).
api/proto/agent_master/yagpcc_get_service.pb.go Regenerated protobuf Go output (timestamp import/type changes).
api/proto/agent_master/yagpcc_action_service_grpc.pb.go Regenerated gRPC stubs (emptypb import/type changes).
api/proto/agent_master/yagpcc_action_service.pb.go Regenerated protobuf Go output (emptypb import/type changes).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/grpc/get_query_info.go Outdated
Comment thread internal/grpc/get_query_info.go
Comment thread internal/grpc/get_query_info_test.go Outdated
Comment thread internal/utils/procfs_test.go Outdated
Comment thread internal/grpc/get_query_info.go Outdated
Comment thread internal/utils/procfs_linux_test.go Outdated
Comment thread internal/utils/procfs.go
Comment thread internal/utils/procfs.go
Comment thread internal/grpc/get_query_info_test.go
Comment thread api/proto/common/yagpcc_metrics.proto
leborchuk and others added 9 commits April 30, 2026 09:22
We use github.com/prometheus/procfs to get procfs stat
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
… range check

Agent-Logs-Url: https://github.com/open-gpdb/yagpcc/sessions/8809c3c7-939b-4c9a-b1d8-f3165a0269ac

Co-authored-by: leborchuk <63977577+leborchuk@users.noreply.github.com>
@leborchuk leborchuk force-pushed the AddGetProcfsdataImpl branch from 700ce42 to 3826939 Compare April 30, 2026 06:25
@leborchuk leborchuk requested a review from vovik0134 April 30, 2026 06:26
Comment thread go.mod
Comment thread internal/utils/procfs.go
Comment thread internal/utils/procfs.go Outdated
Comment thread internal/grpc/get_query_info.go
Comment thread api/proto/common/yagpcc_metrics.proto
@leborchuk leborchuk merged commit c27e203 into main Apr 30, 2026
1 check passed
@leborchuk leborchuk deleted the AddGetProcfsdataImpl branch April 30, 2026 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants