-
Notifications
You must be signed in to change notification settings - Fork 20
feat: adding handler middleware to ensure otel attributes are set #150
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
Conversation
This is based on the work in open-telemetry/semantic-conventions#2083 with the goal to be standardised monitoring of this MCP server.
2e1c64e to
571c51a
Compare
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.
Pull Request Overview
This PR adds standardized OpenTelemetry (OTEL) monitoring to the MCP server by implementing configurable trace exporters and comprehensive instrumentation hooks. The changes support different exporter types (OTLP, gRPC, noop) and add tracing middleware for tool and resource handlers.
- Added configurable OTEL exporter support with OTLP, gRPC, and noop options
- Implemented tracing middleware for tool and resource handlers with structured logging
- Updated test coverage to validate different exporter configurations
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/trace/trace.go | Added configurable exporter factory, tracing middleware functions, and updated hooks |
| pkg/trace/trace_test.go | Enhanced tests to validate different exporter types and improved assertions |
| pkg/server/mcp.go | Integrated tracing middleware for tool and resource handlers |
| cmd/buildkite-mcp-server/main.go | Added OTEL exporter configuration and improved console logging for interactive terminals |
| internal/commands/stdio.go | Added startup logging message |
| go.mod | Moved go-isatty dependency from indirect to direct |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
904afef to
d508fb3
Compare
* improved the logging for local interactive users * added a new outer tool span which holds the semantic fields * sorted out error reporting for tools and resources * fixed the annoying error printed for tracing as I wasn't configuring it correctly
d508fb3 to
0c524cd
Compare
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.
One little comment on the protocol name but looks good otherwise.
|
🚀 |
So by default the logger is info, json when non intractive, pretty when interactive. If you enable debug it level is changed to reflect this. To simplify things the global logger is added to the MCP context used by the STDIO server.
This is based on the work in open-telemetry/semantic-conventions#2083 with the goal to be standardised monitoring of this MCP server.