@@ -47,11 +47,6 @@ const (
4747 CollectionNode = "tailnode.log.tailscale.io"
4848)
4949
50- type Encoder interface {
51- EncodeAll (src , dst []byte ) []byte
52- Close () error
53- }
54-
5550type Config struct {
5651 Collection string // collection name, a domain name
5752 PrivateID logid.PrivateID // private ID for the primary log stream
@@ -66,9 +61,6 @@ type Config struct {
6661 Buffer Buffer // temp storage, if nil a MemoryBuffer
6762 CompressLogs bool // whether to compress the log uploads
6863
69- // Deprecated: Use CompressUploads instead.
70- NewZstdEncoder func () Encoder // if set, used to compress logs for transmission
71-
7264 // MetricsDelta, if non-nil, is a func that returns an encoding
7365 // delta in clientmetrics to upload alongside existing logs.
7466 // It can return either an empty string (for nothing) or a string
@@ -162,9 +154,6 @@ func NewLogger(cfg Config, logf tslogger.Logf) *Logger {
162154 }
163155 l .SetSockstatsLabel (sockstats .LabelLogtailLogger )
164156 l .compressLogs = cfg .CompressLogs
165- if cfg .NewZstdEncoder != nil {
166- l .zstdEncoder = cfg .NewZstdEncoder ()
167- }
168157
169158 ctx , cancel := context .WithCancel (context .Background ())
170159 l .uploadCancel = cancel
@@ -192,7 +181,6 @@ type Logger struct {
192181 sentinel chan int32
193182 clock tstime.Clock
194183 compressLogs bool
195- zstdEncoder Encoder
196184 uploadCancel func ()
197185 explainedRaw bool
198186 metricsDelta func () string // or nil
@@ -273,9 +261,6 @@ func (l *Logger) Shutdown(ctx context.Context) error {
273261 io .WriteString (l , "logger closing down\n " )
274262 <- done
275263
276- if l .zstdEncoder != nil {
277- return l .zstdEncoder .Close ()
278- }
279264 return nil
280265}
281266
@@ -379,15 +364,9 @@ func (l *Logger) uploading(ctx context.Context) {
379364 body := l .drainPending ()
380365 origlen := - 1 // sentinel value: uncompressed
381366 // Don't attempt to compress tiny bodies; not worth the CPU cycles.
382- if (l .compressLogs || l .zstdEncoder != nil ) && len (body ) > 256 {
383- var zbody []byte
384- switch {
385- case l .zstdEncoder != nil :
386- zbody = l .zstdEncoder .EncodeAll (body , nil )
387- default :
388- zbody = zstdframe .AppendEncode (nil , body ,
389- zstdframe .FastestCompression , zstdframe .LowMemory (true ))
390- }
367+ if l .compressLogs && len (body ) > 256 {
368+ zbody := zstdframe .AppendEncode (nil , body ,
369+ zstdframe .FastestCompression , zstdframe .LowMemory (true ))
391370
392371 // Only send it compressed if the bandwidth savings are sufficient.
393372 // Just the extra headers associated with enabling compression
0 commit comments