这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@Theosakamg
Copy link
Collaborator

No description provided.

@Theosakamg Theosakamg requested a review from Copilot October 23, 2025 18:45
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR integrates OpenTelemetry distributed tracing into the Upsun MCP Server, providing observability for request flows, performance metrics, and debugging capabilities. The implementation includes configurable sampling rates, multiple exporters (console, OTLP), automatic instrumentation, and environment-based configuration.

Key Changes

  • Added OpenTelemetry SDK with configurable tracing infrastructure supporting console and OTLP exporters
  • Implemented automatic span wrapping for all MCP tool handlers via ToolWrapper utility class
  • Created centralized configuration module with environment variable parsing and validation

Reviewed Changes

Copilot reviewed 22 out of 23 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
upsun-mcp/package.json Added OpenTelemetry dependencies (api, sdk-node, exporters, auto-instrumentations)
upsun-mcp/tsconfig.json Added Node.js types configuration
upsun-mcp/src/core/config.ts New configuration module centralizing OpenTelemetry and app settings
upsun-mcp/src/core/telemetry.ts New telemetry module implementing OpenTelemetry initialization and span utilities
upsun-mcp/src/core/helper.ts Added ToolWrapper class for automatic tracing of tool handlers
upsun-mcp/src/index.ts Integrated telemetry initialization and graceful shutdown handlers
upsun-mcp/src/mcpUpsun.ts Added tracing to connection methods with span attributes and events
upsun-mcp/src/core/gateway.ts Added tracing to server lifecycle methods
upsun-mcp/src/command/*.ts Wrapped all tool handlers with ToolWrapper.trace for automatic observability
upsun-mcp/test/core/*.test.ts Added comprehensive test coverage for telemetry and configuration modules
upsun-mcp/.env.example Added OpenTelemetry environment variable examples and documentation
upsun-mcp/OPENTELEMETRY.md Added comprehensive configuration guide for OpenTelemetry setup

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@Theosakamg Theosakamg added this to the v0.2.0 milestone Oct 23, 2025
@Theosakamg Theosakamg self-assigned this Oct 23, 2025
@Theosakamg Theosakamg added the enhancement New feature or request label Oct 23, 2025
@github-actions
Copy link

Coverage after merging otel into main will be

94.65%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
src
   mcpUpsun.ts95.56%75%100%97.06%176–177
src/command
   activity.ts100%100%100%100%
   backup.ts100%100%100%100%
   certificate.ts100%100%100%100%
   domain.ts100%100%100%100%
   environment.ts100%100%100%100%
   organization.ts100%100%100%100%
   project.ts95.35%75%100%100%70, 77
   route.ts100%100%100%100%
   ssh.ts100%100%100%100%
src/core
   authentication.ts88.15%86.67%78.57%91.80%114, 132, 137, 141, 244–245, 295–296, 296, 296, 296, 296–297
   config.ts98.65%97.92%100%100%85
   gateway.ts80.26%100%66.67%80.70%227–230, 254, 257–258, 260–261, 265, 269
   helper.ts93.75%85.71%100%95.92%216–218, 307–308, 312
   logger.ts96.77%91.43%100%100%24, 74, 97
   telemetry.ts90.98%88.24%100%91.01%149–150, 183–184, 233–234, 282–283, 333–334, 355–356
src/core/transport
   http.ts88.42%87.10%62.50%92.86%100, 58, 82, 85, 91, 91, 91–92
   sse.ts82.52%64.29%85.71%89.71%100, 112, 120, 123, 123, 123–125, 136, 56, 95, 95, 95, 95, 95–96, 99
src/task
   config.ts100%100%100%100%

@github-actions
Copy link

Coverage after merging otel into main will be

94.67%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
src
   mcpUpsun.ts95.56%75%100%97.06%176–177
src/command
   activity.ts100%100%100%100%
   backup.ts100%100%100%100%
   certificate.ts100%100%100%100%
   domain.ts100%100%100%100%
   environment.ts100%100%100%100%
   organization.ts100%100%100%100%
   project.ts95.35%75%100%100%70, 77
   route.ts100%100%100%100%
   ssh.ts100%100%100%100%
src/core
   authentication.ts88.15%86.67%78.57%91.80%114, 132, 137, 141, 244–245, 295–296, 296, 296, 296, 296–297
   config.ts98.65%97.92%100%100%85
   gateway.ts80.26%100%66.67%80.70%227–230, 254, 257–258, 260–261, 265, 269
   helper.ts93.55%80%100%96.15%243–245, 329–330, 334
   logger.ts96.77%91.43%100%100%24, 74, 97
   telemetry.ts90.98%88.24%100%91.01%149–150, 183–184, 233–234, 282–283, 333–334, 355–356
src/core/transport
   http.ts88.42%87.10%62.50%92.86%100, 58, 82, 85, 91, 91, 91–92
   sse.ts82.52%64.29%85.71%89.71%100, 112, 120, 123, 123, 123–125, 136, 56, 95, 95, 95, 95, 95–96, 99
src/task
   config.ts100%100%100%100%

@Theosakamg Theosakamg requested a review from Copilot October 25, 2025 17:51
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 28 out of 29 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link

Coverage after merging otel into main will be

94.67%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
src
   mcpUpsun.ts95.56%75%100%97.06%176–177
src/command
   activity.ts100%100%100%100%
   backup.ts100%100%100%100%
   certificate.ts100%100%100%100%
   domain.ts100%100%100%100%
   environment.ts100%100%100%100%
   organization.ts100%100%100%100%
   project.ts95.35%75%100%100%70, 77
   route.ts100%100%100%100%
   ssh.ts100%100%100%100%
src/core
   authentication.ts88.15%86.67%78.57%91.80%114, 132, 137, 141, 244–245, 295–296, 296, 296, 296, 296–297
   config.ts98.65%97.92%100%100%85
   gateway.ts80.26%100%66.67%80.70%227–230, 254, 257–258, 260–261, 265, 269
   helper.ts93.55%80%100%96.15%243–245, 329–330, 334
   logger.ts96.77%91.43%100%100%24, 74, 97
   telemetry.ts90.98%88.24%100%91.01%149–150, 183–184, 233–234, 282–283, 333–334, 355–356
src/core/transport
   http.ts88.42%87.10%62.50%92.86%100, 58, 82, 85, 91, 91, 91–92
   sse.ts82.52%64.29%85.71%89.71%100, 112, 120, 123, 123, 123–125, 136, 56, 95, 95, 95, 95, 95–96, 99
src/task
   config.ts100%100%100%100%

@Theosakamg Theosakamg requested a review from Copilot October 25, 2025 18:03
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 28 out of 29 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link

Coverage after merging otel into main will be

94.67%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
src
   mcpUpsun.ts95.56%75%100%97.06%176–177
src/command
   activity.ts100%100%100%100%
   backup.ts100%100%100%100%
   certificate.ts100%100%100%100%
   domain.ts100%100%100%100%
   environment.ts100%100%100%100%
   organization.ts100%100%100%100%
   project.ts95.35%75%100%100%70, 77
   route.ts100%100%100%100%
   ssh.ts100%100%100%100%
src/core
   authentication.ts88.15%86.67%78.57%91.80%114, 132, 137, 141, 244–245, 295–296, 296, 296, 296, 296–297
   config.ts98.65%97.92%100%100%85
   gateway.ts80.26%100%66.67%80.70%227–230, 254, 257–258, 260–261, 265, 269
   helper.ts93.55%80%100%96.15%243–245, 329–330, 334
   logger.ts96.77%91.43%100%100%24, 74, 97
   telemetry.ts90.98%88.24%100%91.01%149–150, 183–184, 233–234, 282–283, 333–334, 355–356
src/core/transport
   http.ts88.42%87.10%62.50%92.86%100, 58, 82, 85, 91, 91, 91–92
   sse.ts82.52%64.29%85.71%89.71%100, 112, 120, 123, 123, 123–125, 136, 56, 95, 95, 95, 95, 95–96, 99
src/task
   config.ts100%100%100%100%

@Theosakamg Theosakamg marked this pull request as ready for review October 25, 2025 18:44
@Theosakamg Theosakamg merged commit f449fbd into main Oct 25, 2025
6 checks passed
@Theosakamg Theosakamg deleted the otel branch October 28, 2025 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants