{"record":{"id":"f260c6f566b6d8aa","repo":"thanos-io/thanos","slug":"request-config-against-s","errorCode":null,"errorMessage":"request config against %s","messagePattern":"request config against (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/promclient/promclient.go","lineNumber":306,"sourceCode":"}\n\n// ConfiguredFlags returns configured flags from /api/v1/status/flags Prometheus endpoint.\n// Added to Prometheus from v2.2.\nfunc (c *Client) ConfiguredFlags(ctx context.Context, base *url.URL) (Flags, error) {\n\tu := *base\n\tu.Path = path.Join(u.Path, \"/api/v1/status/flags\")\n\n\treq, err := http.NewRequest(http.MethodGet, u.String(), nil)\n\tif err != nil {\n\t\treturn Flags{}, errors.Wrap(err, \"create request\")\n\t}\n\n\tspan, ctx := tracing.StartSpan(ctx, \"/prom_flags HTTP[client]\")\n\tdefer span.Finish()\n\n\tresp, err := c.Do(req.WithContext(ctx))\n\tif err != nil {\n\t\treturn Flags{}, errors.Wrapf(err, \"request config against %s\", u.String())\n\t}\n\tdefer runutil.ExhaustCloseWithLogOnErr(c.logger, resp.Body, \"query body\")\n\n\tb, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn Flags{}, errors.New(\"failed to read body\")\n\t}\n\n\tswitch resp.StatusCode {\n\tcase 404:\n\t\treturn Flags{}, ErrFlagEndpointNotFound\n\tcase 200:\n\t\tvar d struct {\n\t\t\tData Flags `json:\"data\"`\n\t\t}\n\n\t\tif err := json.Unmarshal(b, &d); err != nil {\n\t\t\treturn Flags{}, errors.Wrapf(err, \"unmarshal response: %v\", string(b))","sourceCodeStart":288,"sourceCodeEnd":324,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/promclient/promclient.go#L288-L324","documentation":"ConfiguredFlags performs the HTTP GET to /api/v1/status/flags using the client's Do method; when the request fails at the transport level (connection refused, DNS failure, timeout, TLS error), the error is wrapped with 'request config against <url>' naming the exact URL attempted.","triggerScenarios":"c.Do(req.WithContext(ctx)) returns a non-nil error — Prometheus unreachable, wrong host/port, connection refused, TLS handshake failure, or context deadline exceeded during the call. Called by an anonymous caller fetching Prometheus flags.","commonSituations":"Prometheus not running or listening on a different port; DNS/service name wrong inside Kubernetes ('http://prometheus:9090' vs actual service); network policy blocking the sidecar; mTLS/TLS misconfiguration; request canceled by context timeout.","solutions":["Check connectivity to the URL in the error: curl http://prometheus:9090/api/v1/status/flags","Verify the Prometheus address/port in configuration","Check DNS resolution and NetworkPolicies/firewall rules","Increase the request context timeout if deadlines are too short","Fix TLS certificates/CA config if the endpoint uses HTTPS"],"exampleFix":"// before\n--prometheus.url=http://localhost:9090   # sidecar runs in another pod\n// after (kubernetes)\n--prometheus.url=http://prometheus-linked.default.svc:9090","handlingStrategy":"retry","validationCode":"conn, err := net.DialTimeout(\"tcp\", \"prometheus:9090\", 2*time.Second)\nif err != nil {\n    return fmt.Errorf(\"prometheus unreachable before request: %w\", err)\n}\nconn.Close()","typeGuard":null,"tryCatchPattern":"flags, err := client.ConfiguredFlags(ctx, u)\nif err != nil {\n    if isNetError(err) { // strings.Contains \"connect\", \"refused\", \"timeout\"\n        // retry with exponential backoff\n    }\n    return err\n}","preventionTips":["Verify Prometheus address/port with curl before deployment","Use Kubernetes service DNS names, not localhost, across pods","Set generous request timeouts on the context","Check NetworkPolicies allow sidecar-to-Prometheus traffic"],"tags":["network","http","connection","prometheus"],"backgroundTag":"connection-refused","analyzedSha":"35b8b991177def87ed52dcf10f9b6d87f07282c8","analyzedAt":"2026-09-07T01:49:59.689Z","contentChangedAt":"2026-09-07T01:49:59.689Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}