Skip to content

Conversation

@fmorency
Copy link
Contributor

@fmorency fmorency commented May 5, 2025

This pull request introduces significant changes to the manifest-node-exporter project, focusing on replacing gRPC-based metrics collection with a new autodetection and monitoring system. The changes also include refactoring, cleanup, and dependency updates. Below is a breakdown of the most important changes:

Migration from gRPC to Autodetection and Monitoring

  • Introduced a new autodetection framework to dynamically detect running processes and their gRPC readiness. This includes the ProcessMonitor interface and its implementation for the manifestd process in pkg/autodetect/manifestd/manifestd.go. [1] [2]
  • Replaced the gRPC-based setup (setupGrpc) with a new setupMonitors function that initializes process monitors and collects registered Prometheus collectors.
  • Added a registerCollectors function to register detected collectors with Prometheus.

Refactoring of Collectors

  • Moved and renamed gRPC-related collector files to pkg/autodetect/manifestd/collectors/ and updated their package names to collectors. [1] [2] [3]
  • Updated collector constructors to use the new client.GRPCClient type instead of the previous pkg.GRPCClient. [1] [2] [3]
  • Added a registry for ManifestdCollectorFactory to dynamically register and retrieve collectors.

Command-Line Interface (CLI) Updates

  • Simplified the serve command by removing the requirement for a gRPC address as an argument and updating the command description.
  • Removed unused flags (max-concurrency and max-retries) from the serve command.

Code Cleanup and Testing

  • Removed the setupGrpc function and related validation logic, as well as the corresponding unit tests for invalid gRPC addresses. [1] [2]
  • Deleted the TestInvalidAddress and TestServeCommand_InvalidArgs test cases, which are no longer relevant due to the removal of gRPC address validation.

Dependency Updates

  • Added new dependencies to support the autodetection and monitoring system, including github.com/shirou/gopsutil/v4 and github.com/tklauser/numcpus.

These changes mark a significant shift in the architecture of the project, replacing static gRPC configurations with a dynamic autodetection framework and improving extensibility for future process monitoring.

@fmorency fmorency requested a review from Copilot May 5, 2025 20:29
@fmorency fmorency self-assigned this May 5, 2025
Copy link

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

This PR removes the gRPC-based monitoring and tests, replacing them with a new process auto-detection mechanism while also refactoring package naming for better modularity and maintainability.

  • Removed obsolete gRPC-related functionality and tests.
  • Introduced new process auto-detection in the autodetect package and updated monitoring logic accordingly.
  • Renamed and reorganized packages (e.g. from “grpc” to “collectors” and moving the gRPC file to “client”) to improve clarity.

Reviewed Changes

Copilot reviewed 16 out of 17 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/e2e_serve_test.go Deleted e2e tests related to gRPC functionality, as they are no longer applicable.
test_utils/mockGrpcClient.go Updated client references to use the new client package instead of the old pkg alias.
pkg/utils/grpc.go Added helper IsGrpcPort function to check gRPC connectivity.
pkg/monitors/registry.go Refactored to support the new process monitoring registry with updated client usage.
pkg/monitors/manifestd/manifestd.go Introduced process auto-detection for manifestd with graceful error handling and logging.
pkg/monitors/manifestd/collectors/*.go Renamed and refactored collector files from package grpc to collectors with updated imports.
pkg/client/grpc.go Renamed package from pkg to client for improved clarity in gRPC client references.
pkg/autodetect/process.go New implementation for process auto-detection and listening ports retrieval.
cmd/serve.go Removed obsolete gRPC setup and updated serve command to utilize the new monitoring logic.
cmd/root.go Minor flag and logging configuration adjustments.
Files not reviewed (1)
  • go.mod: Language not supported
Comments suppressed due to low confidence (2)

tests/e2e_serve_test.go:1

  • The removal of the e2e test file for gRPC is expected with the removal of gRPC functionality. However, please ensure to add new tests covering the auto-detection and process monitoring functionality.
Entire file deleted: tests previously covered gRPC end-to-end tests.

pkg/monitors/manifestd/collectors/common.go:1

  • [nitpick] Verify that all references to the old 'grpc' package have been updated to 'collectors' across the codebase and associated documentation to ensure consistency.
package collectors

@fmorency fmorency requested a review from Copilot May 6, 2025 15:15
Copy link

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

This PR replaces the static gRPC metrics collection with a dynamic autodetection framework while refactoring collector implementations and cleaning up obsolete gRPC code and related tests.

  • Migrates from gRPC-based metrics collection to a process autodetection system and automatically registers Prometheus collectors.
  • Refactors and renames collector packages, updating client types and registry mechanisms.
  • Removes tests and code associated with obsolete gRPC validation and connection setup.

Reviewed Changes

Copilot reviewed 18 out of 19 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/e2e_serve_test.go Removed end-to-end tests for gRPC metrics collection.
test_utils/mockGrpcClient.go Updated GRPC client setup to use client.GRPCClient.
pkg/utils/registry.go Added a generic registry for process monitors and collector factories.
pkg/utils/grpc.go Introduced a utility to verify gRPC port connectivity.
pkg/autodetect/manifestd/manifestd.go Implements autodetection for the manifestd process with a fallback port.
pkg/autodetect/manifestd/collectors/* Refactored collectors for manifestd and registered via a new registry.
cmd/serve.go Replaces setupGrpc with setupMonitors and updates metrics server setup.
cmd/root.go Minor flag configuration update.
Files not reviewed (1)
  • go.mod: Language not supported
Comments suppressed due to low confidence (1)

tests/e2e_serve_test.go:1

  • The deletion of the end-to-end tests for gRPC metrics collection reduces coverage for this functionality. Please ensure that alternative tests are added to validate the new autodetection and monitoring system.
package tests

@fmorency fmorency merged commit a1ef906 into manifest-network:main May 6, 2025
3 checks passed
@fmorency fmorency deleted the auto-detect branch May 6, 2025 15:23
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.

1 participant