feat: add plugin traces CLI commands#243
Conversation
Summary of ChangesHello @joshsmithxrm, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a comprehensive set of CLI commands for managing Dataverse plugin trace logs. The implementation is extensive, covering list, get, delete, settings, and timeline visualization functionalities, supported by a new service layer and early-bound entities. The code is well-structured, but I've identified some critical and high-severity issues in the service layer related to performance and correctness of bulk delete and count operations, which could lead to incomplete data processing or API throttling. I've also included some medium-severity suggestions to improve validation and code maintainability.
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull request overview
This PR implements comprehensive plugin trace log management capabilities for the PPDS CLI, adding a complete command group with 6 subcommands for querying, viewing, and managing Dataverse plugin trace logs.
Key Changes
- Implemented
IPluginTraceServicewith full CRUD operations for plugin trace logs - Added 6 CLI commands (
list,get,related,timeline,settings,delete) with extensive filtering options - Generated early-bound
plugintracelogentity for type-safe Dataverse queries - Created timeline hierarchy builder for visualizing plugin execution flow
- Added comprehensive test coverage (63 new tests)
Reviewed changes
Copilot reviewed 17 out of 18 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
src/PPDS.Dataverse/Services/IPluginTraceService.cs |
Service interface with DTOs for plugin trace operations |
src/PPDS.Dataverse/Services/PluginTraceService.cs |
Service implementation with filtering, deletion, and settings management |
src/PPDS.Dataverse/Services/TimelineHierarchyBuilder.cs |
Builds hierarchical timeline from flat trace records |
src/PPDS.Dataverse/Generated/Entities/plugintracelog.cs |
Auto-generated early-bound entity class |
src/PPDS.Cli/Commands/PluginTraces/*.cs |
7 command files implementing CLI interface |
tests/PPDS.Dataverse.Tests/Services/*Tests.cs |
Service layer unit tests |
tests/PPDS.Cli.Tests/Commands/PluginTraces/*Tests.cs |
CLI command unit tests |
src/PPDS.Dataverse/DependencyInjection/ServiceCollectionExtensions.cs |
Registers PluginTraceService in DI container |
src/PPDS.Cli/Program.cs |
Registers plugintraces command group |
scripts/Generate-EarlyBoundModels.ps1 |
Adds plugintracelog to entity generation list |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Addressed Gemini Review Findings (2ae00d9)DeleteByFilterAsync paging - Fixed to page through all matching records in batches of 5000 until none remain. DeleteByIdsAsync efficiency - Now uses CountAsync efficiency - Now uses FetchXML aggregate query instead of retrieving records. --top validation - ListCommand now validates that --top doesn't exceed Dataverse's 5000 limit. Dead code removal - Removed |
Implement CLI commands for querying and managing Dataverse plugin trace logs. Commands: - `ppds plugintraces list` - List traces with 15+ filter options - `ppds plugintraces get` - Get detailed trace information - `ppds plugintraces related` - Get correlated traces by correlation ID - `ppds plugintraces timeline` - Display execution hierarchy tree - `ppds plugintraces settings` - View/set trace logging level - `ppds plugintraces delete` - Delete single, batch, by-age, or all traces Features: - Filter file support (--filter) for complex queries - CSV export (--output-format csv) for analysis - Timeline visualization with ASCII tree - Dry-run mode for delete operations - Progress reporting for bulk deletes Closes #152, #153, #154, #155, #156, #157, #158 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- DeleteByFilterAsync: page through all records, not just first 5000 - DeleteByIdsAsync: use parallel deletion with Parallel.ForEachAsync - CountAsync: use FetchXML aggregate query instead of retrieving records - ListCommand: validate --top doesn't exceed Dataverse's 5000 limit - TimelineHierarchyBuilder: remove dead CalculatePositioning methods 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2ae00d9 to
67c69d8
Compare
- Move StringBuilder outside loop in ListCommand.WriteCsvOutput - Remove redundant .ToString() call in ListCommand - Remove useless upcast to Nullable in SettingsCommand - Refactor TimelineHierarchyBuilder to avoid casting IReadOnlyList to List 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Summary
ppds plugintracescommand group with 6 subcommands for querying and managing Dataverse plugin trace logsIPluginTraceServicewith full CRUD operations and timeline buildingplugintracelogearly-bound entity for type-safe queriesCommands
ppds plugintraces listppds plugintraces getppds plugintraces relatedppds plugintraces timelineppds plugintraces settingsppds plugintraces deleteFeatures
--filter): Load complex filters from JSON file-f csv): Export trace data for external analysis--older-than 7d,--allwith confirmationFiles Changed
New files (14):
src/PPDS.Dataverse/Services/IPluginTraceService.cs- Interface and DTOssrc/PPDS.Dataverse/Services/PluginTraceService.cs- Service implementationsrc/PPDS.Dataverse/Services/TimelineHierarchyBuilder.cs- Timeline hierarchy logicsrc/PPDS.Dataverse/Generated/Entities/plugintracelog.cs- Early-bound entitysrc/PPDS.Cli/Commands/PluginTraces/*.cs- 7 command filestests/PPDS.Dataverse.Tests/Services/*Tests.cs- Service tests (26 tests)tests/PPDS.Cli.Tests/Commands/PluginTraces/*Tests.cs- CLI tests (37 tests)Modified files (3):
scripts/Generate-EarlyBoundModels.ps1- Add plugintracelog entitysrc/PPDS.Dataverse/DependencyInjection/ServiceCollectionExtensions.cs- Register servicesrc/PPDS.Cli/Program.cs- Register command groupCloses #152, #153, #154, #155, #156, #157, #158
Test plan
ppds plugintraces list --helpshows all optionsppds plugintraces timeline <trace-id>shows tree🤖 Generated with Claude Code