#12378·signoz

Remove unused Manager.Pause method

Author: Harsh23KashyapCreated Aug 2, 2026Updated Sep 16, 2026

Problem

pkg/query-service/rules/manager.go:241-248 carries a TODO(jatinderjit): remove (unused)? comment above Manager.Pause:

go
// TODO(jatinderjit): remove (unused)?
func (m *Manager) Pause(b bool) {
    m.mtx.Lock()
    defer m.mtx.Unlock()
    for _, t := range m.tasks {
        t.Pause(b)
    }
}

The method is a public surface on *Manager that iterates over the manager's task list and calls Pause on each one. A grep across pkg/, cmd/, and the test tree shows the only caller is the loop body itself at manager.go:246. No other file in the repo calls Manager.Pause. The Task interface at pkg/query-service/rules/task.go:27 still exposes Pause(b bool) so each individual task keeps its pause behavior; only the public aggregation method is unused.

Motivation

The TODO is explicit: the maintainer flagged the method as removable. The method is dead code externally, and keeping it requires future maintainers to reason about a public API that is never invoked. Removing it shrinks the public surface and makes the dead branch explicit (it goes away rather than lingering as a "what calls this?" question for new contributors).

This is the parallel cleanup to PR #12371, which removed the unrelated RuleTask.Interval() method on *RuleTask. Both methods were flagged by jatinderjit with the same (unused)? TODO; RuleTask.Interval() was not in any interface and was straightforward to drop. Manager.Pause is not in any interface either — only the underlying Task.Pause is required, and it remains.

Proposed solution

Remove the Manager.Pause method and the TODO(jatinderjit) comment at pkg/query-service/rules/manager.go:241-248. The Task interface at pkg/query-service/rules/task.go:27 keeps its Pause(b bool) method, and the two implementations at pkg/query-service/rules/rule_task.go:78 and pkg/query-service/rules/prom_rule_task.go:83 stay unchanged.

No other call site needs updating: the only Manager.Pause call is the loop body inside the method itself, which is removed along with the method.

Scope

  • Modified: pkg/query-service/rules/manager.go — delete the method and the TODO comment. Net: -8 lines.

Acceptance criteria

  • Manager.Pause is no longer a method on *Manager.
  • The TODO(jatinderjit): remove (unused)? comment is removed.
  • The Task interface still includes Pause(b bool).
  • RuleTask.Pause and PromRuleTask.Pause are unchanged.
  • go vet ./pkg/query-service/rules/... is clean.
  • go test -race -count=1 -short ./pkg/query-service/rules/... passes.
  • go build ./... is clean.

Backward compatibility

Manager.Pause is a public method on a struct (*Manager) that is exported as part of the ruler.Ruler interface at pkg/ruler/ruler.go. The interface does not include Pause, so removing the method on the concrete *Manager does not change the interface or any other type that satisfies it. External code that imported pkg/query-service/rules and called Manager.Pause directly will fail to compile; no such code exists in this repository.

Alternatives considered

  • Keep the method for symmetry with Task.Pause. Rejected: the TODO is explicit, no caller exists, and the symmetry argument does not justify dead public API.
  • Add a caller. Rejected: the user's feat/12217-prom-rule-eval-interval branch covers the only conceptual use case (per-group interval control), and the maintainer has not asked for a manager-level pause entry point.
  • Move the loop body to a pauseAll private helper. Rejected: the loop body is 4 lines, has a single caller (itself), and adding a private helper for it would just move the dead code around.