Skip to content

Add optional OpenTelemetry tracing - #1612

Closed
loong-solvable wants to merge 5 commits into
kyegomez:masterfrom
loong-solvable:add-optional-opentelemetry
Closed

Add optional OpenTelemetry tracing#1612
loong-solvable wants to merge 5 commits into
kyegomez:masterfrom
loong-solvable:add-optional-opentelemetry

Conversation

@loong-solvable

@loong-solvable loong-solvable commented May 14, 2026

Copy link
Copy Markdown

Summary

  • Add an optional OpenTelemetry tracing helper that is disabled by default and no-ops cleanly when OpenTelemetry packages are unavailable.
  • Enable OTLP export through SWARMS_OTEL_ENABLED, SWARMS_OTEL_SERVICE_NAME, and the standard OTEL_EXPORTER_OTLP_ENDPOINT environment variable.
  • Instrument Agent, AgentRearrange, SequentialWorkflow, ConcurrentWorkflow, SwarmRouter, and MixtureOfAgents run entrypoints with metadata-only spans.
  • Add focused tests covering disabled-mode behavior and safe attribute collection.

Privacy

  • Span attributes intentionally avoid prompt text, task content, tool arguments, responses, images, and conversation history.
  • Captured attributes are limited to component metadata such as component type, name/id, output type, swarm type, and agent count.

Verification

  • python3 -m py_compile swarms/telemetry/otel.py swarms/structs/agent.py swarms/structs/sequential_workflow.py swarms/structs/concurrent_workflow.py swarms/structs/swarm_router.py swarms/structs/mixture_of_agents.py swarms/structs/agent_rearrange.py tests/telemetry/test_otel.py
  • python3 -m pytest tests/telemetry/test_otel.py -q
  • git diff --check

/claim #1199


📚 Documentation preview 📚: https://swarms--1612.org.readthedocs.build/en/1612/

@github-actions

Copy link
Copy Markdown

Hello there, thank you for opening an PR ! 🙏🏻 The team was notified and they will get back to you asap.

@github-actions github-actions Bot added the documentation Improvements or additions to documentation label May 14, 2026
@kyegomez kyegomez closed this May 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants