-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
Description
This code:
client_golang/prometheus/registry.go
Lines 452 to 456 in 9358c16
| collectWorker := func() { | |
| for { | |
| select { | |
| case collector := <-checkedCollectors: | |
| collector.Collect(checkedMetricChan) |
will end the whole program if the collector panics, since it is run on a background goroutine. This may be an unpleasant lesson.
As a comparison, the net/http package handles panics anywhere in the serving code, although the author says they should have made this opt-in.
I note that ErrGroup added then removed this feature; reading the thread I understand that the reasons were (1) it could take a long time to reveal the error and (2) the stack trace was lost. Gather can fail immediately on panic, and can supply the stack trace in the error it returns.
Reactions are currently unavailable