-
Notifications
You must be signed in to change notification settings - Fork 4
Implement MCP logging and OpenTelemetry tracing for sampling workflows #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
yaonyan
merged 8 commits into
main
from
copilot/fix-957f615c-b304-4a70-b307-b48866d17a26
Oct 4, 2025
Merged
Implement MCP logging and OpenTelemetry tracing for sampling workflows #14
yaonyan
merged 8 commits into
main
from
copilot/fix-957f615c-b304-4a70-b307-b48866d17a26
Oct 4, 2025
Conversation
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
Co-authored-by: yaonyan <[email protected]>
Co-authored-by: yaonyan <[email protected]>
Copilot
AI
changed the title
[WIP] [feature] implement logging, possibly OTEL tracing when sampling
Implement MCP logging and OpenTelemetry tracing for sampling workflows
Oct 3, 2025
Copilot finished work on behalf of
yaonyan
October 3, 2025 07:41
Contributor
|
Make sure console logs are always enabled @copilot |
Co-authored-by: yaonyan <[email protected]>
Contributor
Author
Copilot finished work on behalf of
yaonyan
October 3, 2025 07:57
…el control and structured logging
…mpatibility
This commit introduces several improvements across the project:
* **Documentation (`.github/copilot-instructions.md`, `docs/logging-and-tracing.md`):**
* Added a clear rule in Copilot instructions to avoid Deno-specific APIs, ensuring Node.js compatibility.
* Refactored and clarified the logging and tracing documentation for better readability and conciseness. Removed redundant information and updated feature descriptions.
* **Tracing Configuration (`packages/copilot-sampled-executor/src/workflow/base-sampling-executor.ts`):**
* Updated OpenTelemetry tracing configuration to use `process.env` instead of `Deno.env`, aligning with the Node.js compatibility rule.
* Changed the default `exportTo` strategy from `console` to `otlp` and set a default OTLP endpoint, promoting standard tracing practices.
* Adjusted OpenTelemetry imports to leverage the Node.js SDK for better integration.
* **Server Utilities (`packages/core/src/utils/server.ts`):**
* Removed Deno-specific environment checks and `TextEncoder` usage, further enforcing Node.js compatibility.
* **Sampling Executor (`packages/copilot-sampled-executor/src/workflow/base-sampling-executor.ts`, `packages/copilot-sampling-agent/src/agent.ts`):**
* Added a `summarize` option to the `SamplerConfig` and integrated its passing from the agent to the sampling executor, allowing for control over summarization behavior.
0a14147 to
f748a51
Compare
yaonyan
reviewed
Oct 4, 2025
Contributor
yaonyan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
modified, then qualified
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.
Overview
This PR implements structured logging via the Model Context Protocol (MCP) specification and distributed tracing via OpenTelemetry (OTEL) for sampling workflows, addressing issue #[feature].
What's Changed
🔔 MCP Logging Implementation
Implemented dual logging system that ensures visibility while supporting MCP clients:
New Features:
MCPLoggerclass that sendsnotifications/messageevents per MCP specchild()methodExample Usage:
📊 OpenTelemetry Tracing
Implemented distributed tracing for sampling workflows with configurable export destinations:
Configuration via Environment Variables:
Trace Hierarchy:
🔧 Integration Points
Modified Components:
compose.ts: Server lifecycle events and tool matching warnings now use MCP loggingbase-sampling-executor.ts: Iteration progress logging and automatic span creation for tracinglogging-plugin.ts: Composition logging now uses MCP notificationsBefore:
After:
📦 Dependencies
Added OpenTelemetry packages to
packages/core/deno.json:@opentelemetry/api@^1.9.0@opentelemetry/sdk-trace-base@^1.29.0@opentelemetry/sdk-trace-node@^1.29.0@opentelemetry/exporter-trace-otlp-http@^0.56.0@opentelemetry/resources@^1.29.0@opentelemetry/semantic-conventions@^1.29.0📚 Documentation
Added comprehensive guide at
docs/LOGGING_AND_TRACING.mdcovering:Backward Compatibility
✅ All changes are backward compatible:
Testing
deno fmtReferences
Fixes #12
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.