Add Runtime Info API
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start with the WIT interface and the generated bindings at stubs/wit_world/imports/compute_runtime.py, then trace how existing Python SDK APIs expose runtime information. Use Viceroy's mock values to verify return types, UUID formatting, boolean behavior, and reasonable numeric results; the work is done when the listed module-level getters are available and tested.
Written by the indexing model from the issue text.
Description
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
- Dominant language
- Python
- Stars
- 5
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from fastly/compute-sdk-python
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
fastly/compute-sdk-python#116 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
fastly/compute-sdk-python#98 ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
fastly/compute-sdk-python#74 ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
fastly/compute-sdk-python#61 ·
-
fastly/compute-sdk-python#60 · 1 assignee ·
All issues in fastly/compute-sdk-python
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
learningequality/ricecooker#747 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
BSData/horus-heresy-3rd-edition#3171 ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
run-llama/llama_index#23199 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
KhronosGroup/glTF-Blender-IO#2769 ·