feat(ci): Add automated performance tracing to CI pipeline#12
Merged
neil-pozetroninc merged 11 commits intomainfrom Oct 24, 2025
Merged
feat(ci): Add automated performance tracing to CI pipeline#12neil-pozetroninc merged 11 commits intomainfrom
neil-pozetroninc merged 11 commits intomainfrom
Conversation
Fixes critical configuration mismatch where documentation instructed users to set PROBOTSHARP_GITHUB_WEBHOOKSECRET but code expects PROBOTSHARP_WEBHOOK_SECRET, causing webhook validation failures. Changes: - Updated all .env.example files to use PROBOTSHARP_WEBHOOK_SECRET - Fixed docker-compose.yml environment variable mapping - Updated documentation in Operations.md and README files - Standardized configuration pattern across entire codebase This is a documentation-only change; the code already supports the correct configuration through its fallback chain.
Integrates dotnet-trace into the CI workflow to automatically generate performance flamegraphs using HelloWorldBot as the test application. This enables continuous performance monitoring and helps identify regressions early in the development cycle. The performance-trace job: - Builds and runs HelloWorldBot - Collects 30-second performance trace using dotnet-trace - Converts to Speedscope format for visualization - Uploads flamegraph as workflow artifact (7-day retention) - Added as required check in all-tests-passed job
The performance-trace job was failing because HelloWorldBot is not included in ProbotSharp.sln. The workflow restored the solution but then tried to build HelloWorldBot with --no-restore, causing: error NETSDK1004: Assets file 'obj/project.assets.json' not found This adds an explicit restore step for HelloWorldBot before building, ensuring all dependencies are available.
The performance trace was failing because HelloWorldBot requires GitHub App credentials to start. Without valid config, the app crashes before dotnet-trace can attach (exit code 3). Changes: - Create dummy GitHub App private key file - Set environment variables (AppId, WebhookSecret, PrivateKeyPath) - Add process health check before attempting trace collection - Improve error messages for debugging This allows the app to start successfully for performance profiling without needing real GitHub App credentials.
Add output redirection and detailed logging to diagnose why dotnet-trace collection is failing with exit code 3 even though the process is running. Changes: - Redirect app stdout/stderr to /tmp/app.log - Show app logs in process health check - Show app logs and process list on trace collection failure - Print PID at startup for debugging This will help identify if the issue is: - Process crashing during trace collection - Permissions/capabilities issue - .NET diagnostics not available in Release mode
Switch from Release to Debug build configuration to ensure .NET diagnostics and EventPipe are fully available for dotnet-trace. Release builds may have optimizations that interfere with runtime profiling capabilities.
Add --providers Microsoft-Windows-DotNETRuntime to explicitly specify which runtime events to trace. This may resolve attachment issues.
Found via web search: On Linux/macOS, dotnet-trace requires the target application and dotnet-trace to share the same TMPDIR environment variable. Otherwise, the command will time out. Set TMPDIR=/tmp for both: - The background HelloWorldBot process - The dotnet-trace collect step This should resolve the exit code 3 failure that occurred because dotnet-trace couldn't establish a connection to the process. Source: https://learn.microsoft.com/en-us/dotnet/core/diagnostics/dotnet-trace
Add command to see if process is visible List diagnostic sockets in /tmp to verify EventPipe is available Set DOTNET_DiagnosticPorts explicitly This will help identify if the issue is: - Process not creating diagnostic sockets - dotnet-trace unable to discover the process - Permission/visibility issues between processes
The issue was using --pid flag which doesn't exist. dotnet-trace expects: - --process-id (not --pid) - OR --name (preferred for dotnet run which spawns child process) Diagnostic logs showed: ✅ Process running (PID 2915 parent, 2966 child HelloWorldBot) ✅ dotnet-trace can see the process ✅ Diagnostic socket exists: /tmp/dotnet-diagnostic-2966-8585-socket ❌ But command failed with: 'Must specify either --process-id, --name, --diagnostic-port, or --dsrouter' Using --name HelloWorldBot to let dotnet-trace find the correct child process automatically.
Now that tracing works with --name flag, switch from Debug to Release build for more realistic performance profiling. Release builds have optimizations enabled and represent actual production performance.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Integrates
dotnet-traceinto the CI workflow to automatically generate performance flamegraphs for continuous performance monitoring.Changes
New
performance-tracejob in.github/workflows/dotnet.ymldotnet-traceUpdated
all-tests-passedjobperformance-traceas required dependencyBenefits
Test Plan
Viewing Flamegraphs
After this PR merges, flamegraphs will be available on every CI run:
flamegraphartifacttrace.speedscope.jsonto visualizeImplementation Notes