Skip to content

feat: add plugin traces CLI commands#243

Merged
joshsmithxrm merged 4 commits intomainfrom
feature/plugin-traces
Jan 7, 2026
Merged

feat: add plugin traces CLI commands#243
joshsmithxrm merged 4 commits intomainfrom
feature/plugin-traces

Conversation

@joshsmithxrm
Copy link
Owner

Summary

  • Add ppds plugintraces command group with 6 subcommands for querying and managing Dataverse plugin trace logs
  • Implement IPluginTraceService with full CRUD operations and timeline building
  • Generate plugintracelog early-bound entity for type-safe queries
  • Add comprehensive unit tests (63 new tests)

Commands

Command Description
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 as ASCII tree
ppds plugintraces settings View/set trace logging level (off/exception/all)
ppds plugintraces delete Delete single, batch, by-age, or all traces

Features

  • Filter options: type, message, entity, mode, errors-only, since/until, duration, correlation ID, etc.
  • Filter file support (--filter): Load complex filters from JSON file
  • CSV export (-f csv): Export trace data for external analysis
  • Timeline visualization: ASCII tree showing plugin execution hierarchy with timing
  • Delete modes: Single ID, comma-separated IDs, --older-than 7d, --all with confirmation
  • Dry-run support: Preview delete operations without executing

Files Changed

New files (14):

  • src/PPDS.Dataverse/Services/IPluginTraceService.cs - Interface and DTOs
  • src/PPDS.Dataverse/Services/PluginTraceService.cs - Service implementation
  • src/PPDS.Dataverse/Services/TimelineHierarchyBuilder.cs - Timeline hierarchy logic
  • src/PPDS.Dataverse/Generated/Entities/plugintracelog.cs - Early-bound entity
  • src/PPDS.Cli/Commands/PluginTraces/*.cs - 7 command files
  • tests/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 entity
  • src/PPDS.Dataverse/DependencyInjection/ServiceCollectionExtensions.cs - Register service
  • src/PPDS.Cli/Program.cs - Register command group

Closes #152, #153, #154, #155, #156, #157, #158

Test plan

  • Build succeeds with 0 errors, 0 warnings
  • All existing tests pass (7,316+ tests)
  • New unit tests pass (63 tests across net8.0/net9.0/net10.0)
  • Manual testing: ppds plugintraces list --help shows all options
  • Manual testing: ppds plugintraces timeline <trace-id> shows tree

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings January 7, 2026 03:11
@gemini-code-assist
Copy link

Summary of Changes

Hello @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 ppds CLI tool by introducing a new command group dedicated to Dataverse plugin trace logs. It provides developers and administrators with powerful capabilities to query, analyze, and manage plugin execution traces directly from the command line. This streamlines debugging workflows and offers greater control over trace log data within Dataverse environments.

Highlights

  • New CLI Command Group: Introduced ppds plugintraces with six subcommands for comprehensive management of Dataverse plugin trace logs.
  • Comprehensive Trace Management: Added commands for listing, getting details, finding related traces, visualizing timelines, managing settings, and deleting traces.
  • Flexible Filtering & Export: The list command supports over 15 filter options, filter file support for complex queries, and CSV export for external analysis.
  • Timeline Visualization: A new timeline command displays the execution hierarchy of correlated plugins as an ASCII tree, aiding in understanding complex plugin flows.
  • Robust Deletion Options: The delete command offers various deletion modes, including by single ID, batch of IDs, age (--older-than), or all traces, with dry-run and confirmation support.
  • Service Layer Implementation: Implemented IPluginTraceService with full CRUD operations and logic for building plugin execution timelines.
  • Type-Safe Entity: Generated the plugintracelog early-bound entity, providing type-safe interactions with Dataverse plugin trace log records.
  • Extensive Testing: Added 63 new unit tests, ensuring the reliability and correctness of both the CLI commands and the underlying service layer.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

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.

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 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 IPluginTraceService with full CRUD operations for plugin trace logs
  • Added 6 CLI commands (list, get, related, timeline, settings, delete) with extensive filtering options
  • Generated early-bound plugintracelog entity 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.

@joshsmithxrm
Copy link
Owner Author

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 Parallel.ForEachAsync with pool-managed parallelism (per ADR-0002). This approach leverages the connection pool's throttle-aware routing across multiple Application Users.

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 CalculatePositioning methods. The Build method is kept for unit tests.

joshsmithxrm and others added 3 commits January 6, 2026 22:11
Issues: #152, #153, #154, #155, #156, #157, #158
Branch: feature/plugin-traces
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>
- 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

feat: Add ppds plugintraces list command with inline filters

2 participants