refactor: enhance route system with WebMethod metadata

- Add webmethod metadata extraction in routes.py
- Update route matching to return WebMethod objects
- Enhance tracing in library_client.py to use WebMethod info
- Add user_from_scope utility function
This commit is contained in:
Eric Huang 2025-07-24 10:49:50 -07:00
parent 1463b79218
commit e0206795d9
4 changed files with 29 additions and 21 deletions

View file

@ -42,8 +42,8 @@ class DistributionInspectImpl(Inspect):
run_config: StackRunConfig = self.config.run_config
ret = []
all_endpoints = get_all_api_routes()
for api, endpoints in all_endpoints.items():
api_to_routes = get_all_api_routes()
for api, endpoints in api_to_routes.items():
# Always include provider and inspect APIs, filter others based on run config
if api.value in ["providers", "inspect"]:
ret.extend(
@ -53,7 +53,7 @@ class DistributionInspectImpl(Inspect):
method=next(iter([m for m in e.methods if m != "HEAD"])),
provider_types=[], # These APIs don't have "real" providers - they're internal to the stack
)
for e in endpoints
for e, _ in endpoints
if e.methods is not None
]
)
@ -67,7 +67,7 @@ class DistributionInspectImpl(Inspect):
method=next(iter([m for m in e.methods if m != "HEAD"])),
provider_types=[p.provider_type for p in providers],
)
for e in endpoints
for e, _ in endpoints
if e.methods is not None
]
)