cmd/tailscale: upload client metrics

More generally, make the logtail.Config similar to the one used by
clients for other platforms.

Updates tailscale/corp#9230
mihaip/flush
Mihai Parparita 2 years ago committed by Mihai Parparita
parent 44d083aaf1
commit 68ecc44a49

@ -28,7 +28,9 @@ import (
"tailscale.com/smallzstd" "tailscale.com/smallzstd"
"tailscale.com/types/logger" "tailscale.com/types/logger"
"tailscale.com/types/logid" "tailscale.com/types/logid"
"tailscale.com/util/clientmetric"
"tailscale.com/util/dnsname" "tailscale.com/util/dnsname"
"tailscale.com/util/must"
"tailscale.com/wgengine" "tailscale.com/wgengine"
"tailscale.com/wgengine/netstack" "tailscale.com/wgengine/netstack"
"tailscale.com/wgengine/router" "tailscale.com/wgengine/router"
@ -317,15 +319,14 @@ func (b *backend) CloseTUNs() {
// SetupLogs sets up remote logging. // SetupLogs sets up remote logging.
func (b *backend) SetupLogs(logDir string, logID logid.PrivateID) { func (b *backend) SetupLogs(logDir string, logID logid.PrivateID) {
logcfg := logtail.Config{ logcfg := logtail.Config{
Collection: "tailnode.log.tailscale.io", Collection: logtail.CollectionNode,
PrivateID: logID, PrivateID: logID,
Stderr: log.Writer(), Stderr: log.Writer(),
MetricsDelta: clientmetric.EncodeLogTailMetricsDelta,
IncludeProcID: true,
IncludeProcSequence: true,
NewZstdEncoder: func() logtail.Encoder { NewZstdEncoder: func() logtail.Encoder {
w, err := smallzstd.NewEncoder(nil) return must.Get(smallzstd.NewEncoder(nil))
if err != nil {
panic(err)
}
return w
}, },
HTTPC: &http.Client{Transport: logpolicy.NewLogtailTransport(logtail.DefaultHost)}, HTTPC: &http.Client{Transport: logpolicy.NewLogtailTransport(logtail.DefaultHost)},
} }

Loading…
Cancel
Save