prober: update runall handler to be generic (#16895)

Update the runall handler to be more generic with an
exclude param to exclude multiple probes as the requesters
definition.

Updates tailscale/corp#27370

Signed-off-by: Mike O'Driscoll <mikeo@tailscale.com>
This commit is contained in:
Mike O'Driscoll
2025-08-19 12:13:55 -04:00
committed by GitHub
parent e4031daa08
commit 2581e38789
2 changed files with 72 additions and 2 deletions

View File

@@ -18,6 +18,7 @@ import (
"maps"
"math/rand"
"net/http"
"slices"
"sync"
"time"
@@ -585,10 +586,12 @@ type RunHandlerAllResponse struct {
}
func (p *Prober) RunAllHandler(w http.ResponseWriter, r *http.Request) error {
excluded := r.URL.Query()["exclude"]
probes := make(map[string]*Probe)
p.mu.Lock()
for _, probe := range p.probes {
if !probe.IsContinuous() && probe.name != "derpmap-probe" {
if !probe.IsContinuous() && !slices.Contains(excluded, probe.name) {
probes[probe.name] = probe
}
}