-
Notifications
You must be signed in to change notification settings - Fork 244
Vendor Agnostic OpenTelemetry Observability Support #735 and #727 phoenix #733
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
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
Signed-off-by: Mihai Criveti <[email protected]>
Signed-off-by: Mihai Criveti <[email protected]>
Signed-off-by: Mihai Criveti <[email protected]>
Signed-off-by: Mihai Criveti <[email protected]>
Signed-off-by: Mihai Criveti <[email protected]>
Signed-off-by: Mihai Criveti <[email protected]>
Signed-off-by: Mihai Criveti <[email protected]>
Signed-off-by: Mihai Criveti <[email protected]>
Signed-off-by: Mihai Criveti <[email protected]>
Signed-off-by: Mihai Criveti <[email protected]>
Signed-off-by: Mihai Criveti <[email protected]>
PR TEST SUMMARY: make serve - pass make test - PASSmake autoflake isort black flake8 - PASS no errorsmake pylint - PASS
make smoketest - PASS
make doctest - PASS |
PR TEST SUMMARY:make serve - passmake test - PASSmake autoflake isort black flake8 - PASS no errorsmake pylint - PASS
make smoketest - PASS
make doctest - PASS |
Thank you for testing all, merging! |
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.
Observability Implementation Status
Executive Summary
Implemented vendor-agnostic OpenTelemetry observability for MCP Gateway with support for multiple backends (Phoenix, Jaeger, Zipkin, Tempo, DataDog, etc.). The implementation provides distributed tracing across all core services with zero overhead when disabled.
Closes #735 #727
What Was Implemented
1. Core Observability Module (
mcpgateway/observability.py
)Features Added:
✅ Vendor-agnostic OpenTelemetry SDK integration
✅ Configuration via environment variables
✅ Tracing utilities
init_telemetry()
- Initialize tracer with backend configurationcreate_span()
- Context manager for manual instrumentationtrace_operation()
- Decorator for automatic function tracing✅ Performance optimizations
Code Quality Improvements:
observability_simple.py
toobservability.py
(it's production-grade!)tracer
to_TRACER
following Python conventions2. Service Instrumentation
Tool Service (
mcpgateway/services/tool_service.py
)create_span("tool.invoke")
with attributes:tool.name
,tool.id
,tool.integration_type
tool.gateway_id
,arguments_count
,has_headers
success
,error
,error.message
duration.ms
Prompt Service (
mcpgateway/services/prompt_service.py
)create_span("prompt.render")
with attributes:prompt.name
,arguments_count
user
,server_id
,tenant_id
,request_id
messages.count
(after rendering)success
,duration.ms
Resource Service (
mcpgateway/services/resource_service.py
)create_span("resource.read")
with attributes:resource.uri
,user
,server_id
,request_id
http.url
(for HTTP resources)resource.type
(template vs static)content.size
success
,duration.ms
Gateway Service (
mcpgateway/services/gateway_service.py
)create_span("gateway.forward_request")
for federationcreate_span("gateway.health_check_batch")
with nested spans3. Configuration & Environment
Added to
.env.example
:Added to
pyproject.toml
:4. Docker & Deployment
Created
docker-compose.phoenix-simple.yml
:Created
serve-with-tracing.sh
:5. Documentation
Created/Updated:
docs/docs/manage/observability.md
- Main documentationdocs/docs/manage/observability/phoenix-quickstart.md
- Phoenix setup guidedocs/docs/manage/observability/phoenix-deployment.md
- Production deploymentREADME.md
with observability sectionCLAUDE.md
with observability guidance6. Testing
Created
tests/unit/mcpgateway/test_observability.py
:Created
test_phoenix_integration.py
:What Changed
Breaking Changes
Module Renames
observability_simple.py
→observability.py
test_observability_simple.py
→test_observability.py
Import Changes
All services now import:
Configuration Changes
Performance Impact
When Disabled
When Enabled
Compatibility
Tested Backends
Python Compatibility
Known Limitations
Security Considerations
OTEL_EXPORTER_OTLP_INSECURE=false
OTEL_EXPORTER_OTLP_HEADERS
)Migration Notes
For Existing Deployments
OTEL_ENABLE_OBSERVABILITY=false
For Developers
create_span()
for new service methodserror
andsuccess
attributesFuture Enhancements
References