add flush

This commit is contained in:
Gorbunov Kirill Andreevich 2024-03-18 16:06:09 +03:00
parent 43a19aca65
commit 3637243ab0
1 changed files with 2 additions and 0 deletions

View File

@ -92,6 +92,7 @@ func (h *Handler) Metrics(ctx context.Context, req *codecpb.Frame, rsp *codecpb.
if md, ok := metadata.FromIncomingContext(ctx); gzipAccepted(md) && ok {
md.Set(contentEncodingHeader, "gzip")
ctx = metadata.NewIncomingContext(ctx, md)
gz := gzipPool.Get().(*gzip.Writer)
defer gzipPool.Put(gz)
@ -99,6 +100,7 @@ func (h *Handler) Metrics(ctx context.Context, req *codecpb.Frame, rsp *codecpb.
defer gz.Close()
w = gz
gz.Flush()
}
if err := h.opts.Meter.Write(w, h.opts.MeterOptions...); err != nil {