feat(reporting-api): add subagent observability logging#302
Merged
willvelida merged 2 commits intomainfrom Apr 20, 2026
Merged
Conversation
- add ReportingTelemetry with ActivitySource, Meter, and 5 instruments - expand session.On() with SubagentStarted/Completed/Failed events - add ActivitySource spans for report generation pipeline stages - enable ILogger bridge for Copilot SDK JSON-RPC diagnostics - add structured logging to ReportEndpoints and A2A polling Signed-off-by: Will Velida <willvelida@hotmail.co.uk> agent: github-copilot model: Claude Opus 4.6 contribution: code-generation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds first-class observability to Biotrackr.Reporting.Api’s report-generation pipeline by introducing a centralized telemetry surface (ActivitySource + Meter), wiring it into OpenTelemetry, and expanding structured logging around Copilot subagent execution, endpoints, and the A2A agent polling flow.
Changes:
- Added
ReportingTelemetry(ActivitySource + Meter) with counters/histograms/gauge for report/subagent execution. - Instrumented
ReportGenerationServicewith custom spans, subagent lifecycle event logging, and metric recording. - Added structured logging to report endpoints and A2A polling; enabled Copilot SDK JSON-RPC diagnostics via ILogger.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
.../Telemetry/ReportingTelemetry.cs |
Introduces centralized OpenTelemetry ActivitySource/Meter and instruments. |
.../Program.cs |
Registers the new source/meter with the OTel pipeline. |
.../Services/CopilotService.cs |
Routes Copilot SDK diagnostics into ILogger and documents telemetry limitations in sidecar mode. |
.../Services/ReportGenerationService.cs |
Adds spans, subagent event subscriptions, and records custom metrics during generation. |
.../Endpoints/ReportEndpoints.cs |
Adds endpoint-level structured logs for report listing and job retrieval. |
.../Agents/ReportGenerationAgent.cs |
Adds A2A polling/completion structured logs. |
- use 'using var' for eventSubscription to prevent leak on exception - fix AgentName/DisplayName mismatch in subagent log templates - remove early return to ensure metrics recorded on all paths - lower A2A poll logs from Information to Debug Signed-off-by: Will Velida <willvelida@hotmail.co.uk> agent: github-copilot model: Claude Opus 4.6 contribution: code-generation
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
Add custom OpenTelemetry
ActivitySourcetrace spans, Copilot SDK subagent lifecycle event subscriptions, custom metrics, ILogger bridge for JSON-RPC diagnostics, and structured logging across the Reporting API's report generation pipeline, endpoints, and A2A agent.Motivation
The Reporting.Api had zero custom
ActivitySourcespans, unused Copilot SDK subagent lifecycle events, no custom metrics, and gaps in endpoint/agent logging — making it difficult to understand how subagents collaborate during report generation.Changes
New File
Telemetry/ReportingTelemetry.cs— CentralizedActivitySourceandMeterwith 5 instruments:ReportsGenerated,ReportsFailed,ReportDuration,SubagentDuration,ConcurrentJobsModified Files
Program.cs— RegisteredReportingTelemetry.SourceNamewith.AddSource()and.AddMeter()in OpenTelemetry pipelineServices/CopilotService.cs— AddedLoggerandLogLevel = "info"toCopilotClientOptionsfor JSON-RPC diagnostics; added code comment documentingTelemetryConfiglimitation in sidecar/external server modeServices/ReportGenerationService.cs— Added 4ActivitySourcespans (report.generate,copilot.session,report.artifact_scan,report.artifact_upload); expandedsession.On()withSubagentStartedEvent,SubagentCompletedEvent,SubagentFailedEvent,AssistantUsageEventsubscriptions; addedStopwatchtiming and metric recordingEndpoints/ReportEndpoints.cs— AddedILogger<Program>injection and structured logging to both GET endpointsAgents/ReportGenerationAgent.cs— Added structured logging toHandleStatusPollAsyncfor A2A pollingObservability Improvements
report.generate,copilot.session,report.artifact_scan,report.artifact_upload)SubagentStarted,SubagentCompleted,SubagentFailedlogged with timing/tokensHandleStatusPollAsyncRelated
agentIdmissing from SessionEvent in .NET, Go, and Python SDKs github/copilot-sdk#1110 —agentIdmissing fromSessionEventin .NET/Go/Python SDKs.copilot-tracking/research/2026-04-19/reporting-api-subagent-logging-research.md(10 key discoveries, 6 subagent research documents)Validation