Skip to content

.NET: Document ILoggerFactory for UseFunctionInvocation - #8315

Open
mrchatam wants to merge 2 commits into
microsoft:mainfrom
mrchatam:docs/iloggerfactory-usefunctioninvocation
Open

.NET: Document ILoggerFactory for UseFunctionInvocation#8315
mrchatam wants to merge 2 commits into
microsoft:mainfrom
mrchatam:docs/iloggerfactory-usefunctioninvocation

Conversation

@mrchatam

Copy link
Copy Markdown
Contributor

Summary

  • Pass the AgentOpenTelemetry sample's existing ILoggerFactory into UseFunctionInvocation(loggerFactory) so tool-execution exceptions are logged (as clarified in .NET: execute_tool doesn't capture the failure in telemetry #2211).
  • Document both approaches in the sample README: direct ILoggerFactory injection and Build(IServiceProvider).
  • Fix README inaccuracies (sample path; .WithOpenTelemetry().UseOpenTelemetry() for the agent pipeline).

Fixes #2352

Test plan

  • Spot-check README rendering
  • Confirm sample still builds (dotnet build on AgentOpenTelemetry.csproj) when credentials are not required for compile

Pass the sample's ILoggerFactory into UseFunctionInvocation so tool
failures are logged, and document both direct injection and Build(IServiceProvider)
in the AgentOpenTelemetry README. Fixes a couple of README inaccuracies.

Fixes microsoft#2352
Copilot AI balanced review requested due to automatic review settings September 11, 2026 21:54
@mrchatam
mrchatam deployed to github-app-auth September 11, 2026 21:54 — with GitHub Actions Active
@mrchatam
mrchatam deployed to github-app-auth September 11, 2026 21:54 — with GitHub Actions Active
@mrchatam
mrchatam deployed to github-app-auth September 11, 2026 21:55 — with GitHub Actions Active
@agent-framework-automation agent-framework-automation Bot added documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs .NET Usage: [Issues, PRs], Target: .Net labels Sep 11, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The focused code and documentation changes correctly address the linked logging issue.

Pull request overview

Documents and enables tool-execution exception logging in the AgentOpenTelemetry sample.

Changes:

  • Passes ILoggerFactory to UseFunctionInvocation.
  • Documents direct injection and DI-based alternatives.
  • Corrects the sample path and OpenTelemetry API name.
File summaries
File Description
dotnet/samples/02-agents/AgentOpenTelemetry/README.md Adds logging guidance and corrects instructions.
dotnet/samples/02-agents/AgentOpenTelemetry/Program.cs Enables detailed tool-failure logging.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Balanced (auto)

Note

Copilot is running an experiment and ran this review at Balanced.


💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@mrchatam

Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree

@mrchatam
mrchatam deployed to github-app-auth September 12, 2026 23:46 — with GitHub Actions Active
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs .NET Usage: [Issues, PRs], Target: .Net

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.NET: Improve documentation around providing ILoggerFactory through IServiceProvider or UseFunctionInvocation

2 participants