add flush
This commit is contained in:
		| @@ -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 { | 	if md, ok := metadata.FromIncomingContext(ctx); gzipAccepted(md) && ok { | ||||||
| 		md.Set(contentEncodingHeader, "gzip") | 		md.Set(contentEncodingHeader, "gzip") | ||||||
|  | 		ctx = metadata.NewIncomingContext(ctx, md) | ||||||
| 		gz := gzipPool.Get().(*gzip.Writer) | 		gz := gzipPool.Get().(*gzip.Writer) | ||||||
| 		defer gzipPool.Put(gz) | 		defer gzipPool.Put(gz) | ||||||
|  |  | ||||||
| @@ -99,6 +100,7 @@ func (h *Handler) Metrics(ctx context.Context, req *codecpb.Frame, rsp *codecpb. | |||||||
| 		defer gz.Close() | 		defer gz.Close() | ||||||
|  |  | ||||||
| 		w = gz | 		w = gz | ||||||
|  | 		gz.Flush() | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if err := h.opts.Meter.Write(w, h.opts.MeterOptions...); err != nil { | 	if err := h.opts.Meter.Write(w, h.opts.MeterOptions...); err != nil { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user