mi: bound every query with a timeout and add context cancellation (#2738)

Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
This commit is contained in:
Jan-Otto Kröpke
2026-10-16 09:11:40 +02:00
committed by GitHub
parent 126b655afa
commit 54cf194039
9 changed files with 722 additions and 60 deletions
+3 -2
View File
@@ -130,8 +130,9 @@ exercised a live Windows role.
the original `Collection` owns collectors and MI resources. A timed-out call
may still be running: prevent overlap, drain late metrics and do not free its
resources while it runs. Honor the supplied scrape budget in blocking APIs.
`Build` has no budget: bound its MI probe queries with `mi.BuildQueryTimeout`,
never `0` (no MI timeout), so one stalled provider cannot block startup.
`Build` has no budget: bound its MI probe queries with `mi.BuildQueryTimeout`.
A non-positive MI query timeout selects `mi.DefaultQueryTimeout` (5s), which
is too short for slow providers.
- Collectors that reuse metrics or label pairs between scrapes keep an
`internal/metriccache` or `internal/labelcache` field and list it in
`ScrapeCaches()` (`internal/scrapecache`). The collection resets these caches