Buckets:

download
raw
2.91 kB
{
"role_mappings": [
{
"role": "Entity",
"status": "present",
"symbol": "apm_list_agents",
"file": "src/faultray/cli/apm_cmd.py",
"lines": "414",
"notes": "In-repo CLI client (`faultray apm agents`) that sends httpx.get to {server}/api/apm/agents (apm_cmd.py:446) on the FaultRay API server, so its requests pass through rate_limit_middleware (server.py:337). Other in-repo clients (APM agent, apm/agent.py:366/411/528) also call this server; external HTTP clients are likewise subject to the limit."
},
{
"role": "Enforcer",
"status": "present",
"symbol": "rate_limit_middleware",
"file": "src/faultray/api/server.py",
"lines": "337",
"notes": "FastAPI HTTP middleware registered via @app.middleware(\"http\") on the main app; derives the client id with _get_client_ip (server.py:326, X-Forwarded-For only from trusted proxies) and calls _rate_limiter.is_allowed (server.py:340), returning 429 JSON when blocked, else call_next."
},
{
"role": "Limiter",
"status": "present",
"symbol": "is_allowed",
"file": "src/faultray/api/server.py",
"lines": "80",
"notes": "Reached from rate_limit_middleware at server.py:340. RateLimiter.is_allowed prunes timestamps outside the window, rejects when count >= max_requests, otherwise appends the current timestamp (sliding window per client IP). The unwired RateLimiter in api_versioning.py:92 (per-API-key tiers) is never called and was not used."
},
{
"role": "HistoryProvider",
"status": "present",
"symbol": "requests",
"file": "src/faultray/api/server.py",
"lines": "59",
"notes": "In-memory dict[client_id -> list of timestamps] declared in RateLimiter.__init__; read and updated inline by is_allowed (server.py:80) with no separate accessor method, hence the field is cited. _cleanup (server.py:63) evicts expired/LRU entries."
},
{
"role": "PolicyProvider",
"status": "present",
"symbol": "__init__",
"file": "src/faultray/api/server.py",
"lines": "56",
"notes": "RateLimiter.__init__ sets the policy (max_requests=60, window_seconds=60) used by is_allowed (server.py:80); the singleton is built with defaults at server.py:102 (_rate_limiter = RateLimiter()). Policy is hard-coded, uniform for all clients."
},
{
"role": "System",
"status": "present",
"symbol": "list_agents",
"file": "src/faultray/apm/collector.py",
"lines": "239",
"notes": "GET /api/apm/agents handler on apm_router (prefix /api/apm, included at server.py:474), reached via call_next in rate_limit_middleware (server.py:350) after the limiter allows the request; it is the endpoint the traced Entity (apm_cmd.py:446) calls. The middleware applies to all routes, e.g. api_simulate in routes/simulation.py:151 too."
}
]
}

Xet Storage Details

Size:
2.91 kB
·
Xet hash:
d4fefffe1ef4a830d4998fcb1da097796e6f11b5d915acab9d40003439121b6e

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.