net/netmon: remove usage of direct callbacks from netmon (#17292)

The callback itself is not removed as it is used in other repos, making
it simpler for those to slowly transition to the eventbus.

Updates #15160

Signed-off-by: Claus Lensbøl <claus@tailscale.com>
This commit is contained in:
Claus Lensbøl
2025-10-01 14:59:38 -04:00
committed by GitHub
parent 6f7ce5eb5d
commit ce752b8a88
28 changed files with 217 additions and 48 deletions
+7
View File
@@ -50,6 +50,7 @@ import (
"tailscale.com/types/logger"
"tailscale.com/types/logid"
"tailscale.com/util/clientmetric"
"tailscale.com/util/eventbus"
"tailscale.com/util/must"
"tailscale.com/util/racebuild"
"tailscale.com/util/syspolicy/pkey"
@@ -489,6 +490,11 @@ type Options struct {
// If non-nil, it's used to construct the default HTTP client.
Health *health.Tracker
// Bus is an optional parameter for communication on the eventbus.
// If non-nil, it's passed to logtail for use in interface monitoring.
// TODO(cmol): Make this non-optional when it's plumbed in by the clients.
Bus *eventbus.Bus
// Logf is an optional logger to use.
// If nil, [log.Printf] will be used instead.
Logf logger.Logf
@@ -615,6 +621,7 @@ func (opts Options) init(disableLogging bool) (*logtail.Config, *Policy) {
Stderr: logWriter{console},
CompressLogs: true,
MaxUploadSize: opts.MaxUploadSize,
Bus: opts.Bus,
}
if opts.Collection == logtail.CollectionNode {
conf.MetricsDelta = clientmetric.EncodeLogTailMetricsDelta