tjiuming commented on code in PR #16197:
URL: https://github.com/apache/pulsar/pull/16197#discussion_r912342379


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/stats/prometheus/PrometheusMetricsGenerator.java:
##########
@@ -318,4 +298,40 @@ private static void 
generateManagedLedgerBookieClientMetrics(PulsarService pulsa
             // nop
         }
     }
+
+
+    private static void writeOutMetricData(OutputStream out, ByteBuf buffer, 
boolean exposeBufferMetrics,
+                                           boolean enableCompress) throws 
IOException {
+        try {
+            if (enableCompress) {
+                out = new GZIPOutputStream(out);

Review Comment:
   @merlimat  But `CompressionCodecZLib` not in GZIP format, and Prometheus 
read metrics data in GZIP format:
   ```java
   
        if s.gzipr == nil {
                s.buf = bufio.NewReader(resp.Body)
                s.gzipr, err = gzip.NewReader(s.buf)
                if err != nil {
                        return "", err
                }
        } else {
                s.buf.Reset(resp.Body)
                if err = s.gzipr.Reset(s.buf); err != nil {
                        return "", err
                }
        }
   
        n, err := io.Copy(w, io.LimitReader(s.gzipr, s.bodySizeLimit))
        s.gzipr.Close()
        if err != nil {
                return "", err
        }
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to