{
  "repo": "pingcap/monitoring",
  "binary": "reload",
  "binary_path": "reload/main.go",
  "dependencies": {
    "HTTP GET /monitoring/rules": {
      "infrastructure": {
        "prometheus": {
          "conditions": [
            "Always"
          ],
          "operations": [
            {
              "operation": "HTTP GET /api/v1/rules",
              "trigger": "Fetch the current rule groups",
              "implementation": "http.NewRequest(\"GET\", fmt.Sprintf(\"%s/api/v1/rules\", s.url), nil)"
            }
          ]
        }
      },
      "services": []
    },
    "HTTP GET /monitoring/configs": {
      "infrastructure": {
        "filesystem": {
          "conditions": [
            "Always"
          ],
          "operations": [
            {
              "operation": "Read watched directory",
              "trigger": "Enumerate .yml config files",
              "implementation": "ioutil.ReadDir(s.dir)"
            }
          ]
        }
      },
      "services": []
    },
    "HTTP GET /monitoring/configs/:config": {
      "infrastructure": {
        "filesystem": {
          "conditions": [
            "Always"
          ],
          "operations": [
            {
              "operation": "Read config file",
              "trigger": "Return the requested rule file content",
              "implementation": "ioutil.ReadFile(fmt.Sprintf(\"%s/%s\", s.dir, configName))"
            }
          ]
        }
      },
      "services": []
    },
    "HTTP PUT /monitoring/configs/:config": {
      "infrastructure": {
        "filesystem": {
          "conditions": [
            "Always"
          ],
          "operations": [
            {
              "operation": "Validate and overwrite rule file",
              "trigger": "Persist updated rule YAML to the watched directory",
              "implementation": "rulefmt.Parse(...) and ioutil.WriteFile(..., s.dir, ...)"
            },
            {
              "operation": "Mirror latest rule file",
              "trigger": "Store a copy under latest-rules when sub-store-path is configured",
              "implementation": "ioutil.WriteFile(..., s.storePath, ...)"
            }
          ]
        }
      },
      "services": []
    },
    "Runtime StaticUI.ServeUI": {
      "infrastructure": {},
      "services": []
    },
    "Runtime ReloadWatcher.WatchRuleDirectory": {
      "infrastructure": {
        "filesystem": {
          "conditions": [
            "Always"
          ],
          "operations": [
            {
              "operation": "Watch directory events",
              "trigger": "Observe write/create/chmod/remove/rename on the watched rule directory",
              "implementation": "fsnotify.NewWatcher() and watcher.Add(r.wathDir)"
            }
          ]
        },
        "prometheus": {
          "conditions": [
            "Valid fsnotify event"
          ],
          "operations": [
            {
              "operation": "HTTP POST /-/reload",
              "trigger": "Trigger Prometheus to reload rule files after a file event",
              "implementation": "http.NewRequest(\"POST\", fmt.Sprintf(\"%s/-/reload\", r.promUrl), nil)"
            }
          ]
        }
      },
      "services": []
    }
  }
}
