prometheus: Prometheus config reload takes 2 minutes if you remove an unreachable remote_write endpoint

What did you do?

  • Configure a “remote_write” endpoint that is not reachable
  • Remove that endpoint from the config
  • Reload using API /reload

What did you expect to see?

Prometheus reloads config in a while and web server returns 200 OK

What did you see instead? Under which circumstances?

Prometheus takes 2 minutes (exactly) to reload. Web server returned 200OK after 2 minutes. If you configure 2 endpoints and remove both of them, the reload will take 2x2 minutes.

System information

Linux 5.4.0-156-generic x86_64 (container)

Prometheus version

prometheus, version 2.46.0 (branch: HEAD, revision: cbb69e51423565ec40f46e74f4ff2dbb3b7fb4f0)
  build user:       root@42454fc0f41e
  build date:       20230725-12:31:24
  go version:       go1.20.6
  platform:         linux/amd64
  tags:             netgo,builtinassets,stringlabels

Prometheus configuration file

global:
  scrape_interval: 15s
  evaluation_interval: 15s
  external_labels:
remote_write:
  - name: test
    url: 'http://172.17.13.200'
    tls_config:
      insecure_skip_verify: false
  
rule_files:
  - /etc/prometheus/conf/rules/*.yaml

alerting:
  alertmanagers:
  - static_configs:
    - targets:
      - '127.0.0.1:9093'

scrape_configs:
  - job_name: ****
    scrape_interval: 10s
    http_sd_configs:
      - url: http://127.0.0.1:8089/prometheus
        refresh_interval: 60s

Alertmanager version

No response

Alertmanager configuration file

No response

Logs

ts=2023-08-25T11:56:44.635Z caller=main.go:1231 level=info msg="Loading configuration file" filename=/etc/prometheus/conf/prometheus.yaml
ts=2023-08-25T11:56:44.636Z caller=dedupe.go:112 component=remote level=info remote_name=test url=http://172.17.13.200 msg="Stopping remote storage..."
ts=2023-08-25T11:57:27.015Z caller=dedupe.go:112 component=remote level=warn remote_name=test url=http://172.17.13.200 msg="Failed to send batch, retrying" err="Post \"http://172.17.13.200\": dial tcp 172.17.13.200:80: connect: no route to host"
ts=2023-08-25T11:57:44.637Z caller=dedupe.go:112 component=remote level=error remote_name=test url=http://172.17.13.200 msg="non-recoverable error" count=2000 exemplarCount=0 err="context canceled"
ts=2023-08-25T11:57:44.658Z caller=dedupe.go:112 component=remote level=error remote_name=test url=http://172.17.13.200 msg="Failed to flush all samples on shutdown" count=7999
ts=2023-08-25T11:57:44.659Z caller=dedupe.go:112 component=remote level=info remote_name=test url=http://172.17.13.200 msg="WAL watcher stopped" queue=test
ts=2023-08-25T11:57:44.659Z caller=dedupe.go:112 component=remote level=info remote_name=test url=http://172.17.13.200 msg="Stopping metadata watcher..."
ts=2023-08-25T11:58:34.482Z caller=dedupe.go:112 component=remote level=warn remote_name=test url=http://172.17.13.200 msg="Failed to send batch, retrying" err="Post \"http://172.17.13.200\": dial tcp 172.17.13.200:80: connect: no route to host"
ts=2023-08-25T11:58:44.659Z caller=dedupe.go:112 component=remote level=error remote_name=test url=http://172.17.13.200 msg="Failed to flush metadata"
ts=2023-08-25T11:58:44.660Z caller=dedupe.go:112 component=remote level=warn remote_name=test url=http://172.17.13.200 msg="Failed to send batch, retrying" err="Post \"http://172.17.13.200\": context canceled"
ts=2023-08-25T11:58:44.660Z caller=dedupe.go:112 component=remote level=error remote_name=test url=http://172.17.13.200 msg="non-recoverable error while sending metadata" count=701 err="context canceled"
ts=2023-08-25T11:58:44.660Z caller=dedupe.go:112 component=remote level=info remote_name=test url=http://172.17.13.200 msg="Scraped metadata watcher stopped"
ts=2023-08-25T11:58:44.712Z caller=dedupe.go:112 component=remote level=info remote_name=test url=http://172.17.13.200 msg="Remote storage stopped."
ts=2023-08-25T11:58:44.714Z caller=manager.go:677 level=warn component="rule manager" file=/etc/prometheus/conf/rules/smf.yaml group=smf name=smf-n4c-down index=0 msg="Evaluating rule failed" rule="alert: smf-n4c-down\nexpr: pfcp_node_status{target_type=\"smf\"} < 1\nlabels:\n  severity: warning\nannotations:\n  description: SMF unable to get service from UPF {{ $labels.remote_ip }}, due to\n    connectivity failure or insufficient UPF resources.\n  summary: SMF unable to get service from UPF {{ $labels.remote_ip }}\n" err="query timed out in expression evaluation"
ts=2023-08-25T11:58:44.761Z caller=main.go:1268 level=info msg="Completed loading of configuration file" filename=/etc/prometheus/conf/prometheus.yaml totalDuration=2m0.126625265s db_storage=7.583µs remote_storage=2m0.076991599s web_handler=2.916µs query_engine=4.666µs scrape=401.042µs scrape_sd=282.625µs notify=23.219875ms notify_sd=104.417µs rules=24.544792ms tracing=29.75µs

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 20 (3 by maintainers)

Most upvoted comments

@Sheikh-Abubaker go ahead if you want to work on this