envoy: stats: prometheus scrape failed
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 https://github.com/envoyproxy/envoy/pull/24998
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 17 (17 by maintainers)
Commits related to this issue
- stats: revert "Prom stats perf improvements" (#27226) Commit Message: Reverts #24998 See #27173 Additional Description: Risk Level: n/a Testing: n/a Docs Changes: n/a Release Notes: n/a Pl... — committed to envoyproxy/envoy by jmarantz a year ago
- stats: reproduce redundant TYPE tags problem in Prometheus. (#27239) Commit Message: Reproduces a scenario where it's difficult to use a streaming optimization for Prometheus stats based on scopes wi... — committed to envoyproxy/envoy by jmarantz a year ago
- stats: revert "Prom stats perf improvements" (#27226) Commit Message: Reverts #24998 See #27173 Additional Description: Risk Level: n/a Testing: n/a Docs Changes: n/a Release Notes: n/a Platform Sp... — committed to reskin89/envoy by jmarantz a year ago
- stats: reproduce redundant TYPE tags problem in Prometheus. (#27239) Commit Message: Reproduces a scenario where it's difficult to use a streaming optimization for Prometheus stats based on scopes wi... — committed to reskin89/envoy by jmarantz a year ago
Scanning the issue description, it seems like the issue is that previously
# TYPE envoy_cluster_assignment_stale counterwould only be issued once for all the tags under that name, and now the# TYPEline is issued for every tag.It should be easy to repro in a unit test. I’m hoping we can fix forward quickly.