Skip to content

Prometheus scrape targets are lost after rl-insight server start, leaving all dashboards #145

Description

@tardis-key

Summary

Restarting the monitor stack via rl-insight server start wipes the dynamically registered Prometheus scrape targets, so Prometheus stops scraping and every dashboard (agent_loop_trajectory, quick_start_demo, verl_tainer_* ) goes empty (e.g. run_id variable has no values).

Root cause

  • The repo's prometheus.yml is an empty template (scrape_configs: []); scrape targets are meant to be registered at runtime.
  • Trainers / the monitor hub register themselves at startup via update_prometheus_config()PrometheusTargetStore.register(), which writes targets directly into the runtime prometheus.yml.
  • On startup, _render_prometheus_config() overwrites the runtime prometheus.yml from the repo template, discarding all dynamically registered targets.
  • Prometheus stops scraping; instant queries return empty because samples go stale after ~5 minutes. The historical data itself is NOT lost (still in the TSDB).

Impact

  • All dashboards sharing the Prometheus datasource are affected at once.
  • Also affects anything relying on node_exporter / trainer metrics registered the same way.
  • Broken ordering: hub started before server start loses its registration; server restart after hub startup also loses it.

Suggested fix

Decouple static template from dynamic registration, e.g.:

  1. file_sd: put a fixed scrape_configs entry with file_sd_configs pointing to a targets file (e.g. runtime/targets/trainer.yml); registration only updates that targets file, which server start does not touch.
  2. Or make _render_prometheus_config() merge/keep existing runtime targets instead of overwriting.

Repro

  1. Start data generation (generate_trace_data.py --metrics-report-port 9094) → dashboards show data.
  2. Run rl-insight server start (restart).
  3. curl http://localhost:9090/api/v1/targets → no active targets; all dashboards empty.

Environment

  • Server: 178.139.22.6, container hxb_verl_0810
  • rl-insight dev branch (tardis-key/rl-insight), Grafana 13.0.0 / Prometheus 2.54.1
  • Runtime dir: /root/.rl-insight/runtime, TSDB: /root/.rl-insight/data/prometheus (retention 30d)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions