Add Runtime Info API
还没有人认领这个 Issue。
评估
调研方向
从 WIT 接口和 stubs/wit_world/imports/compute_runtime.py 中生成的绑定开始,然后追踪现有 Python SDK API 如何公开运行时信息。使用 Viceroy 的 mock 值验证返回类型、UUID 格式、布尔行为和合理的数值结果;当列出的模块级 getter 可用且经过测试后,工作即告完成。
由索引模型根据 Issue 内容生成。
描述
Overview
Add support for Fastly's Compute Runtime API, providing access to resource usage metrics and runtime environment information.
WIT Interface
interface compute-runtime {
type vcpu-ms = u64;
type memory-mib = u32;
get-vcpu-ms: func() -> vcpu-ms;
get-heap-mib: func() -> memory-mib;
get-sandbox-id: func() -> string;
get-hostname: func() -> string;
get-pop: func() -> string;
get-region: func() -> string;
get-cache-generation: func() -> u64;
get-customer-id: func() -> string;
get-is-staging: func() -> bool;
get-service-id: func() -> string;
get-service-version: func() -> u64;
get-namespace-id: func() -> string;
}
WIT bindings: stubs/wit_world/imports/compute_runtime.py
API Design
- Simple function-based module API
- Functions:
vcpu_ms(),heap_usage_mib(),sandbox_id(),hostname(),pop(),region(), etc. - All functions are simple getters returning runtime information
- No resource management needed (stateless queries)
- Values equivalent to environment variables (
FASTLY_HOSTNAME,FASTLY_SERVICE_ID, etc.)
Cross-SDK Comparison: All SDKs provide getter functions for CPU/memory/time info. Rust returns structured types, Go returns primitives, JS returns objects. Python should provide simple module-level getters (get_cpu_time_ns()).
Viceroy Testing
Viceroy provides default/mock values for runtime information. Tests can verify:
- Function calls return expected types
- Sandbox ID is a valid UUID format
- Boolean flags work correctly
- Numeric values are reasonable
Actual runtime values will differ between Viceroy and production. Tests should focus on API functionality rather than specific values.
Reference
- 主要语言
- Python
- 星标
- 5
- 派生
- 1
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
fastly/compute-sdk-python 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
fastly/compute-sdk-python#116 ·
-
难度 4/5 3-5 天 新手友好度 35/100
fastly/compute-sdk-python#98 ·
-
难度 5/5 一周以上 新手友好度 35/100
fastly/compute-sdk-python#74 ·
-
难度 5/5 一周以上 新手友好度 35/100
fastly/compute-sdk-python#61 ·
-
Set up Sphinx Documentation Infrastructure可能重新可做 @erikrose 于 171 天前认领,目前没有进行中的 PR。 未关闭
fastly/compute-sdk-python#60 · 已指派 1 人 ·
查看 fastly/compute-sdk-python 的全部 Issue
相似的 Issue
-
pydanty:is-working
难度 2/5 1-3 小时 新手友好度 78/100
pydantic/pydantic-ai#8843 ·
维护者通常 1 天内回复
-
breaking change enhancement server
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
needs-triage
难度 2/5 1-3 小时 新手友好度 85/100
维护者通常 1 天内回复