feat: replace Traceloop with native OTel instrumentation - #124
Draft
SiddhantBorkar04 wants to merge 1 commit into
Draft
feat: replace Traceloop with native OTel instrumentation#124SiddhantBorkar04 wants to merge 1 commit into
SiddhantBorkar04 wants to merge 1 commit into
Conversation
P0 - src/observability.py: rewrite using opentelemetry-sdk directly. Removes traceloop-sdk dependency. Tracing is opt-in via ENABLE_MCP_OBSERVABILITY=true. Export endpoint controlled by OTEL_EXPORTER_OTLP_ENDPOINT (default: http://localhost:4317). P0 - pyproject.toml: swap traceloop-sdk for opentelemetry-api (main dep, zero-cost no-op) and opentelemetry-sdk + opentelemetry-exporter-otlp-proto-grpc (dev/optional, needed only when tracing is enabled). P0 - src/core/server.py: remove unused @workflow decorator and import now that Traceloop is gone. P1 - src/core/utils.py: add instana.api.request span to make_request(). Records http.method, http.url, http.status_code, and error.type on every Instana REST API call made by any tool. P1 - src/router/*: add tools/call span to all 10 router tool handlers. Each span records gen_ai.tool.name, mcp.method.name, instana.tool.operation, and instana.tool.resource_type. Errors set StatusCode.ERROR; span.end() fires in a finally block. Also includes INSTANA_VERIFY_SSL fix: centralise Configuration() creation into create_instana_configuration() factory that reads INSTANA_VERIFY_SSL=false to disable cert verification for dev/self-signed cert environments.
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.
P0 - src/observability.py: rewrite using opentelemetry-sdk directly.
Removes traceloop-sdk dependency. Tracing is opt-in via
ENABLE_MCP_OBSERVABILITY=true. Export endpoint controlled by
OTEL_EXPORTER_OTLP_ENDPOINT (default: http://localhost:4317).
P0 - pyproject.toml: swap traceloop-sdk for opentelemetry-api (main dep,
zero-cost no-op) and opentelemetry-sdk + opentelemetry-exporter-otlp-proto-grpc
(dev/optional, needed only when tracing is enabled).
P0 - src/core/server.py: remove unused @workflow decorator and import
now that Traceloop is gone.
P1 - src/core/utils.py: add instana.api.request span to make_request().
Records http.method, http.url, http.status_code, and error.type on every
Instana REST API call made by any tool.
P1 - src/router/*: add tools/call span to all 10 router tool handlers.
Each span records gen_ai.tool.name, mcp.method.name,
instana.tool.operation, and instana.tool.resource_type.
Errors set StatusCode.ERROR; span.end() fires in a finally block.
Also includes INSTANA_VERIFY_SSL fix: centralise Configuration() creation into create_instana_configuration() factory that reads INSTANA_VERIFY_SSL=false to disable cert verification for dev/self-signed cert environments.