feat(chromium): add per-conversion network observability with metrics and exemplars

This commit is contained in:
Julien Neuhart
2026-06-02 19:44:54 +02:00
parent e7c8a6a50c
commit 8668a1d710
6 changed files with 321 additions and 15 deletions

View File

@@ -23,6 +23,26 @@ import (
"github.com/gotenberg/gotenberg/v8/pkg/gotenberg"
)
// listenForNetworkActivity accumulates per-conversion network activity into
// aggregate from the always-on Network domain events. It is a no-op when
// aggregate is nil.
func listenForNetworkActivity(ctx context.Context, aggregate *networkAggregate) {
if aggregate == nil {
return
}
chromedp.ListenTarget(ctx, func(ev any) {
switch e := ev.(type) {
case *network.EventResponseReceived:
aggregate.onResponseReceived(e)
case *network.EventLoadingFinished:
aggregate.onLoadingFinished(e)
case *network.EventLoadingFailed:
aggregate.onLoadingFailed(e)
}
})
}
type eventRequestPausedOptions struct {
allowList, denyList []*regexp2.Regexp
denyPrivateIPs bool