Aller au contenu
login
arrow_backRetour aux issues
Tracer-Cloud/opensre #5509

Split integrations/signoz/tools/__init__.py into one package per tool

ecoDébutant good first issue integrations

descriptionDescription

## Goal `integrations/signoz/tools/__init__.py` is 335 lines holding three tools and their helpers. House style is a small `__init__.py` that re-exports, with one package per tool beside it. Signoz is the smallest example in the tree, which is why it goes first: it establishes the layout that the larger splits (grafana 838, datadog 759, kubernetes 1205) then copy. ## What is in the file Three tools, each with its own `_*_is_available` and `_*_extract_params` helpers directly above it: | Lines | Tool | | --- | --- | | 17–140 | `query_signoz_logs` (+ `_logs_is_available`, `_logs_extract_params`, `_normalize_logs_payload`) | | 141–244 | `query_signoz_metrics` (+ `_metrics_is_available`, `_metrics_extract_params`) | | 245–335 | `query_signoz_traces` (+ `_traces_is_available`, …) | ## Target Copy the layout `integrations/slack/tools/` already uses — one directory per tool (`slack_read_list_tool/`, `slack_join_channel_tool/`, …) with a thin `__init__.py` above them. ``` integrations/signoz/tools/ __init__.py re-exports only query_signoz_logs_tool/ query_signoz_metrics_tool/ query_signoz_traces_tool/ ``` Each tool's helpers move with it. Nothing is renamed. ## The one real risk Tools register by decorator **at import time**. If `__init__.py` stops importing a module, that tool silently disappears from the registry and no existing test notices. The acceptance below makes that impossible to miss. ## Acceptance - [ ] Each of the three tools lives in its own package with its helpers - [ ] `integrations/signoz/tools/__init__.py` contains imports and re-exports only — no tool bodies, no helpers - [ ] A test asserts all three SigNoz tool names are still registered after the move. Validate before and after: ``` uv run python -c " from tools.registry import _load_registry_snapshot print(sorted(t.name for t in _load_registry_snapshot() if 'signoz' in t.name))" ``` The two lists must be identical. - [ ] No tool name, description or input schema changed — diff the registered metadata, do not eyeball it - [ ] `make lint format typecheck test` ## Out of scope Other vendors, renaming tools, changing schemas, touching `integrations/signoz/` outside `tools/`. ## Docs `docs/tool-placement-policy.md`, `docs/adding-tools-and-integrations.md`. ## Claiming this issue Ask in [OpenSRE Discord](https://discord.com/invite/opensre) before you start so a maintainer can assign it. Ask OpenSRE maintainers and write a commit under this issue.
codeOuvre sur GitHub