- gRPC client-server metrics collection - PeriodicTimer-based 5-second sampling - Delta encoding with configurable thresholds - Queue/retry mechanism for resilience - ProcessId tracking for duplicate detection - Server-side state reconstruction - Native AOT compilation support - Docker/Podman containerization - PostgreSQL + TimescaleDB persistence layer
2.0 KiB
2.0 KiB
JMon Project Guidelines
Package Management
IMPORTANT: Always use dotnet CLI commands to manage NuGet packages. Do NOT directly edit .csproj files for package management.
Use these commands:
dotnet add package <name>- Add a packagedotnet add package <name> --version <version>- Add specific versiondotnet remove package <name>- Remove a packagedotnet nuget add source <url>- Add NuGet sourcedotnet nuget remove source <name>- Remove NuGet source
This ensures:
- Package versions are verified to exist before adding
- Compatibility checks are performed
- Project structure remains clean and consistent
Architecture
- Agent: Worker Service collecting metrics via
/proc(Linux) or platform APIs - Server: ASP.NET Core gRPC service receiving delta metrics
- Protocol: gRPC with Protobuf for binary efficiency
- Communication: Unary RPC pattern (request-response), agent initiates
- Metrics: CPU%, memory, swap, disk usage, IP address, HWID with delta encoding (~50% bandwidth reduction)
- Response Commands: ACK (normal) or SYNC (force full resync)
Code Style
- C# 12+ features (records, nullable references)
#nullable enablerequired- Async/await throughout
- ILogger for all logging
- Use DateTimeOffset for all timestamps (UTC)
Testing & Deployment
Agent Debug Mode
To test the agent without sending to a server:
cd JMonAgent && dotnet run -- --DEBUG=true
This prints formatted metrics to console every 5 seconds instead of sending them via gRPC.
Docker/Podman Setup
Run the full stack with:
podman compose up --build
This starts:
- PostgreSQL 16 with TimescaleDB on localhost:5432
- JMonServer gRPC on localhost:5001
- Metrics automatically persisted to DB with 90-day retention
- Data compressed after 7 days
Connection string: Host=localhost;Port=5432;Database=jmon;Username=jmon;Password=jmon_dev_password
- Suppress SignalR warnings by removing unused packages from project files
- Both projects should build with 0 errors