{
  "repo": "tidbcloud/tiflash-autoscale",
  "binary": "server",
  "binary_path": "manager/cmd/server/main.go",
  "dependencies": {
    "HTTP GET /metrics": {
      "infrastructure": {
        "prometheus": {
          "conditions": [
            "Always"
          ],
          "operations": [
            {
              "operation": "Expose runtime and HTTP request metrics",
              "trigger": "Server starts and registers the Prometheus middleware and metrics route",
              "implementation": "r.Use(middleware.PrometheusMiddleware()) and r.GET(\"/metrics\", gin.WrapH(promhttp.Handler()))"
            }
          ]
        }
      },
      "services": []
    },
    "HTTP GET /v1/cluster": {
      "infrastructure": {
        "kubernetes": {
          "conditions": [
            "Always after startup"
          ],
          "operations": [
            {
              "operation": "Resolve tenant-to-pool mappings from the watched ConfigMap and return running TiFlash pod addresses from watched StatefulSet pods",
              "trigger": "Client calls /v1/cluster with tenant_id or tenant_token",
              "implementation": "TenantsPool watches the tiflash config map while Pools watches the main and branch StatefulSet pods via the Kubernetes client"
            }
          ]
        }
      },
      "services": []
    },
    "HTTP GET /v1/clusters": {
      "infrastructure": {
        "kubernetes": {
          "conditions": [
            "Always after startup"
          ],
          "operations": [
            {
              "operation": "List all tracked TiFlash pools from in-memory pod watchers",
              "trigger": "Client calls /v1/clusters",
              "implementation": "DumpClusters reads the Pools cache that is continuously refreshed from Kubernetes pod watch events"
            }
          ]
        }
      },
      "services": []
    },
    "HTTP GET /resume-and-get-topology": {
      "infrastructure": {
        "kubernetes": {
          "conditions": [
            "Always after startup"
          ],
          "operations": [
            {
              "operation": "Resolve tenant topology from watched pool membership and return TiFlash service DNS addresses",
              "trigger": "Client calls /resume-and-get-topology with tidbclusterid",
              "implementation": "GetTopology resolves the tenant through TenantsPool and formats pod service DNS from the Pods cache and configured TiFlash service DNS template"
            }
          ]
        }
      },
      "services": []
    },
    "HTTP GET /healthz": {
      "infrastructure": {},
      "services": []
    }
  }
}
