Skip to content

[Infrastructure] Integrate OpenTelemetry (OTel) Tracing for the Safety Pipeline #7

@Vishisht16

Description

@Vishisht16

🎯 Objective

Instrument the 3-stage cascade pipeline with OpenTelemetry spans so enterprise users can monitor HumaneProxy in Datadog, Grafana, or Jaeger.

💡 Why this matters

When an AI agent fails or is slow, developers need to know why. If HumaneProxy adds latency because Stage 3 (Groq API) is slow, it needs to be visible in the company's distributed tracing dashboard. OpenTelemetry is the industry standard for this.

✅ Acceptance Criteria

  • Add opentelemetry-api and opentelemetry-sdk as optional dependencies (pip install humane-proxy[telemetry]).
  • Wrap proxy.check_async() and the individual stages (Heuristics, Embeddings, Reasoning LLM) in OpenTelemetry spans.
  • Add span attributes (e.g., humane_proxy.session_id, humane_proxy.final_score, humane_proxy.stage_reached).
  • Ensure this feature is strictly opt-in via config.yaml (telemetry.enabled: true). If disabled, there should be zero performance overhead.

📚 Resources

Metadata

Metadata

Labels

backendIssues involving server-side logic, databases, or APIsenhancementNew feature or requestlevel:advancedRequires advanced implementation, bug fixing or refactoringothersMiscellaneous issues that don’t fit other categoriestype:devopsPipeline or deployment relatedtype:docsDocumentation changetype:featureAdds a new featuretype:performanceFixes performance issues

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions