-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
Labels
Description
the following golang code:
package main
import (
"fmt"
"io"
"log"
"net/http"
"strings"
"time"
"github.com/prometheus/common/expfmt"
)
func main() {
_, body, err := HTTPGet(fmt.Sprintf("http://127.0.0.1:%d/stats/prometheus", 9901))
if err != nil {
fmt.Println("get metric error: %v", err)
return
}
reader := strings.NewReader(body)
_, err = (&expfmt.TextParser{}).TextToMetricFamilies(reader)
if err != nil {
fmt.Println("parse metric error: %v body: %s", err, body)
}
}
func HTTPGet(url string) (code int, respBody string, err error) {
log.Println("HTTP GET", url)
client := &http.Client{Timeout: time.Minute}
resp, err := client.Get(url)
if err != nil {
log.Println(err)
return 0, "", err
}
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if err != nil {
log.Println(err)
return 0, "", err
}
respBody = string(body)
code = resp.StatusCode
return code, respBody, nil
}will pass with envoyproxy/envoy:dev-01aed8aa302d707a5598dbfd063dcfe3b31655f8 and fail with envoy:dev-6301fefe405d5c9bade12658034f17f5ad4cdd3c
seems related to #24998
Reactions are currently unavailable