Add request duration to LogRequestHandlerCompleted and LogRequestHandlerException log messages#1092
Merged
stephentoub merged 7 commits intomainfrom Dec 15, 2025
Merged
Conversation
Co-authored-by: stephentoub <[email protected]>
…parsing Co-authored-by: stephentoub <[email protected]>
stephentoub
reviewed
Dec 12, 2025
Copilot
AI
changed the title
[WIP] Improve logRequestHandlerCompleted to include request duration
Add request duration to LogRequestHandlerCompleted log message
Dec 12, 2025
8b90f03 to
b9c408e
Compare
stephentoub
reviewed
Dec 12, 2025
tests/ModelContextProtocol.Tests/Server/McpServerRequestDurationLoggingTests.cs
Outdated
Show resolved
Hide resolved
…gging test Co-authored-by: stephentoub <[email protected]>
stephentoub
approved these changes
Dec 12, 2025
halter73
previously approved these changes
Dec 13, 2025
Contributor
halter73
left a comment
There was a problem hiding this comment.
@stephentoub Do you think we should include a duration for LogRequestHandlerException too? It might make sense to move that log into the same method. I could see the duration being useful for LogMessageHandlerException as well, so it might make sense to move the start/completed logs into a single method like HandleMessageAsync or ProcessMessageAsync. It's all kinda strewn about now. We can do that as a follow up though.
Contributor
|
Sure. @copilot please do that |
…ming in HandleMessageAsync Co-authored-by: stephentoub <[email protected]>
Contributor
Author
Done in 75bfca5. Added duration to Example logs:
|
Copilot
AI
changed the title
Add request duration to LogRequestHandlerCompleted log message
Add request duration to LogRequestHandlerCompleted and LogRequestHandlerException log messages
Dec 13, 2025
halter73
previously approved these changes
Dec 13, 2025
stephentoub
reviewed
Dec 13, 2025
…leMessageAsync Co-authored-by: stephentoub <[email protected]>
stephentoub
approved these changes
Dec 13, 2025
halter73
approved these changes
Dec 15, 2025
This was referenced Jan 27, 2026
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.
Create a test to verify the duration logging works correctly(removed per code review)Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.