Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Add Runtime Info API

Đang mở
#58 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
api

Hướng nghiên cứu

Bắt đầu với giao diện WIT và các binding được tạo tại stubs/wit_world/imports/compute_runtime.py, sau đó theo dõi cách các API Python SDK hiện có cung cấp thông tin runtime. Sử dụng các giá trị mock của Viceroy để xác minh kiểu trả về, định dạng UUID, hành vi boolean và các kết quả số hợp lý; công việc hoàn tất khi các getter cấp module được liệt kê đã khả dụng và được kiểm thử.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
Python
Star
5
Fork
1
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của fastly/compute-sdk-python

Tất cả issue của fastly/compute-sdk-python

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.