{
  "repo": "tidbcloud/VictoriaMetrics",
  "binary": "vmalert",
  "binary_path": "app/vmalert/main.go",
  "dependencies": {
    "Runtime VMAlertLifecycle.ResolveExternalURL": {
      "infrastructure": {},
      "services": []
    },
    "Runtime VMAlertLifecycle.LoadTemplates": {
      "infrastructure": {
        "filesystem": {
          "conditions": [
            "Only when rule.templates points to local files or globs"
          ],
          "operations": [
            {
              "operation": "READ TEMPLATES",
              "trigger": "Load Go templates used by alert annotations and the UI",
              "conditions": [
                "templates.Load(...) succeeds"
              ],
              "implementation": "main -> templates.Load(ruleTemplatesPath, extURL)"
            }
          ]
        }
      },
      "services": []
    },
    "Runtime VMAlertLifecycle.DryRunValidateRules": {
      "infrastructure": {
        "local_config": {
          "conditions": [
            "When dryRun == true"
          ],
          "operations": [
            {
              "operation": "READ AND VALIDATE RULES",
              "trigger": "Validate rule files and exit without starting runtime services",
              "conditions": [
                "dryRun == true"
              ],
              "implementation": "main -> config.Parse(rulePath, notifier.ValidateTemplates, true)"
            }
          ]
        }
      },
      "services": []
    },
    "Runtime VMAlertLifecycle.InitializeAlertURLGenerator": {
      "infrastructure": {},
      "services": []
    },
    "Runtime VMAlertLifecycle.InitializeReplayRemoteWrite": {
      "infrastructure": {},
      "services": [
        {
          "name": "configured-remote-write-http",
          "target_interface": "remoteWrite.url endpoint",
          "operation_type": "http_post",
          "conditions": [
            "Only when replay.timeFrom is configured"
          ],
          "operations": [
            {
              "operation": "INITIALIZE REMOTE WRITE",
              "trigger": "Create the remote-write client used by replay mode",
              "conditions": [
                "replay.timeFrom != \"\"",
                "remotewrite.Init(...) returns non-nil"
              ],
              "implementation": "main -> remotewrite.Init(context.Background())"
            }
          ]
        }
      ]
    },
    "Runtime VMAlertLifecycle.InitializeReplayDatasource": {
      "infrastructure": {},
      "services": [
        {
          "name": "configured-datasource-http",
          "target_interface": "datasource.url query API",
          "operation_type": "http_get",
          "conditions": [
            "Only when replay.timeFrom is configured"
          ],
          "operations": [
            {
              "operation": "INITIALIZE DATASOURCE",
              "trigger": "Create a nocache datasource querier for historical replay",
              "conditions": [
                "replay.timeFrom != \"\"",
                "datasource.Init(url.Values{\"nocache\":{\"1\"}}) succeeds"
              ],
              "implementation": "main -> datasource.Init(url.Values{\"nocache\":{\"1\"}})"
            }
          ]
        }
      ]
    },
    "Runtime VMAlertLifecycle.RunReplay": {
      "infrastructure": {
        "local_config": {
          "conditions": [
            "Replay mode is active"
          ],
          "operations": [
            {
              "operation": "ITERATE RULES",
              "trigger": "Replay rule groups over a historical time range",
              "conditions": [
                "replay.timeFrom != \"\""
              ],
              "implementation": "main -> replay(groupsCfg, q, rw) -> rule.NewGroup(...).Replay(...)"
            }
          ]
        }
      },
      "services": [
        {
          "name": "configured-datasource-http",
          "target_interface": "datasource.url query_range API",
          "operation_type": "http_get",
          "conditions": [
            "Replay mode is active"
          ],
          "operations": [
            {
              "operation": "QUERY HISTORY",
              "trigger": "Fetch historical data for replayed recording and alerting rules",
              "conditions": [
                "rule.Group.Replay(...) executes datasource queries"
              ],
              "implementation": "replay(...) -> rule.Group.Replay(...) -> datasource querier requests"
            }
          ]
        },
        {
          "name": "configured-remote-write-http",
          "target_interface": "remoteWrite.url endpoint",
          "operation_type": "http_post",
          "conditions": [
            "Replay mode is active",
            "Generated samples must be written out"
          ],
          "operations": [
            {
              "operation": "WRITE REPLAYED SAMPLES",
              "trigger": "Push replay-generated samples to the configured remote write destination",
              "conditions": [
                "rw is non-nil"
              ],
              "implementation": "replay(...) -> rule.Group.Replay(...) -> remotewrite client"
            }
          ]
        }
      ]
    },
    "Runtime VMAlertLifecycle.InitializeManager": {
      "infrastructure": {},
      "services": [
        {
          "name": "configured-datasource-http",
          "target_interface": "datasource.url query API",
          "operation_type": "http_get",
          "conditions": [
            "Always"
          ],
          "operations": [
            {
              "operation": "INITIALIZE DATASOURCE",
              "trigger": "Create the datasource querier builder used by rule groups",
              "conditions": [
                "datasource.Init(nil) succeeds"
              ],
              "implementation": "newManager(ctx) -> datasource.Init(nil)"
            }
          ]
        },
        {
          "name": "configured-alertmanager-http",
          "target_interface": "alertmanager notifier endpoint",
          "operation_type": "http_post",
          "conditions": [
            "Only when notifier.url, notifier.config, or notifier.blackhole makes notifier.Init(...) return a notifier set"
          ],
          "operations": [
            {
              "operation": "INITIALIZE NOTIFIERS",
              "trigger": "Build notifier targets used by alerting rules",
              "conditions": [
                "notifier.Init(...) succeeds"
              ],
              "implementation": "newManager(ctx) -> notifier.Init(alertURLGeneratorFn, labels, externalURL)"
            }
          ]
        },
        {
          "name": "configured-remote-write-http",
          "target_interface": "remoteWrite.url endpoint",
          "operation_type": "http_post",
          "conditions": [
            "Only when remotewrite.Init(ctx) returns a non-nil client"
          ],
          "operations": [
            {
              "operation": "INITIALIZE REMOTE WRITE",
              "trigger": "Create the remote-write client used by recording rules",
              "conditions": [
                "remotewrite.Init(ctx) returns non-nil"
              ],
              "implementation": "newManager(ctx) -> remotewrite.Init(ctx)"
            }
          ]
        },
        {
          "name": "configured-remote-read-http",
          "target_interface": "remoteRead.url endpoint",
          "operation_type": "http_get",
          "conditions": [
            "Only when remoteread.Init() succeeds and restore mode later passes the remote-read builder into groups"
          ],
          "operations": [
            {
              "operation": "INITIALIZE REMOTE READ",
              "trigger": "Create the remote-read builder used for state restoration",
              "conditions": [
                "remoteread.Init() succeeds"
              ],
              "implementation": "newManager(ctx) -> remoteread.Init()"
            }
          ]
        }
      ]
    },
    "Runtime VMAlertLifecycle.ParseInitialRules": {
      "infrastructure": {
        "local_config": {
          "conditions": [
            "Always"
          ],
          "operations": [
            {
              "operation": "READ RULE FILES",
              "trigger": "Load the initial rule set before starting rule groups",
              "conditions": [
                "config.Parse(rulePath, validateTplFn, validateExpressions) succeeds"
              ],
              "implementation": "main -> config.Parse(rulePath, validateTplFn, validateExpressions)"
            }
          ]
        }
      },
      "services": []
    },
    "Runtime VMAlertLifecycle.StartManager": {
      "infrastructure": {},
      "services": [
        {
          "name": "configured-datasource-http",
          "target_interface": "datasource.url query API",
          "operation_type": "http_get",
          "conditions": [
            "Always; rule groups need the datasource querier to evaluate recording and alerting expressions"
          ],
          "operations": [
            {
              "operation": "EVALUATE RULES",
              "trigger": "Start rule groups that periodically evaluate datasource queries",
              "conditions": [
                "manager.start(ctx, groupsCfg) succeeds"
              ],
              "implementation": "main -> manager.start(...) -> manager.update(...) -> startGroup(...) -> rule.Group.Start(ctx, notifiers, rw, rr)"
            }
          ]
        },
        {
          "name": "configured-alertmanager-http",
          "target_interface": "alertmanager notifier endpoint",
          "operation_type": "http_post",
          "conditions": [
            "Only when at least one alerting rule is present"
          ],
          "operations": [
            {
              "operation": "SEND ALERTS",
              "trigger": "Alerting rules send generated alerts through configured notifiers",
              "conditions": [
                "arPresent == true",
                "m.notifiers != nil"
              ],
              "implementation": "manager.update(...) -> startGroup(...) -> rule.Group.Start(ctx, notifiers, rw, rr)"
            }
          ]
        },
        {
          "name": "configured-remote-write-http",
          "target_interface": "remoteWrite.url endpoint",
          "operation_type": "http_post",
          "conditions": [
            "Only when at least one recording rule is present"
          ],
          "operations": [
            {
              "operation": "WRITE RECORDING RESULTS",
              "trigger": "Recording rules push generated samples through remote write",
              "conditions": [
                "rrPresent == true",
                "m.rw != nil"
              ],
              "implementation": "manager.update(...) -> startGroup(...) -> rule.Group.Start(ctx, notifiers, rw, rr)"
            }
          ]
        },
        {
          "name": "configured-remote-read-http",
          "target_interface": "remoteRead.url endpoint",
          "operation_type": "http_get",
          "conditions": [
            "Only when restore == true and the group runtime uses remote read for state restoration"
          ],
          "operations": [
            {
              "operation": "RESTORE ALERT STATE",
              "trigger": "Pass the remote-read builder into rule groups during normal startup",
              "conditions": [
                "restore == true"
              ],
              "implementation": "manager.start(...) -> startGroup(..., restore=true) -> rule.Group.Start(ctx, notifiers, rw, rr)"
            }
          ]
        }
      ]
    },
    "Runtime VMAlertLifecycle.StartConfigReloadLoop": {
      "infrastructure": {
        "local_config": {
          "conditions": [
            "Triggered by SIGHUP or configCheckInterval ticker"
          ],
          "operations": [
            {
              "operation": "RELOAD RULES AND TEMPLATES",
              "trigger": "Re-read notifier config, templates, and rules, then update live groups when checksums change",
              "conditions": [
                "configReload goroutine is running"
              ],
              "implementation": "configReload(...) -> notifier.Reload() -> templates.Load(...) -> config.Parse or config.ParseSilent(...) -> manager.update(...)"
            }
          ]
        }
      },
      "services": []
    },
    "Runtime VMAlertLifecycle.StartHTTPServer": {
      "infrastructure": {},
      "services": []
    },
    "Runtime VMAlertLifecycle.InitializePushMetrics": {
      "infrastructure": {},
      "services": []
    },
    "Runtime VMAlertLifecycle.WaitForSigterm": {
      "infrastructure": {},
      "services": []
    },
    "Runtime VMAlertLifecycle.StopPushMetrics": {
      "infrastructure": {},
      "services": []
    },
    "Runtime VMAlertLifecycle.StopHTTPServer": {
      "infrastructure": {},
      "services": []
    },
    "Runtime VMAlertLifecycle.StopManager": {
      "infrastructure": {},
      "services": []
    },
    "HTTP ANY /health": {
      "infrastructure": {},
      "services": []
    },
    "HTTP ANY /ping": {
      "infrastructure": {},
      "services": []
    },
    "HTTP ANY /metrics": {
      "infrastructure": {},
      "services": []
    },
    "HTTP ANY /flags": {
      "infrastructure": {},
      "services": []
    },
    "HTTP ANY /-/healthy": {
      "infrastructure": {},
      "services": []
    },
    "HTTP ANY /-/ready": {
      "infrastructure": {},
      "services": []
    },
    "HTTP ANY /robots.txt": {
      "infrastructure": {},
      "services": []
    },
    "HTTP ANY /favicon.ico": {
      "infrastructure": {},
      "services": []
    },
    "HTTP ANY /debug/pprof/*": {
      "infrastructure": {},
      "services": []
    },
    "HTTP ANY /vmalert/static/*": {
      "infrastructure": {},
      "services": []
    },
    "HTTP GET /": {
      "infrastructure": {},
      "services": []
    },
    "HTTP ANY /vmalert/alerts": {
      "infrastructure": {},
      "services": []
    },
    "HTTP ANY /vmalert/alert": {
      "infrastructure": {},
      "services": []
    },
    "HTTP ANY /vmalert/rule": {
      "infrastructure": {},
      "services": []
    },
    "HTTP ANY /vmalert/groups": {
      "infrastructure": {},
      "services": []
    },
    "HTTP ANY /vmalert/notifiers": {
      "infrastructure": {},
      "services": []
    },
    "HTTP ANY /rules": {
      "infrastructure": {},
      "services": []
    },
    "HTTP ANY /api/v1/notifiers": {
      "infrastructure": {},
      "services": []
    },
    "HTTP ANY /api/v1/rules": {
      "infrastructure": {},
      "services": []
    },
    "HTTP ANY /api/v1/alerts": {
      "infrastructure": {},
      "services": []
    },
    "HTTP ANY /api/v1/alert": {
      "infrastructure": {},
      "services": []
    },
    "HTTP ANY /api/v1/rule": {
      "infrastructure": {},
      "services": []
    },
    "HTTP ANY /-/reload": {
      "infrastructure": {
        "process_signal": {
          "conditions": [
            "Only after reloadAuthKey validation passes"
          ],
          "operations": [
            {
              "operation": "TRIGGER SIGHUP",
              "trigger": "Request a local config reload through the process SIGHUP path",
              "conditions": [
                "httpserver.CheckAuthFlag(...) == true"
              ],
              "implementation": "requestHandler.handler -> procutil.SelfSIGHUP()"
            }
          ]
        }
      },
      "services": []
    }
  }
}
