Skip to content

feat: replace Traceloop with native OTel instrumentation - #124

Draft
SiddhantBorkar04 wants to merge 1 commit into
instana:mainfrom
SiddhantBorkar04:feature/otel-instrumentation
Draft

feat: replace Traceloop with native OTel instrumentation#124
SiddhantBorkar04 wants to merge 1 commit into
instana:mainfrom
SiddhantBorkar04:feature/otel-instrumentation

Conversation

@SiddhantBorkar04

Copy link
Copy Markdown

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.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant